Re: Referential integrity using constant in foreign key - Mailing list pgsql-general

From Andrus
Subject Re: Referential integrity using constant in foreign key
Date
Msg-id d2c068$9oc$1@news.hub.org
Whole thread Raw
In response to Referential integrity using constant in foreign key  ("Andrus Moor" <eetasoft@online.ee>)
List 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.



pgsql-general by date:

Previous
From: "Elim Qiu"
Date:
Subject: from mysql to pgsql
Next
From: Edmund Bacon
Date:
Subject: Re: Debugging deadlocks