mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +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/nodes/outfuncs.c,v 1.304 2007/03/17 00:11:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.305 2007/03/27 23:21:09 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@@ -869,6 +869,19 @@ _outRelabelType(StringInfo str, RelabelType *node)
|
||||
WRITE_ENUM_FIELD(relabelformat, CoercionForm);
|
||||
}
|
||||
|
||||
static void
|
||||
_outArrayCoerceExpr(StringInfo str, ArrayCoerceExpr *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
|
||||
|
||||
WRITE_NODE_FIELD(arg);
|
||||
WRITE_OID_FIELD(elemfuncid);
|
||||
WRITE_OID_FIELD(resulttype);
|
||||
WRITE_INT_FIELD(resulttypmod);
|
||||
WRITE_BOOL_FIELD(isExplicit);
|
||||
WRITE_ENUM_FIELD(coerceformat, CoercionForm);
|
||||
}
|
||||
|
||||
static void
|
||||
_outConvertRowtypeExpr(StringInfo str, ConvertRowtypeExpr *node)
|
||||
{
|
||||
@@ -2149,6 +2162,9 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_RelabelType:
|
||||
_outRelabelType(str, obj);
|
||||
break;
|
||||
case T_ArrayCoerceExpr:
|
||||
_outArrayCoerceExpr(str, obj);
|
||||
break;
|
||||
case T_ConvertRowtypeExpr:
|
||||
_outConvertRowtypeExpr(str, obj);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user