diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-29 23:16:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-29 23:16:33 +0000 |
commit | f223bb7a4175e921c37bb12e9417541655219564 (patch) | |
tree | 7d7e522d3a7ebcf867380b0cdbf9c1ef81fa8701 /src/backend/parser/parse_oper.c | |
parent | 5b8bd0529ed5912dae04ffc3383bf4ac43e30083 (diff) | |
download | postgresql-f223bb7a4175e921c37bb12e9417541655219564.tar.gz postgresql-f223bb7a4175e921c37bb12e9417541655219564.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.
This needs to be back-patched further than 9.0, but I don't have time
to do so today. Committing now so that the fix gets into 9.0beta4.
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 f40f9af348e..d7316ef9b62 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.113 2010/02/26 02:00:52 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.114 2010/07/29 23:16:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -869,6 +869,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; } @@ -997,6 +1000,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; } |