1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

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.
This commit is contained in:
Tom Lane
2010-07-30 17:57:12 +00:00
parent a0ad1d1f83
commit bd707d3310
4 changed files with 118 additions and 84 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.90 2006/10/04 00:29:56 momjian Exp $
* $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.90.2.1 2010/07/30 17:57:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -933,6 +933,9 @@ make_scalar_array_op(ParseState *pstate, List *opname,
result->useOr = useOr;
result->args = args;
/* Hack to protect pg_get_expr() against misuse */
check_pg_get_expr_args(pstate, opform->oprcode, args);
ReleaseSysCache(tup);
return (Expr *) result;
@ -1006,5 +1009,8 @@ 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, opform->oprcode, args);
return (Expr *) result;
}