diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-03-27 23:21:12 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-03-27 23:21:12 +0000 |
commit | bf94076348ef7e0a81e3fe4ededb2fdcd14b303b (patch) | |
tree | e513ac49a62f2fbde540bbc57b3e162d7ff13624 /src/backend/parser/parse_func.c | |
parent | 87564ffc6a87c6cdcc669472892be2ef0870a0f3 (diff) | |
download | postgresql-bf94076348ef7e0a81e3fe4ededb2fdcd14b303b.tar.gz postgresql-bf94076348ef7e0a81e3fe4ededb2fdcd14b303b.zip |
Fix array coercion expressions to ensure that the correct volatility is
seen by code inspecting the expression. The best way to do this seems
to be to drop the original representation as a function invocation, and
instead make a special expression node type that represents applying
the element-type coercion function to each array element. In this way
the element function is exposed and will be checked for volatility.
Per report from Guillaume Smet.
Diffstat (limited to 'src/backend/parser/parse_func.c')
-rw-r--r-- | src/backend/parser/parse_func.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 888dc200d1f..01593317b1f 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.194 2007/02/01 19:10:27 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.195 2007/03/27 23:21:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -756,13 +756,15 @@ func_get_detail(List *funcname, Oid sourceType = argtypes[0]; Node *arg1 = linitial(fargs); Oid cfuncid; + bool arrayCoerce; if ((sourceType == UNKNOWNOID && IsA(arg1, Const)) || (find_coercion_pathway(targetType, sourceType, - COERCION_EXPLICIT, &cfuncid) && - cfuncid == InvalidOid)) + COERCION_EXPLICIT, + &cfuncid, &arrayCoerce) && + cfuncid == InvalidOid && !arrayCoerce)) { - /* Yup, it's a type coercion */ + /* Yup, it's a trivial type coercion */ *funcid = InvalidOid; *rettype = targetType; *retset = false; |