git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 249d743)
Remove dubious warning message from SQL/JSON functions
2023年8月18日 05:41:14 +0000 (07:41 +0200)
2023年8月18日 05:41:14 +0000 (07:41 +0200)
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


diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index fed8e4d08972ff984b3f14530df23fc91d231c5f..aa726651a6ec9c19f821c879778f165f134fe186 100644 (file)
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -3257,12 +3257,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 e654c9480475f5813f0dbcc3c2fdf4d5202c7cc3..5e7da96be5e6d96fa15d2830a4d37bd0bd06bbc4 100644 (file)
--- a/src/test/regress/expected/sqljson.out
+++ b/src/test/regress/expected/sqljson.out
@@ -374,9 +374,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}
@@ -387,9 +384,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}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /