Re: 9.6.1: INSERT with PK as serial

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: 9.6.1: INSERT with PK as serial
Date: 2017-01-17 00:11:58
Message-ID: 7212.1484611918@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:
> Here's an example:

> INSERT INTO companies VALUES
> (1,'AG Spray Inc.',,'PO Box 12129','Salem','OR','97309-0129','USA','503-371-7907','888-273-0937','info(at)agsprayinc(dot)com',,'Chemicals','Opportunity'),

> and the associated error message:

> psql:companies.sql:1: ERROR: syntax error at or near "Spray"
> LINE 1: INSERT INTO companies VALUES (AG Spray Inc.,,PO Box 12129,Sa...

It looks like something deleted the quote marks. How are you entering
this SQL command, exactly?

Also, you can't just write double commas to leave out a item in the
value list. You could write DEFAULT there, ie

... VALUES (1,'AG Spray Inc.',DEFAULT,'PO Box 12129','Salem', ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2017-01-17 00:30:48 Re: 9.6.1: INSERT with PK as serial
Previous Message Rich Shepard 2017-01-17 00:06:28 Re: 9.6.1: INSERT with PK as serial