Re: [HACKERS] Bug: timestamp without time zone column allows timestamptz default

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Bug: timestamp without time zone column allows timestamptz default
Дата
Msg-id 5742.1489504921@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [HACKERS] Bug: timestamp without time zone column allows timestamptz default  (David Fetter <david@fetter.org>)
Список pgsql-hackers
David Fetter <david@fetter.org> writes:
>     CREATE TABLE bar(t TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP);

> This is a foot gun we need not have.

Yes, we do need to have it.

(1) if we remove the implicit cast from timestamptz to timestamp, the
villagers will be on our doorsteps with the usual equipment.  I'm still
hearing bitching about the 8.3 implicit-cast-ectomy, which took away
only casts far less defensible than this one.

(2) you have not actually demonstrated an unacceptable consequence
of the above coding.  I will grant that using "localtimestamp" is
a cleaner and more efficient approach, but:

regression=# create table tt (f1 timestamp default current_timestamp,
regression(# f2 timestamp default localtimestamp);
CREATE TABLE
regression=# insert into tt default values;
INSERT 0 1
regression=# table tt;           f1             |            f2
---------------------------+---------------------------2017-03-14 11:13:31.78774 | 2017-03-14 11:13:31.78774
(1 row)

Looks to me like you get the same results after zone rotation happens.
(The same is true when the column type is timestamptz, btw.)
        regards, tom lane



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

Предыдущее
От: David Fetter
Дата:
Сообщение: [HACKERS] Bug: timestamp without time zone column allows timestamptz default
Следующее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: [HACKERS] Backend crash on non-exclusive backup cancel