pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gianvito Pio <pio.gianvito@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Table inheritance problem
Date: Sat, 18 Jul 2009 19:09:31 +0200
Message-ID: <F5926D0F35F247FBAFC269BE450D5E7F@PCGianvito> (raw)

Hello,
I have 3 tables: persons, operators and persons_position.

This is a semplified examples of their structures:

CREATE TABLE persons
(id varchar NOT NULL,
CONSTRAINT "PK_Persons" PRIMARY KEY(id));


CREATE TABLE operators
(id varchar NOT NULL,
CONSTRAINT "PK_Operators" PRIMARY KEY(id))
INHERITS(persons);

CREATE TABLE persons_position
(id bigserial NOT NULL,
person varchar NOT NULL);

and then there is a FOREIGN KEY CONSTRAINT from persons_position.person TO persons.id.

If I insert a tuple in operators...it results also in persons, but when I insert a tuple in persons_position, it says me I have violated the foreing key constraints. So it appears that the tuple really ISN'T in the persons table and the foreing key check fails.

How could I solve it, keeping the inheritance there?
Thanks

view thread (2+ messages)  latest in thread

Message-ID: <F5926D0F35F247FBAFC269BE450D5E7F@PCGianvito>
Permalink:  ../F5926D0F35F247FBAFC269BE450D5E7F@PCGianvito/
Also on:    postgresql.org/message-id/F5926D0F35F247FBAFC269BE450D5E7F@PCGianvito

 · 

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: pio.gianvito@gmail.com
  Subject: Re: Table inheritance problem
  In-Reply-To: <F5926D0F35F247FBAFC269BE450D5E7F@PCGianvito>

* 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