On Wednesday 05 Mar 2003 9:06 pm, Tony Grant wrote:
> Hello,
>
> Why is date_part('year', timestamp) returning 1988.0?
>
> timestamp is a timestampz field in the table.
>
> Postgresql 7.3
Doesn't seem to reproduce here, though a field called timestamp strikes me as
confusing.
richardh=# CREATE TABLE bar (a text, timestamp timestamptz);
...
richardh=# SELECT * FROM bar;
a | timestamp
---+-------------------------------
a | 2003-03-05 18:48:45.295279+00
b | 2003-03-05 18:48:48.314004+00
c | 2003-03-05 18:48:51.035841+00
richardh=# SELECT a,date_part('year',timestamp) FROM bar;
a | date_part
---+-----------
a | 2003
b | 2003
c | 2003
richardh=# select version();
version
-------------------------------------------------------------
PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96
--
Richard Huxton