Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 881cd9e

Browse files
committed
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
1 parent 249d743 commit 881cd9e

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

src/backend/parser/parse_expr.c

-5
Original file line numberDiff line numberDiff line change
@@ -3257,12 +3257,7 @@ transformJsonValueExpr(ParseState *pstate, const char *constructName,
32573257
parser_errposition(pstate, ve->format->location));
32583258

32593259
if (exprtype == JSONOID || exprtype == JSONBOID)
3260-
{
32613260
format = JS_FORMAT_DEFAULT; /* do not format json[b] types */
3262-
ereport(WARNING,
3263-
errmsg("FORMAT JSON has no effect for json and jsonb types"),
3264-
parser_errposition(pstate, ve->format->location));
3265-
}
32663261
else
32673262
format = ve->format->format_type;
32683263
}

src/test/regress/expected/sqljson.out

-6
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,6 @@ ERROR: JSON ENCODING clause is only allowed for bytea input type
374374
LINE 1: SELECT JSON_OBJECT('foo': NULL::int FORMAT JSON ENCODING UTF...
375375
^
376376
SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON);
377-
WARNING: FORMAT JSON has no effect for json and jsonb types
378-
LINE 1: SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON);
379-
^
380377
json_object
381378
----------------
382379
{"foo" : null}
@@ -387,9 +384,6 @@ ERROR: JSON ENCODING clause is only allowed for bytea input type
387384
LINE 1: SELECT JSON_OBJECT('foo': NULL::json FORMAT JSON ENCODING UT...
388385
^
389386
SELECT JSON_OBJECT('foo': NULL::jsonb FORMAT JSON);
390-
WARNING: FORMAT JSON has no effect for json and jsonb types
391-
LINE 1: SELECT JSON_OBJECT('foo': NULL::jsonb FORMAT JSON);
392-
^
393387
json_object
394388
---------------
395389
{"foo": null}

0 commit comments

Comments
 (0)