Re: Yet Another Timestamp Question: Time Defaults

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Yet Another Timestamp Question: Time Defaults
Дата
Msg-id 50FD6424.3030106@gmail.com
обсуждение исходный текст
Ответ на Yet Another Timestamp Question: Time Defaults  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Yet Another Timestamp Question: Time Defaults  (Rich Shepard <rshepard@appl-ecosys.com>)
Re: Yet Another Timestamp Question: Time Defaults  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.klaver@gmail.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Yet Another Timestamp Question: Time Defaults
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: String comparison and the SQL standard