Pb with insert statement

From: Patrice OLIVER <oliverp21(at)free(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: Pb with insert statement
Date: 2004-08-26 21:12:16
Message-ID: 412E5230.5050603@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

To try to solve my precedent problem (PB with stored procedure), I made
this :

Table "structure.categtype"
Column | Type | Modifiers
---------+----------+-----------
catcode | varchar(5) | not null
catlib | varchar(35) |
Indexes:
"pk_categtype" primary key, btree (catcode)

Table "structure.types"
Column | Type | Modifiers
---------+----------+-----------
typcode | varchar(5) | not null
catcode | varchar(5) | not null
typlib | varchar(50) |
Indexes:
"pk_type" primary key, btree (typcode, catcode)
"type_categorie_fk" btree (catcode)
Foreign-key constraints:
"fk_type_classe_categtyp" FOREIGN KEY (catcode) REFERENCES
structure.categtype(catcode) ON UPDATE RESTRICT ON DELETE RESTRICT

Table "structure.uv"
Column | Type | Modifiers
----------+----------------------+--------------------------------
uvnum | varchar(5) | not null
typcode | varchar(5 | not null
catcode | varchar(5) | not null default 'UV'::codeart
uvnumnat | numeric(5,0) |
uvnom | varchar(50) |
uvcycle | character varying(2) |
uvvaleur | numeric(5,2) |
Indexes:
"pk_uv" primary key, btree (uvnum)
Foreign-key constraints:
"fk_uv_caracteri_type" FOREIGN KEY (typcode, catcode) REFERENCES
structure.t
ypes(typcode, catcode) ON UPDATE RESTRICT ON DELETE RESTRICT

When I try to insert values in structure.uv like this :
INSERT INTO structure.uv VALUES ('SGBD','DUVC','UV',0,'BASE DE
DONNEES','B2',.5);

I get the following message :
ERROR: insert or update on table "uv" violates foreign key constraint
"fk_uv_caracteri_type"
DETAIL: Key (typcode,catcode)=(DUVC,UV) is not present in table "types".

Here the related values of structure.types table :
typcode | catcode | typlib

---------+---------+----------------------------------------------------------------
UVC | UV | UV+de+cours
DUVC | UV | Demi-UV+de+cours
UVTP | UV | UV+de+TP
DUVTP | UV | Demi-UV+de+TP
UVTC | UV | UV+de+TP-Cours
DUVTC | UV | Demi-UV+de+TP-Cours

Anyone has an idea ?

Regards,
Patrice

Attachment Content-Type Size
oliverp21.vcf text/x-vcard 124 bytes

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2004-08-27 04:38:30 Re: from PG_DUMP to CVS
Previous Message Greg Stark 2004-08-26 17:06:32 Re: from PG_DUMP to CVS