Re: insert into: NULL in date column - Mailing list pgsql-general

From David G. Johnston
Subject Re: insert into: NULL in date column
Date
Msg-id CAKFQuwa-Wnz0h3S=_zHWDc5JdnR+9vv1N9FD_-jt-J0kWAR0Zg@mail.gmail.com
Whole thread Raw
In response to Re: insert into: NULL in date column  (Rob Sargent <robjsargent@gmail.com>)
List pgsql-general
On Fri, Jan 11, 2019 at 4:25 PM Rob Sargent <robjsargent@gmail.com> wrote:
> We don't have more context in "activities.sql" but if your OP was
> verbatim, it's keeling over on the comma ending the long text string.
> Something syntactically askew I think.

If the problem was where you described the parser would never have
gotten to the point of trying to pass an empty string to a date
constructor resulting in a runtime error.  It would have failed at
compile time with a very different error probably relating to
"malformed statement" or "unexpected identifier".

The OP provided sufficient detail (though an actual complete failing
command would have been nice) to pinpoint the misunderstanding that
the empty string and null are not the same thing at that converting
the empty string to a date is not possible (i.e., it doesn't just
silently return null for invalid input, one must pass in null
explicitly if one wishes to construct a date typed null.)

David J.


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: insert into: NULL in date column
Next
From: Adrian Klaver
Date:
Subject: Re: insert into: NULL in date column