pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alex <alexander.ochkalyuk@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6054: Insert to table, which has fkey to table, which is parenttable for another table - error
Date: Tue, 7 Jun 2011 12:44:26 GMT
Message-ID: <201106071244.p57CiQfg068192@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      6054
Logged by:          Alex
Email address:      alexander.ochkalyuk@gmail.com
PostgreSQL version: 8.4.8
Operating system:   CentOS
Description:        Insert to table, which has fkey to table,which is
parenttable for another table - error
Details: 

CREATE TABLE t1 
(t1_id numeric(10,0) NOT NULL PRIMARY KEY);

CREATE TABLE t2
(t2_id numeric(10,0) NOT NULL PRIMARY KEY) INHERITS (t1);


CREATE TABLE t3
(t3_id numeric(10,0) NOT NULL PRIMARY KEY ,
t1_id numeric(10,0) NOT NULL REFERENCES t1(t1_id)) ;



INSERT INTO t2 VALUES(1,2);
INSERT INTO t3 VALUES(3,1);


ERROR:  insert or update on table "t3" violates ---
foreign key constraint "t3_t1_id_fkey"
     DETAIL:  Key (t1_id)=(1) is not present in table "t1".


BUT!!!! 
SELECT t1_id FROM t1 WHERE t1_id = 1;
-->1



view thread (2+ messages)  latest in thread

Message-ID: <201106071244.p57CiQfg068192@wwwmaster.postgresql.org>
Permalink:  ../201106071244.p57CiQfg068192@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201106071244.p57CiQfg068192@wwwmaster.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alexander.ochkalyuk@gmail.com
  Subject: Re: BUG #6054: Insert to table, which has fkey to table, which is parenttable for another table - error
  In-Reply-To: <201106071244.p57CiQfg068192@wwwmaster.postgresql.org>
  References: <201106071244.p57CiQfg068192@wwwmaster.postgresql.org>

* 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