pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
inheritance and foreign key
2+ messages / 2 participants
[nested] [flat]

* inheritance and foreign key
@ 2002-02-19 15:17  Kancha . <kancha2np@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kancha . @ 2002-02-19 15:17 UTC (permalink / raw)
  To: pgsql-general@postgresql.org; +Cc: pgsql-sql

I'm a postgresql newbie.

It seems that primary key is not inherited by tables.
My situtation is as follows

I've a parent table and child tables with inherit from
parent table. Parent table consists of pid (defualt
value of pid is from sequence) that is primary key.
Now all child tables inherits this attribute pid.

I've another table from where i reference this pid as:

pid integer references parent (pid)

the table creation is successful, but when i try to
insert data into this table that refereces parent
table i get error - something like the referenced
column doesn't exist.

I'm using version 7.1 in RH Linux 7.2 box.

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] inheritance and foreign key
@ 2002-02-19 16:53  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Kancha . <kancha2np@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2002-02-19 16:53 UTC (permalink / raw)
  To: Kancha . <kancha2np@yahoo.com>; +Cc: pgsql-general@postgresql.org; pgsql-sql


On Tue, 19 Feb 2002, Kancha . wrote:

> I'm a postgresql newbie.
>
> It seems that primary key is not inherited by tables.
> My situtation is as follows
>
> I've a parent table and child tables with inherit from
> parent table. Parent table consists of pid (defualt
> value of pid is from sequence) that is primary key.
> Now all child tables inherits this attribute pid.
>
> I've another table from where i reference this pid as:
>
> pid integer references parent (pid)
>
> the table creation is successful, but when i try to
> insert data into this table that refereces parent
> table i get error - something like the referenced
> column doesn't exist.

Foreign key references currently go only to the table
that explicitly named, not to any children tables so
it won't see values of pid in the children.  There's
a few workaround solutions for cases like yours that have
been sent to the mailing lists before, you may be able
to find them on the archives.





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-02-19 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-19 15:17 inheritance and foreign key Kancha . <kancha2np@yahoo.com>
2002-02-19 16:53 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>

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