Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions
Дата
Msg-id CAKFQuwYiRGL=UoSyh5wxSF5pXWY2m6crtpOUH3qryKZX8UGG=g@mail.gmail.com
обсуждение исходный текст
Ответ на minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions  (jian he <jian.universality@gmail.com>)
Ответы Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions
Список pgsql-hackers
On Thu, Jun 20, 2024 at 7:30 PM jian he <jian.universality@gmail.com> wrote:
"predicate check expressions return the single three-valued result of
the predicate: true, false, or unknown."
"unknown" is wrong, because `select 'unknown'::jsonb;` will fail.
here "unknown" should be "null"? see jsonb_path_query doc entry also.


The syntax for json_exists belies this claim (assuming our docs are accurate there).  Its "on error" options are true/false/unknown.  Additionally, the predicate test operator is named "is unknown" not "is null".

The result of the predicate test, which is never produced as a value, only a concept, is indeed "unknown" - which then devolves to false when it is practically applied to determining whether to output the path item being tested.  As it does also when used in a parth expression.

postgres=# select json_value('[null]','$[0] < 1');
 json_value
------------
 f

postgres=# select json_value('[null]','$[0] == null');
 json_value
------------
 t

Not sure how to peek inside the jsonpath system here though...

postgres=# select json_value('[null]','($[0] < 1) == null');
ERROR:  syntax error at or near "==" of jsonpath input
LINE 1: select json_value('[null]','($[0] < 1) == null');

I am curious if that produces true (the unknown is left as null) or false (the unknown becomes false immediately).       

David J.


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: improve predefined roles documentation
Следующее
От: Tom Lane
Дата:
Сообщение: Re: configure error when CFLAGS='-Wall -Werror