|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * 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 $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -283,7 +283,14 @@ DefineQueryRewrite(RuleStmt *stmt)
|
283 | 283 | if (attr->atttypid!=resdom->restype)
|
284 | 284 | elog(ERROR,"select rule's target entry %d has different type from attribute %s",i,attname);
|
285 | 285 |
|
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) |
287 | 294 | elog(ERROR,"select rule's target entry %d has different size from attribute %s",i,attname);
|
288 | 295 | }
|
289 | 296 |
|
|