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

begin:vcard
fn:Patrice OLIVER
n:OLIVER;Patrice
email;internet:[EMAIL PROTECTED]
x-mozilla-html:FALSE
version:2.1
end:vcard

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to