Re: remaining sql/json patches

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Andres Freund <andres(at)anarazel(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: remaining sql/json patches
Date: 2024-03-14 10:12:06
Message-ID: CACJufxGnJ_0EW0AXXk22TzCJbL=nDyN-YwDAEJLRdQGMEZuU8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

one more question...
SELECT JSON_value(NULL::int, '$' returning int);
ERROR: cannot use non-string types with implicit FORMAT JSON clause
LINE 1: SELECT JSON_value(NULL::int, '$' returning int);
^

SELECT JSON_query(NULL::int, '$' returning int);
ERROR: cannot use non-string types with implicit FORMAT JSON clause
LINE 1: SELECT JSON_query(NULL::int, '$' returning int);
^

SELECT * FROM JSON_TABLE(NULL::int, '$' COLUMNS (foo text));
ERROR: cannot use non-string types with implicit FORMAT JSON clause
LINE 1: SELECT * FROM JSON_TABLE(NULL::int, '$' COLUMNS (foo text));
^

SELECT JSON_value(NULL::text, '$' returning int);
ERROR: JSON_VALUE() is not yet implemented for the json type
LINE 1: SELECT JSON_value(NULL::text, '$' returning int);
^
HINT: Try casting the argument to jsonb

SELECT JSON_query(NULL::text, '$' returning int);
ERROR: JSON_QUERY() is not yet implemented for the json type
LINE 1: SELECT JSON_query(NULL::text, '$' returning int);
^
HINT: Try casting the argument to jsonb

in all these cases, the error message seems strange.

we already mentioned:
<note>
<para>
SQL/JSON query functions currently only accept values of the
<type>jsonb</type> type, because the SQL/JSON path language only
supports those, so it might be necessary to cast the
<replaceable>context_item</replaceable> argument of these functions to
<type>jsonb</type>.
</para>
</note>

we can simply say, only accept the first argument to be jsonb data type.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-03-14 10:13:41 Re: Make attstattarget nullable
Previous Message Andrei Lepikhov 2024-03-14 10:11:15 Re: POC, WIP: OR-clause support for indexes