aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-03-27 23:21:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-03-27 23:21:12 +0000
commitbf94076348ef7e0a81e3fe4ededb2fdcd14b303b (patch)
treee513ac49a62f2fbde540bbc57b3e162d7ff13624 /src/backend/nodes/outfuncs.c
parent87564ffc6a87c6cdcc669472892be2ef0870a0f3 (diff)
downloadpostgresql-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/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 083f016cf8f..49202f8664a 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -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*
@@ -870,6 +870,19 @@ _outRelabelType(StringInfo str, RelabelType *node)
}
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)
{
WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
@@ -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;