From: Rich Shepard <rshepard@appl-ecosys.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Blank, nullable date column rejected by psql
Date: Mon, 11 Feb 2019 16:05:11 -0800 (PST)
Message-ID: <alpine.LNX.2.20.1902111558300.28800@salmo.appl-ecosys.com> (raw)
In-Reply-To: <CAD3a31WwPpqJG_QFXtBqhBHO=ODCupY+dOWg08hQcQ90J5NR+g@mail.gmail.com>
References: <alpine.LNX.2.20.1902111434330.28800@salmo.appl-ecosys.com>
<9a60f04a-797b-420b-39db-ac139ce8fa23@gmail.com>
<alpine.LNX.2.20.1902111531040.28800@salmo.appl-ecosys.com>
<CAD3a31WwPpqJG_QFXtBqhBHO=ODCupY+dOWg08hQcQ90J5NR+g@mail.gmail.com>
On Mon, 11 Feb 2019, Ken Tanzer wrote:
> 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:
Ken,
Well, you've succeeded in confusing me. :-)
This is the table's schema:
# \d activities
Table "public.activities"
Column | Type | Collation | Nullable | Default
--------------+-----------------------+-----------+----------+-------------
------------
person_id | integer | | not null |
act_date | date | | not null | CURRENT_DATE
act_type | character varying(12) | | not null | '??'::charac
ter varying
notes | text | | not null | '??'::text
next_contact | date | | |
Indexes:
"activities_pkey" PRIMARY KEY, btree (person_id, act_date, act_type)
Foreign-key constraints:
"activities_act_type_fkey" FOREIGN KEY (act_type) REFERENCES activityty
pes(act_name) ON UPDATE CASCADE ON DELETE RESTRICT
"activities_person_id_fkey" FOREIGN KEY (person_id) REFERENCES people(p
erson_id) ON UPDATE CASCADE ON DELETE RESTRICT
And this is the framwork for adding rows:
insert into Activities (person_id,act_date,act_type,notes,next_contact) values
(
I add values for each column, but if there's no scheduled next_contact date
I left that off. To me, this looks like your second example (with two
columns of values and no date) and I don't see the differences.
Regards,
Rich
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: rshepard@appl-ecosys.com
Subject: Re: Blank, nullable date column rejected by psql
In-Reply-To: <alpine.LNX.2.20.1902111558300.28800@salmo.appl-ecosys.com>
References: <alpine.LNX.2.20.1902111434330.28800@salmo.appl-ecosys.com> <9a60f04a-797b-420b-39db-ac139ce8fa23@gmail.com> <alpine.LNX.2.20.1902111531040.28800@salmo.appl-ecosys.com> <CAD3a31WwPpqJG_QFXtBqhBHO=ODCupY+dOWg08hQcQ90J5NR+g@mail.gmail.com> <alpine.LNX.2.20.1902111558300.28800@salmo.appl-ecosys.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