pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: timestamp default current_timestamp not working
Date: Tue, 14 Dec 2021 10:06:40 -0600
Message-ID: <c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@gmail.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>

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 
> <mailto: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.

view thread (7+ messages)  latest in thread

Message-ID: <c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@gmail.com>
Permalink:  ../c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@gmail.com/
Also on:    postgresql.org/message-id/c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@gmail.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: ronljohnsonjr@gmail.com
  Subject: Re: timestamp default current_timestamp not working
  In-Reply-To: <c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@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> <c7a31fbb-d79b-65a0-32c6-817ae8fce6c5@gmail.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