Is it really necessary to insert an 'empty' record for the root node? The 'a' record from my experiments seems to be quite suited for the task, unless I'm missing something.

The root should be and it will be unremovable, because of foreign keys. But it can be, of course, not empty.



alter table foo add foreign key subpath( path, 0, -1) references foo( path )
    deferrable initially deferred,;

IIRC, you can define equality for custom types depending on the direction of the comparison. Isn't something like that possible for foreign keys? You'd be able to check whether the left hand of the comparison is a parent of the right hand and vice versa. That'd be just what we need...

Sorry, I don't know. I don't think that pgsql allows to use particular operator for foreign key...



I must be missing something, you've obviously put a lot of thought in ltree. Maybe it'll be possible with a future version of PostgreSQL :)
Make a patch to allow function in FK :)

--
Teodor Sigaev                                   E-mail: [EMAIL PROTECTED]
                                                   WWW: http://www.sigaev.ru/

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to