aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-03-17 01:15:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-03-17 01:15:55 +0000
commite88a7ad77486db0926d33b31962d274bc9fd08ae (patch)
tree536d21991b2f48f6be7ffdd300f265f84965e792 /src/backend/parser/parse_expr.c
parent0f4ff460c479e9c9bff90e8208f0a5272b9925df (diff)
downloadpostgresql-e88a7ad77486db0926d33b31962d274bc9fd08ae.tar.gz
postgresql-e88a7ad77486db0926d33b31962d274bc9fd08ae.zip
Ooops, got only one of the two ArrayExpr variants correct in first
cut at exprTypmod support. Also, experimentation shows that we need to label the type of Const nodes that are numeric with a specific typmod.
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r--src/backend/parser/parse_expr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 3da003fd09a..9f0a501dc53 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.213 2007/03/17 00:11:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.214 2007/03/17 01:15:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1958,7 +1958,7 @@ exprTypmod(Node *expr)
* typmod, else use -1
*/
ArrayExpr *arrayexpr = (ArrayExpr *) expr;
- Oid arraytype = arrayexpr->array_typeid;
+ Oid commontype;
int32 typmod;
ListCell *elem;
@@ -1967,11 +1967,15 @@ exprTypmod(Node *expr)
typmod = exprTypmod((Node *) linitial(arrayexpr->elements));
if (typmod < 0)
return -1; /* no point in trying harder */
+ if (arrayexpr->multidims)
+ commontype = arrayexpr->array_typeid;
+ else
+ commontype = arrayexpr->element_typeid;
foreach(elem, arrayexpr->elements)
{
Node *e = (Node *) lfirst(elem);
- if (exprType(e) != arraytype)
+ if (exprType(e) != commontype)
return -1;
if (exprTypmod(e) != typmod)
return -1;