Adds EXTRACT cases to get_func_sql_syntax in ruleutils_14.c

Relevant PG commit:
a2da77cdb4661826482ebf2ddba1f953bc74afe4
pull/5209/head
Halil Ozan Akgul 2021-08-16 16:28:30 +03:00 committed by Sait Talha Nisanci
parent 131062d6b5
commit 84f0be56c3
1 changed files with 21 additions and 0 deletions

View File

@ -6641,6 +6641,27 @@ get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
appendStringInfoString(buf, "))");
return true;
case F_EXTRACT_TEXT_DATE:
case F_EXTRACT_TEXT_TIME:
case F_EXTRACT_TEXT_TIMETZ:
case F_EXTRACT_TEXT_TIMESTAMP:
case F_EXTRACT_TEXT_TIMESTAMPTZ:
case F_EXTRACT_TEXT_INTERVAL:
/* EXTRACT (x FROM y) */
appendStringInfoString(buf, "EXTRACT(");
{
Const *con = (Const *) linitial(expr->args);
Assert(IsA(con, Const) &&
con->consttype == TEXTOID &&
!con->constisnull);
appendStringInfoString(buf, TextDatumGetCString(con->constvalue));
}
appendStringInfoString(buf, " FROM ");
get_rule_expr((Node *) lsecond(expr->args), context, false);
appendStringInfoChar(buf, ')');
return true;
case F_IS_NORMALIZED:
/* IS xxx NORMALIZED */
appendStringInfoString(buf, "((");