Skip to content

Commit 942702a

Browse files
committed
When you do "ARRAY[...]::domain", where domain is a domain over an array type,
we need to check domain constraints. We used to do it correctly, but 8.4 introduced a separate code path for the "ARRAY[]::arraytype" case to infer the type of an empty ARRAY construct from the cast target, and forgot to take domains into account. Per report from Florian G. Pflug.
1 parent 5e75f67 commit 942702a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/backend/parser/parse_expr.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.248 2009/11/09 02:36:56 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.249 2009/11/13 16:09:10 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -169,6 +169,20 @@ transformExpr(ParseState *pstate, Node *expr)
169169
targetType,
170170
elementType,
171171
targetTypmod);
172+
173+
/*
174+
* If the target array type is a domain, we still need
175+
* to check the domain constraint. (coerce_to_domain
176+
* is a no-op if targetType is not a domain)
177+
*/
178+
result = coerce_to_domain(result,
179+
InvalidOid,
180+
-1,
181+
targetType,
182+
COERCE_IMPLICIT_CAST,
183+
tc->location,
184+
false,
185+
true);
172186
break;
173187
}
174188

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy