Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
Дата
Msg-id 880194083.579916.1680598906819@office.mailbox.org
обсуждение исходный текст
Ответ на Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account  (jian he <jian.universality@gmail.com>)
Ответы Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
> On 04/04/2023 03:50 CEST jian he <jian.universality@gmail.com> wrote:
>
> > "Returns true if any JSON value at the given path matches the predicate.
> >  Returns NULL when not a path predicate or comparing different types."
>
> in first sentence, should we add something "otherwise return false." ?

I omitted the "otherwise false" part because of the corner cases which I did
not want to gloss over.  But the corner cases also apply if the predicate
matches some value, depending on strict mode, as I noticed later and wrote in
my previous message.

Suggestion:

    "Returns true if any JSON value at the given path matches the predicate,
     otherwise returns false.  Unless the predicate compares different types
     (depending on strict mode) or the jsonpath is not a path predicate, in
     which case NULL is returned."

I guess it's best to document the corner cases in detail in the notes section
as Adrian pointed out and have the function doc refer to the notes.

> also, should it be "Return true"? (since only one value returned)?

The third-person singular "returns" is correct in this case.  It does not refer
to the number of returned values.

--
Erik



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

Предыдущее
От: Erik Wienhold
Дата:
Сообщение: Re: DEFINER / INVOKER conundrum
Следующее
От: Dominique Devienne
Дата:
Сообщение: Re: DEFINER / INVOKER conundrum