aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index d583b8e6f15..8e36745b181 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -8290,11 +8290,12 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
{
case T_FuncExpr:
{
- /* special handling for casts */
+ /* special handling for casts and COERCE_SQL_SYNTAX */
CoercionForm type = ((FuncExpr *) parentNode)->funcformat;
if (type == COERCE_EXPLICIT_CAST ||
- type == COERCE_IMPLICIT_CAST)
+ type == COERCE_IMPLICIT_CAST ||
+ type == COERCE_SQL_SYNTAX)
return false;
return true; /* own parentheses */
}
@@ -8342,11 +8343,12 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
return false;
case T_FuncExpr:
{
- /* special handling for casts */
+ /* special handling for casts and COERCE_SQL_SYNTAX */
CoercionForm type = ((FuncExpr *) parentNode)->funcformat;
if (type == COERCE_EXPLICIT_CAST ||
- type == COERCE_IMPLICIT_CAST)
+ type == COERCE_IMPLICIT_CAST ||
+ type == COERCE_SQL_SYNTAX)
return false;
return true; /* own parentheses */
}
@@ -10117,9 +10119,11 @@ get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
case F_TIMEZONE_TEXT_TIMETZ:
/* AT TIME ZONE ... note reversed argument order */
appendStringInfoChar(buf, '(');
- get_rule_expr((Node *) lsecond(expr->args), context, false);
+ get_rule_expr_paren((Node *) lsecond(expr->args), context, false,
+ (Node *) expr);
appendStringInfoString(buf, " AT TIME ZONE ");
- get_rule_expr((Node *) linitial(expr->args), context, false);
+ get_rule_expr_paren((Node *) linitial(expr->args), context, false,
+ (Node *) expr);
appendStringInfoChar(buf, ')');
return true;
@@ -10171,9 +10175,10 @@ get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
case F_IS_NORMALIZED:
/* IS xxx NORMALIZED */
- appendStringInfoString(buf, "((");
- get_rule_expr((Node *) linitial(expr->args), context, false);
- appendStringInfoString(buf, ") IS");
+ appendStringInfoString(buf, "(");
+ get_rule_expr_paren((Node *) linitial(expr->args), context, false,
+ (Node *) expr);
+ appendStringInfoString(buf, " IS");
if (list_length(expr->args) == 2)
{
Const *con = (Const *) lsecond(expr->args);
@@ -10194,11 +10199,6 @@ get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
appendStringInfoChar(buf, ')');
return true;
- /*
- * XXX EXTRACT, a/k/a date_part(), is intentionally not covered
- * yet. Add it after we change the return type to numeric.
- */
-
case F_NORMALIZE:
/* NORMALIZE() */
appendStringInfoString(buf, "NORMALIZE(");