aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_oper.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-07-30 17:57:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-07-30 17:57:12 +0000
commitbd707d3310f40495c7fb16456659f311dc154a5c (patch)
tree2a883b62a7585f136e53814de47759e83ec5a941 /src/backend/parser/parse_oper.c
parenta0ad1d1f831d92e9bd94f6e821cc6c85804272e5 (diff)
downloadpostgresql-bd707d3310f40495c7fb16456659f311dc154a5c.tar.gz
postgresql-bd707d3310f40495c7fb16456659f311dc154a5c.zip
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.
Diffstat (limited to 'src/backend/parser/parse_oper.c')
-rw-r--r--src/backend/parser/parse_oper.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index d8ac0d0ff82..615650c2580 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.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;
}