Re: timestamp default current_timestamp not working

Поиск
Список
Период
Сортировка
От Ron
Тема Re: timestamp default current_timestamp not working
Дата
Msg-id c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@gmail.com
обсуждение исходный текст
Ответ на Re: timestamp default current_timestamp not working  (Sanjay Minni <sanjay.minni@gmail.com>)
Список pgsql-general
Show us the code (especially since there is no value "nil" in SQL).

On 12/14/21 10:00 AM, Sanjay Minni wrote:
Its an insert and my insert SQL contains the column timestamp and value nil. 
Will it work if the SQL contains timestamp through value is nil

On Tue, 14 Dec, 2021, 9:20 pm Adrian Klaver, <adrian.klaver@aklaver.com> wrote:
On 12/14/21 07:36, Sanjay Minni wrote:
> Hi
>
> I am not getting the timestamp value which i am expecting to be
> automatically inserted in the column defined:
> ...
> "timestamp" timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
> ...
> (I see the above definition in pgadmin4 in the tab SQL.
> I have set it thru pgadmin4 table->properties->columns by entering
> CURRENT_TIMESTAMP in the default column)
>
> why is the timestamp value not being automatically inserted by the system

1) It is a DEFAULT value so if a value is provided in the INSERT that
will be used.

2) DEFAULT values only apply to INSERTs not UPDATEs.


--
Angular momentum makes the world go 'round.

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

Предыдущее
От: Sanjay Minni
Дата:
Сообщение: Re: timestamp default current_timestamp not working
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: timestamp default current_timestamp not working