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-12 00:29:31
Message-ID: CAD3a31Ui0HXAmNSEOHdZW1-TkZZStcuZ+Zb+BiFN7cox7Qth3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
>
> Ken,
>
> Well, you've succeeded in confusing me. :-)
>
> 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.
>
> Assuming you're meaning this example:

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

The difference is I didn't specify field c in the list of columns, so it
gets inserted with its default value. That would be the same as:

insert into Activities (person_id,act_date,act_type,notes) values...

Now that will work if you're doing a separate INSERT for each row. If
you're doing multiple VALUES in one select, and some have a next contact
date and some don't, then I think you're going to need to explicitly spell
out your NULLs.

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

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-02-12 00:42:44 Re: Blank, nullable date column rejected by psql
Previous Message Rich Shepard 2019-02-12 00:05:11 Re: Blank, nullable date column rejected by psql