Re: Yet Another Timestamp Question: Time Defaults

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Yet Another Timestamp Question: Time Defaults
Date: 2013-01-21 15:52:04
Message-ID: 50FD6424.3030106@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/21/2013 07:26 AM, Rich Shepard wrote:
> What is the behavior if a column data type is timestamptz but there is
> only the date portion available? There must be a default time; can that be
> defined?

Easy enough to test:

test=# create table ts_test(ts_fld timestamp with time zone);
CREATE TABLE

test=# insert into ts_test VALUES ('2013-01-21');
INSERT 0 1

test=# SELECT * from ts_test ;
ts_fld
------------------------
2013-01-21 00:00:00-08

Not sure you can change the default supplied by Postgres, but you can on
your end:

test=# insert into ts_test VALUES ('2013-01-21'::date + interval '6' hour);
INSERT 0 1

test=# SELECT * from ts_test ;
ts_fld
------------------------
2013-01-21 00:00:00-08
2013-01-21 06:00:00-08
(2 rows)

>
> Rich
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-01-21 15:53:54 Re: String comparison and the SQL standard
Previous Message Rich Shepard 2013-01-21 15:26:11 Yet Another Timestamp Question: Time Defaults