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 CAD3a31Ui0HXAmNSEOHdZW1-TkZZStcuZ+Zb+BiFN7cox7Qth3g@mail.gmail.com
Whole thread Raw
In response to Re: Blank, nullable date column rejected by psql  (Rich Shepard <rshepard@appl-ecosys.com>)
List 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
(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: Ron
Date:
Subject: Re: Blank, nullable date column rejected by psql