Re: [SQL] now() returning int4
От | Tom Lane |
---|---|
Тема | Re: [SQL] now() returning int4 |
Дата | |
Msg-id | 12189.949371217@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [SQL] now() returning int4 ("Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>) |
Список | pgsql-sql |
"Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu> writes: >> db=> SELECT * FROM test WHERE date < now()::int4; > SELECT * FROM test WHERE date < int(now()); > Works here. I believe this is a bug in the typecasting code --- when you try to cast a value to another type that the system considers bit-compatible with the original type, the parser knows that no actual type conversion work is required. But it then decides it doesn't have to do *anything*, and effectively drops the cast entirely. It should be marking the expression result as being of the destination type so that subsequent processing works as the user intends. Related example: regression=# select now()::int4; ?column? ------------------------2000-01-31 21:07:36-05 (1 row) regression=# select int(now()); int -----------949370865 (1 row) Both of these should yield int-formatted output, IMHO. I have this on my to-fix list for 7.0. regards, tom lane
В списке pgsql-sql по дате отправления: