Re: a date_part question

From: Richard Huxton <dev(at)archonet(dot)com>
To: Tony Grant <tony(at)tgds(dot)net>, postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Re: a date_part question
Date: 2003-03-05 18:51:00
Message-ID: 200303051851.00415.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-03-05 19:01:42 Re: bug ? updates and insert crash the backend
Previous Message Medi Montaseri 2003-03-05 18:47:37 Re: Why PostgreSQL?