Re: Blank, nullable date column rejected by psql

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Blank, nullable date column rejected by psql
Date: 2019-02-11 23:55:44
Message-ID: CAD3a31WwPpqJG_QFXtBqhBHO=ODCupY+dOWg08hQcQ90J5NR+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
>
> Ron,
>
> All of you who responded drove home my need to explicitly enter null when
> there are no data for a column.
>
> Thanks,
>
> Rich
>
>
Just in case you miss this little nuance, you don't necessarily _have_ to
specify a NULL for that column, depending how you're doing your inserts.
You haven't show us your table or what INSERT you're using, but all of
these examples will work, and don't specify an explicit NULL:

CREATE TEMP TABLE foo (a INTEGER NOT NULL, b INTEGER NOT NULL, c DATE);
CREATE TABLE

INSERT INTO foo VALUES (1,2);
INSERT 0 1
^
INSERT INTO foo (a,b) VALUES (1,2);
INSERT 0 1

INSERT INTO foo (a,b) SELECT 1,2;
INSERT 0 1

Cheers,
Ken

--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message github kran 2019-02-12 00:00:42 Re: Aurora Postgresql RDS DB Latency
Previous Message Rich Shepard 2019-02-11 23:44:25 Re: Blank, nullable date column rejected by psql