Re: Blank, nullable date column rejected by psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Blank, nullable date column rejected by psql
Date: 2019-02-11 22:50:24
Message-ID: 31297.1549925424@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rich Shepard <rshepard(at)appl-ecosys(dot)com> writes:
> In a .sql file to insert rows in this table psql has a problem when there's
> no value for the next_contact column:

> $ psql -f activities.sql -d bustrac
> psql:activities.sql:6: ERROR: invalid input syntax for type date: ""
> LINE 2: ...ise. Asked him to call.',''),

> Explicitly replacing the blank field ('') with null is accepted. Why is
> this?

An empty string is not a null.

(Oracle has done untold damage to the field by failing to make this
distinction ... but in theory, and in the SQL standard, and in Postgres,
they're not at all the same thing.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2019-02-11 22:58:35 Re: Blank, nullable date column rejected by psql
Previous Message Adrian Klaver 2019-02-11 22:49:50 Re: Blank, nullable date column rejected by psql