Re: text -> time cast problem
От | Brent Verner |
---|---|
Тема | Re: text -> time cast problem |
Дата | |
Msg-id | 20011206164449.GA13858@rcfile.org обсуждение исходный текст |
Ответ на | Re: text -> time cast problem (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: text -> time cast problem
|
Список | pgsql-hackers |
[2001-12-04 18:15] Tom Lane said: | Peter Eisentraut <peter_e@gmx.net> writes: | > That appears to be what it does, but it's not correct. I point you to | > SQL92: | | > 16)The data type of a <time literal> that does not specify <time | > zone interval> is TIME(P), where P is the number of digits in | > <seconds fraction>, if specified, and 0 otherwise. The data | > type of a <time literal> that specifies <time zone interval> | > is TIME(P) WITH TIME ZONE, where P is the number of digits in | > <seconds fraction>, if specified, and 0 otherwise. | | > In this "time literal" context, TIME does not take a precision value at | > all. The new code certainly has this wrong. The current handling of <time literal> and <timestamp literal> appear to be correct from my reading of the sql standards. | But you are definitely right that | | time '17:12:28.123' sql-99 seems to contradict this assertion. page 160 (Syntax Rules, 6.1 <data type>) 30) If <time precision> is not specified, then 0 (zero) is implicit. If <timestampprecision> is not specified, then 6 is implicit. meaning (to me) that "TIME" should be equivalent "TIME(0)". [snip] | in general we'd like TYPE 'LIT' and 'LIT'::TYPE to | produce the same answers. I agree wholly with this statement. [snip] To get back to my original problem report... I believe the proper solution would be to update the documentation to reflect the fact that "TIME 'hh:mm:ss.ff'" will correctly drop the '.ff' seconds fraction. That said, how should "time"('hh:mm:ss.ff') behave? How could <time precision> be specified in this syntax? If there is no way to specify <time precision>, I believe we should drop the seconds fraction from <time string>. Is there any reason we couldn't drop this typename-as-a-function-call syntax for types like "time" and "timestamp"? cheers. brent p.s. sorry for not replying sooner... -- "Develop your talent, man, and leave the world something. Records are really gifts from people. To think that an artist would love you enough to share his music with anyone is a beautiful thing." -- Duane Allman
В списке pgsql-hackers по дате отправления: