From 6b8494a3adc009247ada8a7a7adc1c488396161d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 30 Jul 2010 17:56:59 +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 16ed3a11ed5..198a2bc4e9a 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.109 2009/06/13 15:42:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.109.2.1 2010/07/30 17:56:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -880,6 +880,9 @@ make_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, ReleaseSysCache(tup); + /* Hack to protect pg_get_expr() against misuse */ + check_pg_get_expr_args(pstate, result->opfuncid, args); + return (Expr *) result; } @@ -1008,6 +1011,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; } -- cgit v1.2.3