Re: timestamp default current_timestamp not working - Mailing list pgsql-general

From Adrian Klaver
Subject Re: timestamp default current_timestamp not working
Date
Msg-id dbfd8f32-5c51-bf95-766a-0eeffba66583@aklaver.com
Whole thread Raw
In response to timestamp default current_timestamp not working  (Sanjay Minni <sanjay.minni@gmail.com>)
Responses Re: timestamp default current_timestamp not working
List pgsql-general
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.

> 
> with warm regards
> Sanjay Minni


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: timestamp default current_timestamp not working
Next
From: Vincent Veyron
Date:
Subject: Re: When Update balloons memory