Re: Patch: Improve Boolean Predicate JSON Path Docs

Поиск
Список
Период
Сортировка
Искать
От
David E. Wheeler
Тема
Re: Patch: Improve Boolean Predicate JSON Path Docs
Дата
Msg-id
44A91BA1-41BC-46B9-85D3-59B5F645D1A7@justatheory.com
Ответ на
Список
Дерево обсуждения
Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs jian he <jian.universality@gmail.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@mailbox.org>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs shihao zhong <zhong950419@gmail.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: Patch: Improve Boolean Predicate JSON Path Docs Erik Wienhold <ewie@ewie.name>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs Tom Lane <tgl@sss.pgh.pa.us>
Re: Patch: Improve Boolean Predicate JSON Path Docs "David E. Wheeler" <david@justatheory.com>
Re: Patch: Improve Boolean Predicate JSON Path Docs David E. Wheeler <david@justatheory.com>
On Jan 21, 2024, at 14:43, Tom Lane  wrote:

> I don't entirely buy this argument --- if that is the interpretation,
> of what use are predicate check expressions?  It seems to me that we
> have to consider them as being a shorthand notation for filter
> expressions, or else they simply do not make sense as jsonpath.

I believe it becomes pretty apparent when using jsonb_path_query(). The filter expression returns a set (using the previous \gset example):

david=# select jsonb_path_query(:'json', '$.track.segments[*].HR ? (@ > 10)');
 jsonb_path_query 
------------------
 73
 135
(2 rows)

The predicate check returns a boolean:

david=# select jsonb_path_query(:'json', '$.track.segments[*].HR > 10');
 jsonb_path_query 
------------------
 true
(1 row)

This is the only way the different behaviors make sense to me. @? expects a set, not a boolean, sees there is an item in the set, so returns true:

david=# select jsonb_path_query(:'json', '$.track.segments[*].HR > 1000');
 jsonb_path_query 
------------------
 false
(1 row)

david=# select :'json'::jsonb @? '$.track.segments[*].HR > 1000';
 ?column? 
----------
 t
(1 row)

Best,

David



В списке pgsql-hackers по дате отправления
От: Konstantin Knizhnik
Дата:
Сообщение: Re: index prefetching
От: Konstantin Knizhnik
Дата:
Сообщение: Re: index prefetching
FAQ