Re: Inheritance and column references problem - Mailing list pgsql-general

From Vidyasagara Guntaka
Subject Re: Inheritance and column references problem
Date
Msg-id 5F90B589E007484AA3C305D4AE984C750ED3B9@mail2.confluencenetworks.com
Whole thread Raw
In response to Inheritance and column references problem  (Scott Goodwin <scott@scottg.net>)
List pgsql-general
Will the current behavior change in the upcoming releases ?  Currently I'm
investigating if we can replace a proprietary database with postgresql.  For
our object model inheriting the primary key and foreign key constraints is
essential.

Also, Can you please point to some resources which describe ways to circumvent
the problem.

Thank you very much in advance.

Sagar.

-----Original Message-----
From: Stephan Szabo [mailto:sszabo@megazone.bigpanda.com]
Sent: Tuesday, February 24, 2004 4:38 PM
To: Scott Goodwin
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Inheritance and column references problem


> Is this a bug, or a feature? It seems I can't make a column reference
> work directly with the table that gets inherited by the others. Neither
> can I make a column reference work with a table that *inherits* the
> toinherit table. If I can't get this to work, I'll have to revert back
> to not using inheritance at all.

All of primary key, unique and foreign key constraints don't currently
meaningfully inherit. For the foreign key case the reference goes only
to the directly named table so rows in the subtables are not considered
for purposes of validating the constraint.  In addition, in a structure
where you have a primary key inherited, the child tables do not get the
constraint for uniqueness although that can be added by explicitly putting
the constraint on, however that won't prevent duplicates between the child
and parent nor between children. There are some marginally complicated
workarounds using a separate table that have been discussed on the lists
before and should be available in the archives.

I think I should build a macro for the above. ;)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

pgsql-general by date:

Previous
From:
Date:
Subject: Re: field must appear in the GROUP BY clause or be used
Next
From: "scott.marlowe"
Date:
Subject: Re: PostgreSQL in Cluster