Patch: Improve Boolean Predicate JSON Path Docs

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Patch: Improve Boolean Predicate JSON Path Docs
Дата
Msg-id 7262A188-59CA-4A8A-AAD7-83D4FF0B9758@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>)
Список pgsql-hackers
Hackers,

Following up from a suggestion from Tom Lane[1] to improve the documentation of boolean predicate JSON path
expressions,please find enclosed a draft patch to do so. It does three things: 

1. Converts all of the example path queries to use jsonb_path_query() and show the results, to make it clearer what the
behaviorsare. 

2. Replaces the list of deviations from the standards with a new subsection, with each deviation in its own
sub-subsection.The regex section is unchanged, but I’ve greatly expanded the boolean expression JSON path section with
examplescomparing standard filter expressions and nonstandard boolean predicates. I’ve also added an exhortation not
useboolean expressions with @? or standard path expressions with @@. 

3. While converting the modes section to use jsonb_path_query() and show the results, I also added an example of strict
modereturning an error. 

Follow-ups I’d like to make:

1. Expand the modes section to show how the types of results can vary depending on the mode, thanks to the flattening.
Examples:

david=# select jsonb_path_query('{"a":[1,2,3,4,5]}', '$.a ?(@[*] > 2)');
jsonb_path_query
------------------
3
4
5
(3 rows)

david=# select jsonb_path_query('{"a":[1,2,3,4,5]}',  'strict $.a ?(@[*] > 2)');
jsonb_path_query
------------------
[1, 2, 3, 4, 5]

2. Improve the descriptions and examples for @?/jsonb_path_exists() and @@/jsonb_path_match().

Best,

David

[1] https://www.postgresql.org/message-id/1229727.1680535592%40sss.pgh.pa.us


Вложения

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

Предыдущее
От: David Steele
Дата:
Сообщение: Re: Requiring recovery.signal or standby.signal when recovering with a backup_label
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Patch: Improve Boolean Predicate JSON Path Docs