Re: insert into: NULL in date column

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: insert into: NULL in date column
Date: 2019-01-12 15:53:35
Message-ID: CAKFQuwYmB8Htt5rD3ChN9=kgOZOwvA=8aUuoTrPO50t7pz1n0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jan 12, 2019 at 6:43 AM Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
>
> On Sat, 12 Jan 2019, Ricardo Martin Gomez wrote:
>
> > Hi, one question.
> > Do you put explicit "NULL" in the column value?
> > Other option is.
> > You have to delete the column "next_contact" in your INSERT clause.
> > So, if the column has a default value, this value Will be inserted. Else
> > Null value will be inserted.
>
> Ricardo,
>
> I thought of using an explicit null and David confirmed that to be the
> solution. Also, he answered my question that having a default and check
> constraint are not needed.

Actually, you didn't ask about the check constraint, which is actually
horribly broken since current_date is not an immutable function.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-01-12 16:01:01 Re: insert into: NULL in date column
Previous Message Tom Lane 2019-01-12 15:13:08 Re: CREATE COLLATION to match pg_collation data