Re: Problem with REFERENCES on INHERITS

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with REFERENCES on INHERITS
Date: 2015-02-02 05:11:32
Message-ID: 1422853892697-5836347.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

William Gordon Rutherdale wrote
> I have encountered a problem with references when using INHERITS (on
> Postgres 9.1/9.2). Could someone please explain why this occurs.
>
> My problem: could someone please explain the semantics and why this
> behaviour makes sense -- or is it a design error or bug?
>
> To sum up the issue:
> - I insert into the derived table (chimp) and get id 1
> - I insert into the base table (primate) and get id 2
> - I have a foreign key constraint in banana_stash to the
> base table p.k. primate(id)
> - inserting to banana_stash with reference to id 2 is okay
> - inserting to banana_stash with reference 1 gives error
> - both ids 1 and 2 in table primate are supposed to be valid
>
> So why does the one case give an error when the other does not?
>
> Also, is there a way to solve this problem (i.e. remove the error)
> without simply chopping out the REFERENCES clause from banana_stash?

I didn't read your post in depth but I suspect you have not read and
understood the limitations documented in section 5.8.1

http://www.postgresql.org/docs/9.1/interactive/ddl-inherit.html

David J.

--
View this message in context: http://postgresql.nabble.com/Problem-with-REFERENCES-on-INHERITS-tp5836326p5836347.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Saffron 2015-02-02 06:16:40 How do I bump a row to the front of sort efficiently
Previous Message William Gordon Rutherdale 2015-02-02 02:55:11 Problem with REFERENCES on INHERITS