Re: Proposed patch: make SQL interval-literal syntax work per spec
От | Ron Mayer |
---|---|
Тема | Re: Proposed patch: make SQL interval-literal syntax work per spec |
Дата | |
Msg-id | 48CEF4E1.8040105@cheapcomplexdevices.com обсуждение исходный текст |
Ответ на | Re: Proposed patch: make SQL interval-literal syntax work per spec (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
Tom Lane wrote: > Ron Mayer <rm_pg@cheapcomplexdevices.com> writes: >> Is this code handling negative interval literals right? >> I think I quote the relevant spec part at the bottom. > > We support independent signs for the different components of the Even so it surprises me that: '-1-1'::interval gives me a day-hour interval while '1-1'::interval gives me a year-month interval. >I'm not sure how well the spec copes with that. If I'm read the spec right, SQL 2008 expects "-1 12:34:56" to be what we'd see as "-1 -12:34:56", and doesn't handle with different signs for different components at all. SQL 92 seems to have been simpler, apparently requiring the negative sign to stay outside the quotes. ==SQL 92=========================================================== <interval literal> ::= INTERVAL [ <sign> ] <interval string> <interval qualifier> <interval string> ::= <quote> { <year-month literal> | <day-time literal> } <quote> =================================================================== SQL 200N seems to allow a sign inside the string: ==SQL 200N========================================================= <interval literal> ::= INTERVAL [ <sign> ] <interval string> <interval qualifier> <interval string> ::= <quote> <unquoted interval string> <quote> <unquoted interval string> ::= [ <sign> ] { <year-month literal> | <day-time literal> } ===================================================================
В списке pgsql-hackers по дате отправления: