From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Ross J(dot) Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu> |
Cc: | Marc Tardif <admin(at)wtbwts(dot)com>, pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] now() returning int4 |
Date: | 2000-02-01 02:13:37 |
Message-ID: | 12189.949371217@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
"Ross J. Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-02-01 03:03:27 | Re: [SQL] GROUP BY: v6.1 vs. v6.5.2 |
Previous Message | Ray Plante | 2000-01-31 23:03:38 | GROUP BY: v6.1 vs. v6.5.2 |