Ruleutils_17 Add more SQL/JSON constructor functions

Relevant PG commit:
03734a7fed7d924679770adb78a7db8a37d14188
03734a7fed
m3hm3t/pg17_isolation_test_cmd_from
naisila 2024-07-25 14:01:33 +02:00
parent 728fe5c921
commit 978fdc2166
No known key found for this signature in database
GPG Key ID: A824BA9862D73E6D
1 changed files with 15 additions and 1 deletions

View File

@ -7622,6 +7622,15 @@ get_json_constructor(JsonConstructorExpr *ctor, deparse_context *context,
case JSCTOR_JSON_ARRAY:
funcname = "JSON_ARRAY";
break;
case JSCTOR_JSON_PARSE:
funcname = "JSON";
break;
case JSCTOR_JSON_SCALAR:
funcname = "JSON_SCALAR";
break;
case JSCTOR_JSON_SERIALIZE:
funcname = "JSON_SERIALIZE";
break;
default:
elog(ERROR, "invalid JsonConstructorType %d", ctor->type);
}
@ -7669,7 +7678,12 @@ get_json_constructor_options(JsonConstructorExpr *ctor, StringInfo buf)
if (ctor->unique)
appendStringInfoString(buf, " WITH UNIQUE KEYS");
get_json_returning(ctor->returning, buf, true);
/*
* Append RETURNING clause if needed; JSON() and JSON_SCALAR() don't
* support one.
*/
if (ctor->type != JSCTOR_JSON_PARSE && ctor->type != JSCTOR_JSON_SCALAR)
get_json_returning(ctor->returning, buf, true);
}
/*