public inbox for [email protected]  
help / color / mirror / Atom feed
From: Didier Gasser-Morlay <[email protected]>
To: Chamath Sajeewa <[email protected]>
Cc: [email protected]
Subject: Re: Not null constraint in postgre
Date: Mon, 27 Jul 2020 08:01:32 +0200
Message-ID: <CAF5nyP9OXyk=7h-Vr_x_pT-09NDmeKcuYWSVWCPmXfR2FObb_g@mail.gmail.com> (raw)
In-Reply-To: <CACpofejb+KOskR1Dn=fPoi4qAiDgOXP2RKEdtKJK7OFwJ2ebbw@mail.gmail.com>
References: <CACpofejb+KOskR1Dn=fPoi4qAiDgOXP2RKEdtKJK7OFwJ2ebbw@mail.gmail.com>

In order to get the default value to kick in in an insert statement (which
I assume you're trying to do), you can either omit that column name from
the insert list or set that column value to DEFAULT (no quotes)

Didier

On Mon, 27 Jul 2020 at 07:45, Chamath Sajeewa <[email protected]> wrote:

> Hi,
> There is a column in my table with not null constraint. Default value is
> set to 0 for that column. In my query, column value is set to null. When i
> try to execute that query in pgsql, it is getting failed due to constraint
> violation. Any idea? This is working in oracle.
> Thank You!
>


view thread (5+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Not null constraint in postgre
  In-Reply-To: <CAF5nyP9OXyk=7h-Vr_x_pT-09NDmeKcuYWSVWCPmXfR2FObb_g@mail.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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox