aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/readfuncs.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/readfuncs.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/readfuncs.c')
-rw-r--r--src/backend/nodes/readfuncs.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index 70612c864f7..1f3b81e275f 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.204 2007/03/17 00:11:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.205 2007/03/27 23:21:09 tgl Exp $
*
* NOTES
* Path and Plan nodes do not have any readfuncs support, because we
@@ -585,6 +585,24 @@ _readRelabelType(void)
}
/*
+ * _readArrayCoerceExpr
+ */
+static ArrayCoerceExpr *
+_readArrayCoerceExpr(void)
+{
+ READ_LOCALS(ArrayCoerceExpr);
+
+ READ_NODE_FIELD(arg);
+ READ_OID_FIELD(elemfuncid);
+ READ_OID_FIELD(resulttype);
+ READ_INT_FIELD(resulttypmod);
+ READ_BOOL_FIELD(isExplicit);
+ READ_ENUM_FIELD(coerceformat, CoercionForm);
+
+ READ_DONE();
+}
+
+/*
* _readConvertRowtypeExpr
*/
static ConvertRowtypeExpr *
@@ -1024,6 +1042,8 @@ parseNodeString(void)
return_value = _readFieldStore();
else if (MATCH("RELABELTYPE", 11))
return_value = _readRelabelType();
+ else if (MATCH("ARRAYCOERCEEXPR", 15))
+ return_value = _readArrayCoerceExpr();
else if (MATCH("CONVERTROWTYPEEXPR", 18))
return_value = _readConvertRowtypeExpr();
else if (MATCH("CASE", 4))