Re: a date_part question - Mailing list pgsql-general

From Richard Huxton
Subject Re: a date_part question
Date
Msg-id 200303051851.00415.dev@archonet.com
Whole thread Raw
In response to a date_part question  (Tony Grant <tony@tgds.net>)
Responses Re: a date_part question  (Tony Grant <tony@tgds.net>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: What about SELECT INTO in EXECUTE
Next
From: Tom Lane
Date:
Subject: Re: bug ? updates and insert crash the backend