Re: 'epoch'::timestamp and Daylight Savings

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: "Hosen, John" <John(dot)Hosen(at)capita(dot)co(dot)uk>
Cc: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 'epoch'::timestamp and Daylight Savings
Date: 2002-10-23 18:06:39
Message-ID: 3DB6E52F.8090509@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Create table arnold (
> a int8,
> b timestamp default 'epoch'::timestamp,
> c timestamp default "timestamp"('epoch'::text)
> );
> I think that the best way forward for us (short of re-writing the backend to
> use NULL) will be to just alter the default value to the one in column b in
> the test table above.

Hmm. The "timestamp"() call is forcing TIMESTAMP WITHOUT TIME ZONE,
which then gets converted to TIMESTAMP WITH TIME ZONE (adding in your
one hour offset), which is the default for the unadorned, unquoted
'timestamp' type.

You can use something like

cast('epoch'::text as timestamp with time zone)

to get what you want, and can use "timestamptz"() if you insist. But
that is not recommended for direct use in schema definitions, even if
pgsql chooses to use it for dump/reloads at the moment.

- Thomas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2002-10-23 18:09:37 Re: PREPARE / EXECUTE
Previous Message Greg Copeland 2002-10-23 17:52:34 Re: PREPARE / EXECUTE