From: | David Bryan <d_bryan_remove(at)onebox(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Adding constraint to existing table. |
Date: | 2002-01-08 04:17:33 |
Message-ID: | xpu_7.5576$vA2.1800243218@newssvr30.news.prodigy.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need some help with the following. I'm following script in 7.1.3 and 7.1.2
create table sales_sales (
salesid serial,
recid integer,
rep_id integer,
team_id integer,
process_date datetime,
total_lines integer,
total_revenue float4,
cancelled integer,
disconnected integer,
locked integer,
last_updated datetime,
updated_by varchar(15),
contract_date datetime,
clines integer,
cyear integer,
primary key ( salesid )
);
create table sales_sales_detail (
detid serial,
sales_id integer,
prod_id integer,
qty integer,
ext_price float4,
primary key ( detid )
);
create index recid29 on sales_sales ( recid );
create index sales_id30 on sales_sales_detail ( sales_id );
alter table sales_sales add constraint sales_sales_con foreign key
(salesid) references sales_sales_detail(sales_id) on delete cascade;
everything goes fine until I attempt to add the constraint. I get an error
that the unique key is not found. I know that a unique key is generated
with the serial definition.
What is wrong with my SQL statement.
Thanks.
From | Date | Subject | |
---|---|---|---|
Next Message | Arsalan Zaidi | 2002-01-08 05:51:07 | Re: Turning off transactions completely. |
Previous Message | Jason Kwok | 2002-01-08 02:58:32 | How to get the IP connecting my pg server? |