inheritance/foreignkeys - Mailing list pgsql-general

From jef peeraer
Subject inheritance/foreignkeys
Date
Msg-id 4396B8E8.4060107@pandora.be
Whole thread Raw
List pgsql-general
i have a project where inheritance could be used, i think. but after
going through the lists and having read the FM's, i realize that i beter
use another approach. i just describe the project in short :

users have to fill in forms, that mainly exists of different lists
and/or textboxes. Users are part of teams ( kind of groups)  , and every
team is allowed to have its extra listitems, which should be added to
the global lists ( as i said, this could be solved with inheritance...).
    The teams should be able to insert their extra listitems in a table,
without touching the global listitems. This could be solved by using a
different schema for each team, and each team has its own listitems
table. The selected items will end up in a registration table, also
specific per team.

public.listitems
   id serial
   id_up int
   priority int2
   label text


teamX.listitems
   like public.listitems

teamY.listitems
   like public.listitems

teamX.registration
   reg_id serial
   time_registration date
   list_id    foreign ....

i can create the composed listitems for a team by using a select and
UNION of the two tables. I am a little bit stuck how i should implement
the foreign key in the registration table as the list_id can reference a
listitem of the public schema as well of the teams schema.

1-maybe i should use triggers, and all listiteems inserts by the teams
should be inserted in the public.listitems as well
2- create a new table that consists of union of both tables
3- other solution

jef peeraer

pgsql-general by date:

Previous
From: Sim Zacks
Date:
Subject: pg_autovacuum
Next
From: Adam Witney
Date:
Subject: Error on PostgreSQL mailing list web pages?