From: | Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: 9.6.1: INSERT with PK as serial |
Date: | 2017-01-17 00:30:48 |
Message-ID: | alpine.LNX.2.11.1701161620210.18553@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 16 Jan 2017, Tom Lane wrote:
> It looks like something deleted the quote marks. How are you entering
> this SQL command, exactly?
Tom,
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(at)agsprayinc(dot)com','','Chemicals','Opportunity',''),
Other than the comp_id PK column each column's data type is a delimited
string:
CREATE TABLE companies (
comp_id serial PRIMARY KEY,
comp_name varchar(64) NOT NULL,
addr1 varchar(64),
addr2 varchar(64),
city varchar(16),
comp_state char(2),
postcode varchar(9),
country varchar(12) DEFAULT 'USA' NOT NULL,
phone varchar(10),
fax varchar(10),
e_mail varchar(64),
url varchar(64),
industry varchar(24) NOT NULL
CONSTRAINT invalid_industry
CHECK (industry in ('Agriculture', 'Business, other', 'Chemicals',
'Energy', 'Law', 'Manufacturing', 'Mining', 'Municipalities',
'Ports/Marine Services', 'Transportation')),
status varchar(20) NOT NULL
CONSTRAINT invalid_status
CHECK (status in ('Client', 'Proposal submitted', 'Prospect',
'Referral', 'Opportunity', 'No further contact')),
comment text
);
> Also, you can't just write double commas to leave out a item in the
> value list. You could write DEFAULT there, ie
I tried with ,, and ,'', and ,' '. Same error each time. Also, listing
each column name does not fix the problem.
Thanks,
Rich
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2017-01-17 00:35:45 | Re: 9.6.1: INSERT with PK as serial |
Previous Message | Tom Lane | 2017-01-17 00:11:58 | Re: 9.6.1: INSERT with PK as serial |