* get_func_expr - Parse back a FuncExpr node */
| 10007 | * get_func_expr - Parse back a FuncExpr node |
| 10008 | */ |
| 10009 | static void |
| 10010 | get_func_expr(FuncExpr *expr, deparse_context *context, |
| 10011 | bool showimplicit) |
| 10012 | { |
| 10013 | StringInfo buf = context->buf; |
| 10014 | Oid funcoid = expr->funcid; |
| 10015 | Oid argtypes[FUNC_MAX_ARGS]; |
| 10016 | int nargs; |
| 10017 | List *argnames; |
| 10018 | bool use_variadic; |
| 10019 | ListCell *l; |
| 10020 | |
| 10021 | /* |
| 10022 | * If the function call came from an implicit coercion, then just show the |
| 10023 | * first argument --- unless caller wants to see implicit coercions. |
| 10024 | */ |
| 10025 | if (expr->funcformat == COERCE_IMPLICIT_CAST && !showimplicit) |
| 10026 | { |
| 10027 | get_rule_expr_paren((Node *) linitial(expr->args), context, |
| 10028 | false, (Node *) expr); |
| 10029 | return; |
| 10030 | } |
| 10031 | |
| 10032 | /* |
| 10033 | * If the function call came from a cast, then show the first argument |
| 10034 | * plus an explicit cast operation. |
| 10035 | */ |
| 10036 | if (expr->funcformat == COERCE_EXPLICIT_CAST || |
| 10037 | expr->funcformat == COERCE_IMPLICIT_CAST) |
| 10038 | { |
| 10039 | Node *arg = linitial(expr->args); |
| 10040 | Oid rettype = expr->funcresulttype; |
| 10041 | int32 coercedTypmod; |
| 10042 | |
| 10043 | /* Get the typmod if this is a length-coercion function */ |
| 10044 | (void) exprIsLengthCoercion((Node *) expr, &coercedTypmod); |
| 10045 | |
| 10046 | get_coercion_expr(arg, context, |
| 10047 | rettype, coercedTypmod, |
| 10048 | (Node *) expr); |
| 10049 | |
| 10050 | return; |
| 10051 | } |
| 10052 | |
| 10053 | /* |
| 10054 | * If the function was called using one of the SQL spec's random special |
| 10055 | * syntaxes, try to reproduce that. If we don't recognize the function, |
| 10056 | * fall through. |
| 10057 | */ |
| 10058 | if (expr->funcformat == COERCE_SQL_SYNTAX) |
| 10059 | { |
| 10060 | if (get_func_sql_syntax(expr, context)) |
| 10061 | return; |
| 10062 | } |
| 10063 | |
| 10064 | /* |
| 10065 | * Normal function: display as proname(args). First we need to extract |
| 10066 | * the argument datatypes. |
no test coverage detected