1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Simplify productions for FORMAT JSON [ ENCODING name ]

This removes the production json_encoding_clause_opt, instead merging
it into json_format_clause.  Also remove the auxiliary
makeJsonEncoding() function.

Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/202312071841.u2gueb5dsrbk%40alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2023-12-11 11:55:34 +01:00
parent c7a3e6b46d
commit d3fe6e90ba
3 changed files with 34 additions and 39 deletions

View File

@ -857,27 +857,6 @@ makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr,
return jve;
}
/*
* makeJsonEncoding -
* converts JSON encoding name to enum JsonEncoding
*/
JsonEncoding
makeJsonEncoding(char *name)
{
if (!pg_strcasecmp(name, "utf8"))
return JS_ENC_UTF8;
if (!pg_strcasecmp(name, "utf16"))
return JS_ENC_UTF16;
if (!pg_strcasecmp(name, "utf32"))
return JS_ENC_UTF32;
ereport(ERROR,
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized JSON encoding: %s", name));
return JS_ENC_DEFAULT;
}
/*
* makeJsonKeyValue -
* creates a JsonKeyValue node