Enhances cycle mark values at ruleutils_14.c

Relevant PG commit:
f4adc41c4f92cc91d507b19e397140c35bb9fd71
pull/5209/head
Halil Ozan Akgul 2021-08-16 15:26:55 +03:00 committed by Sait Talha Nisanci
parent 12b3c04fe3
commit 5bb538543d
1 changed files with 15 additions and 4 deletions

View File

@ -2051,10 +2051,21 @@ get_with_clause(Query *query, deparse_context *context)
} }
appendStringInfo(buf, " SET %s", quote_identifier(cte->cycle_clause->cycle_mark_column)); appendStringInfo(buf, " SET %s", quote_identifier(cte->cycle_clause->cycle_mark_column));
appendStringInfoString(buf, " TO ");
get_rule_expr(cte->cycle_clause->cycle_mark_value, context, false); {
appendStringInfoString(buf, " DEFAULT "); Const *cmv = castNode(Const, cte->cycle_clause->cycle_mark_value);
get_rule_expr(cte->cycle_clause->cycle_mark_default, context, false); Const *cmd = castNode(Const, cte->cycle_clause->cycle_mark_default);
if (!(cmv->consttype == BOOLOID && !cmv->constisnull && DatumGetBool(cmv->constvalue) == true &&
cmd->consttype == BOOLOID && !cmd->constisnull && DatumGetBool(cmd->constvalue) == false))
{
appendStringInfoString(buf, " TO ");
get_rule_expr(cte->cycle_clause->cycle_mark_value, context, false);
appendStringInfoString(buf, " DEFAULT ");
get_rule_expr(cte->cycle_clause->cycle_mark_default, context, false);
}
}
appendStringInfo(buf, " USING %s", quote_identifier(cte->cycle_clause->cycle_path_column)); appendStringInfo(buf, " USING %s", quote_identifier(cte->cycle_clause->cycle_path_column));
} }