From 9e6dc1372f7ece296fc4a02b4c69f5ef86366acc Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 30 Jul 2010 17:57:07 +0000 Subject: Improved version of patch to protect pg_get_expr() against misuse: look through join alias Vars to avoid breaking join queries, and move the test to someplace where it will catch more possible ways of calling a function. We still ought to throw away the whole thing in favor of a data-type-based solution, but that's not feasible in the back branches. Completion of back-port of my patch of yesterday. --- src/backend/parser/parse_oper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/backend/parser/parse_oper.c') diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 6b23fbb9e9a..49b7b541215 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.101 2008/01/11 18:39:41 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.101.2.1 2010/07/30 17:57:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1059,6 +1059,9 @@ make_scalar_array_op(ParseState *pstate, List *opname, ReleaseSysCache(tup); + /* Hack to protect pg_get_expr() against misuse */ + check_pg_get_expr_args(pstate, result->opfuncid, args); + return (Expr *) result; } @@ -1131,6 +1134,9 @@ make_op_expr(ParseState *pstate, Operator op, result->opretset = get_func_retset(opform->oprcode); result->args = args; + /* Hack to protect pg_get_expr() against misuse */ + check_pg_get_expr_args(pstate, result->opfuncid, args); + return (Expr *) result; } -- cgit v1.2.3