Re: Blank, nullable date column rejected by psql - Mailing list pgsql-general

From Ken Tanzer
Subject Re: Blank, nullable date column rejected by psql
Date
Msg-id CAD3a31WwPpqJG_QFXtBqhBHO=ODCupY+dOWg08hQcQ90J5NR+g@mail.gmail.com
Whole thread Raw
In response to Re: Blank, nullable date column rejected by psql  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Blank, nullable date column rejected by psql  (Rich Shepard <rshepard@appl-ecosys.com>)
List 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
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Blank, nullable date column rejected by psql
Next
From: github kran
Date:
Subject: Re: Aurora Postgresql RDS DB Latency