pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Patrice OLIVER <oliverp21@free.fr>
To: pgsql-sql@postgresql.org
Subject: Pb with insert statement
Date: Thu, 26 Aug 2004 23:12:16 +0200
Message-ID: <412E5230.5050603@free.fr> (raw)

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

Attachments:

oliverp21.vcf (text/x-vcard, 122B) download begin:vcard fn:Patrice OLIVER n:OLIVER;Patrice email;internet:oliverp21@free.fr x-mozilla-html:FALSE version:2.1 end:vcard

Message-ID: <412E5230.5050603@free.fr>
Permalink:  ../412E5230.5050603@free.fr/
Also on:    postgresql.org/message-id/412E5230.5050603@free.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oliverp21@free.fr
  Subject: Re: Pb with insert statement
  In-Reply-To: <412E5230.5050603@free.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox