aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-08-18 07:41:14 +0200
committerPeter Eisentraut <peter@eisentraut.org>2023-08-18 07:43:52 +0200
commitdcfc49c1b652dfe41273579aeaf6b454c51f037b (patch)
tree13bd73e9485082190da829973481d1af5bed7d88
parent6337e994e89797d60b68ac6786c6a322ac00a382 (diff)
downloadpostgresql-dcfc49c1b652dfe41273579aeaf6b454c51f037b.tar.gz
postgresql-dcfc49c1b652dfe41273579aeaf6b454c51f037b.zip
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
-rw-r--r--src/backend/parser/parse_expr.c5
-rw-r--r--src/test/regress/expected/sqljson.out6
2 files changed, 0 insertions, 11 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index c08c06373a9..de5732622fe 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -3240,12 +3240,7 @@ transformJsonValueExpr(ParseState *pstate, const char *constructName,
parser_errposition(pstate, ve->format->location));
if (exprtype == JSONOID || exprtype == JSONBOID)
- {
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
format = ve->format->format_type;
}
diff --git a/src/test/regress/expected/sqljson.out b/src/test/regress/expected/sqljson.out
index 11ebf4403b0..fa2abdb4a7f 100644
--- a/src/test/regress/expected/sqljson.out
+++ b/src/test/regress/expected/sqljson.out
@@ -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...
^
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
----------------
{"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...
^
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
---------------
{"foo": null}