Re: Not Seeing Syntax Error - Mailing list pgsql-general

From Thom Brown
Subject Re: Not Seeing Syntax Error
Date
Msg-id CAA-aLv64tXy7_iW2P3U8p9+oJQn5rL28wW1xTwupLsZTv1v+YQ@mail.gmail.com
Whole thread Raw
In response to Not Seeing Syntax Error  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Not Seeing Syntax Error
List pgsql-general
On 17 August 2011 16:49, Rich Shepard <rshepard@appl-ecosys.com> wrote:
 For several INSERT INTO rows I get a syntax error when the quant column is
NULL for one specific parameter. I don't see my error. Here is an example
row:

psql:insert.sql:8: ERROR:  syntax error at or near ","
LINE 1: ...ALUES ('9609-0759','BC-1.5','1996-09-19','Arsenic',,'mg/L');
                                                             ^
 The source line is:

INSERT INTO chemistry (lab_nbr, loc_name, sample_date, param, quant,
units)VALUES ('9609-0759','BC-1.5','1996-09-19','Arsenic',,'mg/L');

and the quant column is defined as type real. There are numerous other rows
where quant IS NULL.

 What have I missed?

The error message points to the problem.  No value, not even NULL, has been specified for 5th column.  Either put DEFAULT or NULL in there.  You can't put nothing.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Not Seeing Syntax Error
Next
From: Craig Ringer
Date:
Subject: Re: Connection Error during Pg_restore