Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 160675e

Browse files
committed
Relax test on typmod matching between a table and its proposed ON SELECT
rule. Needed to avoid failure when reloading a 7.0 pg_dump of a view that has a NUMERIC column.
1 parent f8bdef0 commit 160675e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/backend/rewrite/rewriteDefine.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.56 2000/12/05 19:15:09 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.57 2001/01/13 03:58:28 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -283,7 +283,14 @@ DefineQueryRewrite(RuleStmt *stmt)
283283
if (attr->atttypid != resdom->restype)
284284
elog(ERROR, "select rule's target entry %d has different type from attribute %s", i, attname);
285285

286-
if (attr->atttypmod != resdom->restypmod)
286+
/*
287+
* Allow typmods to be different only if one of them is -1,
288+
* ie, "unspecified". This is necessary for cases like "numeric",
289+
* where the table will have a filled-in default length but the
290+
* select rule's expression will probably have typmod = -1.
291+
*/
292+
if (attr->atttypmod != resdom->restypmod &&
293+
attr->atttypmod != -1 && resdom->restypmod != -1)
287294
elog(ERROR, "select rule's target entry %d has different size from attribute %s", i, attname);
288295
}
289296

0 commit comments

Comments
 (0)