Re: timestamp default current_timestamp not working

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Sanjay Minni <sanjay(dot)minni(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: timestamp default current_timestamp not working
Date: 2021-12-14 16:10:52
Message-ID: ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/14/21 08:00, 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
No nil(NULL) is a valid value for the field as you have not specified
NOT NULL on the column. If you do add that constraint you will get an
error with your inserts. If you want the DEFAULT to work you will need
to not include the "timestamp"(FYI, not a good choice for a name) field
in the INSERT.

>
> On Tue, 14 Dec, 2021, 9:20 pm Adrian Klaver, <adrian(dot)klaver(at)aklaver(dot)com

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Klaudie Willis 2021-12-14 16:16:05 Re: When Update balloons memory
Previous Message David G. Johnston 2021-12-14 16:08:26 Re: timestamp default current_timestamp not working