Re: A few questions about ltree
От | Teodor Sigaev |
---|---|
Тема | Re: A few questions about ltree |
Дата | |
Msg-id | 4448E711.2060600@sigaev.ru обсуждение исходный текст |
Ответ на | A few questions about ltree (Alban Hertroys <alban@magproductions.nl>) |
Ответы |
Re: A few questions about ltree
|
Список | pgsql-general |
> That's the "classical" way, which is also used in our current > implementation with integers instead of ltrees, but it's not very easy > to query efficiently (at least ordering seems to remain a problem). That (with integer ids) is classic way to support graph structure, ltree was develop specially for trees. > Maybe something along the lines of the following is possible?: Exact, it's for what ltree was developed. > Do ltrees know that a node with path 'A.B.D' references it's parent > 'A.B'? I mean, can ltree 'A.B' equal ltree 'A.B.D' somehow while the > strings are unequal? > Can it be made to know that somehow (functional foreign keys or > something - maybe using "ltree_isparent(ltree, ltree)")? Yes, use ltree_isparent or contrib_regression=# select 'a.b.c' <@ 'a.b'::ltree; ?column? ---------- t (1 row) contrib_regression=# select 'a.b.c.d' <@ 'a.b'::ltree; ?column? ---------- t (1 row) contrib_regression=# select 'a.b.c.d'::ltree ~ 'a.b.*{1}'; ?column? ---------- f (1 row) contrib_regression=# select 'a.b.c'::ltree ~ 'a.b.*{1}'; ?column? ---------- t (1 row) > > I can determine things like this with a few experiments, but I want to > know "the right way" to work with ltrees and referential integrity. How > do people use this? That's right way. -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/
В списке pgsql-general по дате отправления: