Search Postgresql Archives

how to implement unusual constraint

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

 



Say I have a table, say my_table,  that is self-referencing. It looks
like this :


id integer pk,
orig_id integer references my_table(id),
.
.
.

Now this set of rows would be legal

id/orig_id
1 /1
2/1
3/1
4/4
5/4

but this not:

id/orig_id
1 /1
2/1
3/1
4/1
5/4

in other words: the row pointed to by orig_id cannot reference any row
other than itself.
How might I implement this as a constraint?
thanks,

Daniel



[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