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.