mirror of
https://github.com/postgres/postgres.git
synced 2025-10-31 10:30:33 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user