pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Sanjay Minni <sanjay.minni@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: timestamp default current_timestamp not working
Date: Tue, 14 Dec 2021 08:10:52 -0800
Message-ID: <ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com> (raw)
In-Reply-To: <CAMpxBo=JvrCnqws7HpBuWJLano0a-RV2Ovi3g1CQmybrPKbzwQ@mail.gmail.com>
References: <CAMpxBokfgFopJarsHgvxCQiZULLLuzOq_X62V1BH8c19PgcdMw@mail.gmail.com>
	<CAMpxBomkxEiQW7rV-S1ewsEccLRHULJv5QWDmWmr05VSOTg-MA@mail.gmail.com>
	<dbfd8f32-5c51-bf95-766a-0eeffba66583@aklaver.com>
	<CAMpxBo=JvrCnqws7HpBuWJLano0a-RV2Ovi3g1CQmybrPKbzwQ@mail.gmail.com>

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.klaver@aklaver.com 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (7+ messages)

Message-ID: <ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com>
Permalink:  ../ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com/
Also on:    postgresql.org/message-id/ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, sanjay.minni@gmail.com
  Subject: Re: timestamp default current_timestamp not working
  In-Reply-To: <ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com>
  References: <CAMpxBokfgFopJarsHgvxCQiZULLLuzOq_X62V1BH8c19PgcdMw@mail.gmail.com> <CAMpxBomkxEiQW7rV-S1ewsEccLRHULJv5QWDmWmr05VSOTg-MA@mail.gmail.com> <dbfd8f32-5c51-bf95-766a-0eeffba66583@aklaver.com> <CAMpxBo=JvrCnqws7HpBuWJLano0a-RV2Ovi3g1CQmybrPKbzwQ@mail.gmail.com> <ee3549e8-5bf7-9187-5732-5ef1ba739f01@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox