Search Postgresql Archives

foreign key to "some rows" of a second table

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

 



Hi All,

So, I have a table that looks like this:

CREATE TABLE config (
    region    varchar(10),
    name    varchar(10),
    value    varchar(40)
);

Another looks like this:

CREATE TABLE tag (
    host    varchar(10),
    type    varchar(10),
    value    varchar(10)
);

What's the best way to set up a constraint on the 'config' table such that the 'region' column can only contain values that exist in the 'tag' table's value column where the 'type' is 'region'?

cheers,

Chris

[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