mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +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:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.371 2007/03/17 00:11:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.372 2007/03/27 23:21:09 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1020,6 +1020,24 @@ _copyRelabelType(RelabelType *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyArrayCoerceExpr
|
||||
*/
|
||||
static ArrayCoerceExpr *
|
||||
_copyArrayCoerceExpr(ArrayCoerceExpr *from)
|
||||
{
|
||||
ArrayCoerceExpr *newnode = makeNode(ArrayCoerceExpr);
|
||||
|
||||
COPY_NODE_FIELD(arg);
|
||||
COPY_SCALAR_FIELD(elemfuncid);
|
||||
COPY_SCALAR_FIELD(resulttype);
|
||||
COPY_SCALAR_FIELD(resulttypmod);
|
||||
COPY_SCALAR_FIELD(isExplicit);
|
||||
COPY_SCALAR_FIELD(coerceformat);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyConvertRowtypeExpr
|
||||
*/
|
||||
@ -3067,6 +3085,9 @@ copyObject(void *from)
|
||||
case T_RelabelType:
|
||||
retval = _copyRelabelType(from);
|
||||
break;
|
||||
case T_ArrayCoerceExpr:
|
||||
retval = _copyArrayCoerceExpr(from);
|
||||
break;
|
||||
case T_ConvertRowtypeExpr:
|
||||
retval = _copyConvertRowtypeExpr(from);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user