Re: Referential integrity using constant in foreign key

From: "Andrus" <noeetasoftspam(at)online(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Referential integrity using constant in foreign key
Date: 2005-03-29 16:33:30
Message-ID: d2c068$9oc$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Florian,

> Or you create a classifier_1 and a classifier_2 table, each containing
> only the column "code". Then you can drop the "category1" and "category2"
> fields from "info", and just point the foreign keys to the correct table.

Thank you.
I will probably go by this way.

> You can, optionally, create a view "classifer", that combiney both
> classifier_? tables - e.g, do
>
> create view classifier as
> select '1'::char(1) as category, code from classifier_1
> union
> select '2'::char(1) as category, code from classifier_2 ;

I want to insert, update and delete using classifier view for max
compatibility with existing shema from other DBMC which contains real
classifier table.

Which is the best way to make view changeable ?
Is it possible to implement this using rules ?
Is Postgres rule system best and reasonable solution for this?

Andrus.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guy Rouillier 2005-03-29 16:35:02 Re: after gentoo emerge plpython failure
Previous Message Mark Greenbank 2005-03-29 16:32:58 Solaris 10 svc setup