Re: Patch: Improve Boolean Predicate JSON Path Docs

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: Patch: Improve Boolean Predicate JSON Path Docs
Дата
Msg-id 8B5A33DB-793C-4FF3-A6F0-89D92AAD312A@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>)
Список pgsql-hackers
On Jan 20, 2024, at 12:34, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Surely we're not helping anybody by leaving that behavior in place.
> Making it do something useful, throwing an error, or returning NULL
> all seem superior to this.  I observe that @@ returns NULL for the
> path type it doesn't like, so maybe that's what to do here.

I agree it would be far better for the behavior to be consistent, but frankly would like to see them raise an error.
Ideallythe hit would suggest the proper alternative operator or function to use, and maybe link to the docs that
describethe difference between SQL-standard JSONPath and "predicate check expressions”, and how they have separate
operatorsand functions. 

I think of them as practically different data types (and wish they were, TBH). It makes sense that passing a JSON
containmentexpression[1] would raise an error; so should passing the wrong flavor of JSONPath. 

> BTW, jsonb_path_query_array and jsonb_path_query_first seem to
> take both types of path, like jsonb_path_query, so ISTM they need
> docs changes too.

Happy to update the patch, either to add those docs or, if we change the behavior to return a NULL or raise an error,
thenwith that information, instead. 

Best,

David

  [1]: https://www.postgresql.org/docs/current/datatype-json.html#JSON-CONTAINMENT




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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: psql: show current user in prompt
Следующее
От: Tom Lane
Дата:
Сообщение: Re: introduce dynamic shared memory registry