Re: [GENERAL] 9.6.1: INSERT with PK as serial

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: [GENERAL] 9.6.1: INSERT with PK as serial
Дата
Msg-id d2554fa0-661b-8be9-ea8b-654dc56c90f5@hogranch.com
обсуждение исходный текст
Ответ на Re: [GENERAL] 9.6.1: INSERT with PK as serial  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: [GENERAL] 9.6.1: INSERT with PK as serial [FIXED]  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
On 1/16/2017 4:30 PM, Rich Shepard wrote:
  I noticed that, too. Here's the first line:

INSERT INTO companies
('comp_id','comp_name','addr1','addr2','city','comp_state','postcode','country','phone','fax','e_mail','url','industry','status','comment')
VALUES
(1,'AG Spray Inc.',' ','PO Box
12129','Salem','OR','97309-0129','USA','503-371-7907','888-273-0937','info@agsprayinc.com','','Chemicals','Opportunity',''),

the above isn't valid postgresql, as field names need to be in "doublequotes" not 'singlequotes'.

but thats not the INSERT statement your error logged...

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

note no list of fields.    note no PK value.   AND no quotes around the values.



-- 
john r pierce, recycling bits in santa cruz

В списке pgsql-general по дате отправления:

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Re: [GENERAL] 9.6.1: INSERT with PK as serial
Следующее
От: David Rowley
Дата:
Сообщение: Re: [GENERAL] 9.6.1: INSERT with PK as serial