Search Postgresql Archives

CREATE DOMAIN with REFERENCES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all.

I have a number of tables that are actually dictionaries.
This means that, in order to keep the reference integrity, in a number of
other tables I have FK definitions like these ones:

CREATE TABLE dict1 ( d1 TEXT PRIMARY KEY, ... );

CREATE TABLE user1 ( d1 TEXT NOT NULL REFERENCES dict1 DEFAULT 'value1' );

I am trying to simplify this thing by defining DOMAINs with the proper "NOT
NULL" and "DEFAULT" predicates.
But it seems there's no way to CREATE a DOMAIN with a "REFERENCES ..." 
predicate, possibly in the optional CHECK.
At the moment I have solved the issue with a function that CHECKs for the 
VALUE being already in the proper dictionary.
But this way I loose the explicit reference integrity.

Is there any better advise for this need?

Thanks.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux