Re: Blank, nullable date column rejected by psql

2019-02-12 Thread Rich Shepard
On Tue, 12 Feb 2019, Laurenz Albe wrote: If you insert a string into a "date" column, PostgreSQL will try to convert the string to a date with the type input function. The type input function fails on an empty string, since it cannot parse it into a valid "date" value. This also applies to the e

Re: Blank, nullable date column rejected by psql

2019-02-12 Thread Laurenz Albe
Rich Shepard wrote: > Now I know to replace no dates with null I'll do so but I'm curious why this > is needed. NULL is a special "unknown" value in SQL. You can use it for all data types to signal that a value is unknown or not available. If you insert a string into a "date" column, PostgreSQL

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Ron
On 2/11/19 5:44 PM, Rich Shepard wrote: On Mon, 11 Feb 2019, Ron wrote: You've got ADOS (All Databases are Oracle Syndrome). Interesting as I've never bought, used, or seen anything from Oracle. Guess it's transmitted by errent bits. It's easily transmitted via toilet seats. -- Angular mom

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Ken Tanzer
> > > 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,

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Rich Shepard
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 spe

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Ken Tanzer
> > > Ron, > > All of you who responded drove home my need to explicitly enter null when > there are no data for a column. > > Thanks, > > Rich > > 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

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Rich Shepard
On Mon, 11 Feb 2019, Ron wrote: You've got ADOS (All Databases are Oracle Syndrome). Interesting as I've never bought, used, or seen anything from Oracle. Guess it's transmitted by errent bits. Regards, Rich

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Rich Shepard
On Mon, 11 Feb 2019, Rich Shepard wrote: All of you who responded drove home my need to explicitly enter null when there are no data for a column. Correction: when there are no date data for a column. Rich

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Ron
On 2/11/19 5:30 PM, Rich Shepard wrote: On Mon, 11 Feb 2019, Tom Lane wrote: An empty string is not a null. Tom, I understand this yet thought that empty strings and numeric fields were accepted. Guess I need to review this. You've got ADOS (All Databases are Oracle Syndrome). -- Angular

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Rich Shepard
On Mon, 11 Feb 2019, Ron wrote: NULL is nothing. Blank isn't nothing; blank is a zero-length string.  Thus, you need to tell Pg "nothing", not "blank string". Ron, All of you who responded drove home my need to explicitly enter null when there are no data for a column. Thanks, Rich

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Rich Shepard
On Mon, 11 Feb 2019, Tom Lane wrote: An empty string is not a null. Tom, I understand this yet thought that empty strings and numeric fields were accepted. Guess I need to review this. Thanks, Rich

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread David G. Johnston
On Mon, Feb 11, 2019 at 3:44 PM Rich Shepard wrote: > Now I know to replace no dates with null I'll do so but I'm curious why this > is needed. Same reason you needed it about a month ago when you were dealing with a check constraint question with the same error message. David J.

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Tom Lane
Rich Shepard 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.',''), > E

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Adrian Klaver
On 2/11/19 2:44 PM, Rich Shepard wrote: Running postgresql-10.5 on Slackware-14.2. A table has a column defined as Column   | Type  | Collation | Nullable | Default next_contact | date  |   |  | In a .sql file to insert rows in this table psql has a problem when there's no

Re: Blank, nullable date column rejected by psql

2019-02-11 Thread Ron
On 2/11/19 4:44 PM, Rich Shepard wrote: Running postgresql-10.5 on Slackware-14.2. A table has a column defined as Column   | Type  | Collation | Nullable | Default next_contact | date  |   |  | In a .sql file to insert rows in this table psql has a problem when there's no

Blank, nullable date column rejected by psql

2019-02-11 Thread Rich Shepard
Running postgresql-10.5 on Slackware-14.2. A table has a column defined as Column | Type | Collation | Nullable | Default next_contact | date | | | In a .sql file to insert rows in this table psql has a problem when there's no value for the next_contact column: $ psq