[postgis-users] Adding constraint

Piotr Pachół piotrpachol at gmail.com
Wed Apr 25 13:34:20 PDT 2012


Hello,
Is it possible to add constraint to second attribute of table only in 
the situation when first attribute of table equals specified value ?
I give an example:

CREATE TABLE test (
     attrib_1 text,
     attrib_2 text
);
INSERT INTO test VALUES ('AAA', 'QQQ');
INSERT INTO test VALUES ('BBB', 'PPP');


So is it possible to add  constraint (for instance NOT NULL) to attrib_2 
column if attrib_1 = 'AAA'

Regards,
Piotr




More information about the postgis-users mailing list