Re: Ltree pattern matching

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Ltree pattern matching
Дата
Msg-id 1696142.1636731424@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Ltree pattern matching  (PG Doc comments form <noreply@postgresql.org>)
Ответы RE: Ltree pattern matching
Список pgsql-docs
PG Doc comments form <noreply@postgresql.org> writes:
> In v12 ltree doc (I've not checked other versions)
> "The behavior of % is a bit complicated. It tries to match words rather than
> the entire label. For example foo_bar% matches foo_bar_baz but not
> foo_barbaz. If combined with *, prefix matching applies to each word
> separately, for example foo_bar%* matches foo1_bar2_baz but not
> foo1_br2_baz.

> I believe foo1 is in error (if I understood the operators), it should be
> foo.

A quick test shows that the examples are correct as stated:

contrib_regression=# select 'foo_bar_baz'::ltree ~ 'foo_bar%'::lquery;
 ?column? 
----------
 t
(1 row)

contrib_regression=# select 'foo_barbaz'::ltree ~ 'foo_bar%'::lquery;
 ?column? 
----------
 f
(1 row)

contrib_regression=# select 'foo1_bar2_baz'::ltree ~ 'foo_bar%*'::lquery;
 ?column? 
----------
 t
(1 row)

contrib_regression=# select 'foo1_br2_baz'::ltree ~ 'foo_bar%*'::lquery;
 ?column? 
----------
 f
(1 row)

I'd be the first to admit that this paragraph doesn't seem to measure up
to our usual standards of clarity, but I'm not sure about what would be
better wording.

            regards, tom lane



В списке pgsql-docs по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Example of json_array_elements
Следующее
От: Terry Gilbert
Дата:
Сообщение: RE: Ltree pattern matching