Re: Multiple Primary Keys - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Multiple Primary Keys
Date
Msg-id web-1376227@davinci.ethosmedia.com
Whole thread Raw
In response to Multiple Primary Keys  ("samsom, debra" <dsamsom@bristol.ca>)
List pgsql-novice
Debra,

> psql dc postgres -c "create table "attachments"(
>   "docn" varchar(25) NOT NULL,
>   "issue" varchar(6) NOT NULL,
>   "docna" varchar(4) NOT NULL,
>   "issuea" varchar(20) NOT NULL,
>   "applic" varchar(3),
>   "whereused" varchar(1),
>   CONSTRAINT "attachments_pkey"
>   PRIMARY KEY ("docn","issue","docna","issuea"));"
>
> docn                            issue     docna
> issuea
>
> 012T2100 SHT 01             K001 DR 911380
> A001
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 267
> -001
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 268
> -001
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 270
> -001
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 271
> -001
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 272
> -001

Here's the reason:  Your table definition and your data do not match.
In your tabledef, docna has 4 characters and issuea has 20.  However,
in your data, docna has 20 characters and issuea has 4.  Fix this, and
you should be able to load your data.

-Josh Berkus

pgsql-novice by date:

Previous
From: "samsom, debra"
Date:
Subject: Re: Multiple Primary Keys
Next
From: "samsom, debra"
Date:
Subject: Re: Multiple Primary Keys