summaryrefslogtreecommitdiff
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:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-07-30 17:57:18 +0000
commit2f7cd4356b1b95b935581477a9495003f589fc83 (patch)
tree16fb281cbfa6361b6923a5c4c703124a8f694991 /src/backend/parser/parse_oper.c
parent9e468f94aa30cef7c188a2b8b0d26f26130d44c0 (diff)
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 6329ae5f927..ff255915b8e 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.82.2.1 2005/11/22 18:23:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.82.2.2 2010/07/30 17:57:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -930,6 +930,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;
@@ -1003,5 +1006,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;
}