pg.ddx.io pgsql-docs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Ltree pattern matching 3+ messages / 3 participants [nested] [flat]
* Ltree pattern matching @ 2021-11-11 15:40 PG Doc comments form <noreply@postgresql.org> 2021-11-12 15:37 ` Re: Ltree pattern matching Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 3+ messages in thread From: PG Doc comments form @ 2021-11-11 15:40 UTC (permalink / raw) To: pgsql-docs@lists.postgresql.org; +Cc: terry.gilbert@sas.com The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/12/ltree.html Description: 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. Regards T ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Ltree pattern matching 2021-11-11 15:40 Ltree pattern matching PG Doc comments form <noreply@postgresql.org> @ 2021-11-12 15:37 ` Tom Lane <tgl@sss.pgh.pa.us> 2021-11-12 16:04 ` RE: Ltree pattern matching Terry Gilbert <Terry.Gilbert@sas.com> 0 siblings, 1 reply; 3+ messages in thread From: Tom Lane @ 2021-11-12 15:37 UTC (permalink / raw) To: terry.gilbert@sas.com; +Cc: pgsql-docs@lists.postgresql.org 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 ^ permalink raw reply [nested|flat] 3+ messages in thread
* RE: Ltree pattern matching 2021-11-11 15:40 Ltree pattern matching PG Doc comments form <noreply@postgresql.org> 2021-11-12 15:37 ` Re: Ltree pattern matching Tom Lane <tgl@sss.pgh.pa.us> @ 2021-11-12 16:04 ` Terry Gilbert <Terry.Gilbert@sas.com> 0 siblings, 0 replies; 3+ messages in thread From: Terry Gilbert @ 2021-11-12 16:04 UTC (permalink / raw) To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org> So, when it says "* prefix matching matches each word separately" it means foo_bar* will match a label with the first word beginning with foo and a second word beginning with bar? Hmmm I'll think about it, maybe I can suggest helpful wording. Thank you for clarifying! Terry -----Original Message----- From: Tom Lane <tgl@sss.pgh.pa.us> Sent: Friday, November 12, 2021 10:37 AM To: Terry Gilbert <terry.gilbert@sas.com> Cc: pgsql-docs@lists.postgresql.org Subject: Re: Ltree pattern matching EXTERNAL 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 ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-11-12 16:04 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-11-11 15:40 Ltree pattern matching PG Doc comments form <noreply@postgresql.org> 2021-11-12 15:37 ` Tom Lane <tgl@sss.pgh.pa.us> 2021-11-12 16:04 ` Terry Gilbert <Terry.Gilbert@sas.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox