Re: A few questions about ltree - Mailing list pgsql-general

From Teodor Sigaev
Subject Re: A few questions about ltree
Date
Msg-id 44490764.6070900@sigaev.ru
Whole thread Raw
In response to Re: A few questions about ltree  (Alban Hertroys <alban@magproductions.nl>)
List pgsql-general
> 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: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/

pgsql-general by date:

Previous
From: "Brandon Metcalf"
Date:
Subject: IDT timezone
Next
From: Stephan Szabo
Date:
Subject: Re: A few questions about ltree