1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-01 14:21:49 +03:00

Remove dubious warning message from SQL/JSON functions

There was a warning that FORMAT JSON has no effect on json/jsonb
types, which is true, but it's not clear why we should issue a warning
about it.  The SQL standard does not say anything about this, which
should generally govern the behavior here.  So remove it.

Discussion: https://www.postgresql.org/message-id/flat/dfec2cae-d17e-c508-6d16-c2dba82db486%40eisentraut.org
This commit is contained in:
Peter Eisentraut 2023-08-18 07:41:14 +02:00
parent 6337e994e8
commit dcfc49c1b6
2 changed files with 0 additions and 11 deletions

View File

@ -3240,12 +3240,7 @@ transformJsonValueExpr(ParseState *pstate, const char *constructName,
parser_errposition(pstate, ve->format->location)); parser_errposition(pstate, ve->format->location));
if (exprtype == JSONOID || exprtype == JSONBOID) if (exprtype == JSONOID || exprtype == JSONBOID)
{
format = JS_FORMAT_DEFAULT; /* do not format json[b] types */ format = JS_FORMAT_DEFAULT; /* do not format json[b] types */
ereport(WARNING,
errmsg("FORMAT JSON has no effect for json and jsonb types"),
parser_errposition(pstate, ve->format->location));
}
else else
format = ve->format->format_type; format = ve->format->format_type;
} }

View File

@ -84,9 +84,6 @@ ERROR: JSON ENCODING clause is only allowed for bytea input type
LINE 1: SELECT JSON_OBJECT('foo': NULL::int FORMAT JSON ENCODING UTF... LINE 1: SELECT JSON_OBJECT('foo': NULL::int FORMAT JSON ENCODING UTF...
^ ^
SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON); SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON);
WARNING: FORMAT JSON has no effect for json and jsonb types
LINE 1: SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON);
^
json_object json_object
---------------- ----------------
{"foo" : null} {"foo" : null}
@ -97,9 +94,6 @@ ERROR: JSON ENCODING clause is only allowed for bytea input type
LINE 1: SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON ENCODING UT... LINE 1: SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON ENCODING UT...
^ ^
SELECT JSON_OBJECT('foo': NULL::jsonb FORMAT JSON); SELECT JSON_OBJECT('foo': NULL::jsonb FORMAT JSON);
WARNING: FORMAT JSON has no effect for json and jsonb types
LINE 1: SELECT JSON_OBJECT('foo': NULL::jsonb FORMAT JSON);
^
json_object json_object
--------------- ---------------
{"foo": null} {"foo": null}