Pb with insert statement
am 26.08.2004 23:12:16 von oliverp21This is a multi-part message in MIME format.
--------------010600030107060801030505
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
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
--------------010600030107060801030505
Content-Type: text/x-vcard; charset=utf-8;
name="oliverp21.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="oliverp21.vcf"
begin:vcard
fn:Patrice OLIVER
n:OLIVER;Patrice
email;internet:oliverp21@free.fr
x-mozilla-html:FALSE
version:2.1
end:vcard
--------------010600030107060801030505
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
---------------------------(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
--------------010600030107060801030505--