From: | Sanjay Minni <sanjay(dot)minni(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: timestamp default current_timestamp not working |
Date: | 2021-12-14 16:00:42 |
Message-ID: | CAMpxBo=JvrCnqws7HpBuWJLano0a-RV2Ovi3g1CQmybrPKbzwQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)klaver(at)aklaver(dot)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.
>
> >
> > with warm regards
> > Sanjay Minni
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ron | 2021-12-14 16:06:40 | Re: timestamp default current_timestamp not working |
Previous Message | Tom Lane | 2021-12-14 15:58:55 | Re: When Update balloons memory |