Re: [GENERAL] how to implement unusual constraint

2007-06-26 Thread Andrew Sullivan
On Sun, Jun 24, 2007 at 06:45:00PM -, danmcb wrote: > into two tables, one for the originals, one for the translations (the > objects are actually phrases in many languages). But I'd rather avoid > that because in all other ways, the objects have the same properties, > reference the same object

Re: [GENERAL] how to implement unusual constraint

2007-06-24 Thread danmcb
"So frequently the best advice for someone who's thinking of doing something like this is "redesign your schema so you don't need to". " I've thought about that. The obvious way to do it would be to split into two tables, one for the originals, one for the translations (the objects are actually ph

Re: [GENERAL] how to implement unusual constraint

2007-06-24 Thread Tom Lane
Ragnar <[EMAIL PROTECTED]> writes: > On sun, 2007-06-24 at 09:54 +, danmcb wrote: >> Say I have a table, say my_table, that is self-referencing. ... >> 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? >

Re: [GENERAL] how to implement unusual constraint

2007-06-24 Thread Ragnar
On sun, 2007-06-24 at 09:54 +, danmcb wrote: > 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