Re: 'epoch'::timestamp and Daylight Savings - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: 'epoch'::timestamp and Daylight Savings
Date
Msg-id 3DB6E52F.8090509@fourpalms.org
Whole thread Raw
In response to Re: 'epoch'::timestamp and Daylight Savings  ("Hosen, John" <John.Hosen@capita.co.uk>)
List 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



pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: 'epoch'::timestamp and Daylight Savings
Next
From: Thomas Lockhart
Date:
Subject: Re: Time for RC1 soon?