Sample Header Ad - 728x90

Non-commutative exclusion constraint?

1 vote
0 answers
250 views
If I create the following table.. CREATE TABLE foo ( x int ); I can EXCLUDE the following, WHERE x = (generic unique constraint) WHERE x = (type of unique constraint reduce values that aren't specific to null) WHERE x ANY OTHER value (EXCLUDE WITH ) But, is there a clever way to permit INSERT INTO foo (x) VALUES (0); INSERT INTO foo (x) VALUES (1); but, not INSERT INTO foo (x) VALUES (1); INSERT INTO foo (x) VALUES (0); Or is there a module would otherwise let me do it as a function of the index and not with a trigger. In summary, you can insert multiple values of 1 (or 0), **but** upon the first insertion of 1 the file is closed and no further insertion of 0 can be made, but 1 can continue to be inserted.
Asked by Evan Carroll (65502 rep)
Oct 1, 2017, 04:51 AM
Last activity: Jun 19, 2018, 12:51 AM