diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-30 17:57:32 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-30 17:57:32 +0000 |
commit | 10c05657d363a185ba433876b9ac99302d67ee0d (patch) | |
tree | 6d64e92b5ccc5d3cd7d9b15057ad429889c9852a /src/backend/parser/parse_oper.c | |
parent | 678e0d92c2d7e3b9648e07fea8d288571091d699 (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.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index a5b5ac52eb0..1df5837af02 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.76 2003/10/06 20:09:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.76.2.1 2010/07/30 17:57:32 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -932,6 +932,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; @@ -1005,5 +1008,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; } |