8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.302 2009/10/12 19:49:24 adunstan Exp $
11
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.303 2009/10/13 00:53:07 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -333,7 +333,7 @@ static void ATExecAddInherit(Relation rel, RangeVar *parent);
333
333
static void ATExecDropInherit (Relation rel , RangeVar * parent );
334
334
static void copy_relation_data (SMgrRelation rel , SMgrRelation dst ,
335
335
ForkNumber forkNum , bool istemp );
336
- static const char * storage_name (char c );
336
+ static const char * storage_name (char c );
337
337
338
338
339
339
/* ----------------------------------------------------------------
@@ -1102,22 +1102,25 @@ truncate_check_rel(Relation rel)
1102
1102
CheckTableNotInUse (rel , "TRUNCATE" );
1103
1103
}
1104
1104
1105
-
1106
- /*----------------
1105
+ /*
1107
1106
* storage_name
1108
- * returns a name corresponding to a storage enum value
1109
- * For use in error messages
1107
+ * returns the name corresponding to a typstorage/attstorage enum value
1110
1108
*/
1111
1109
static const char *
1112
1110
storage_name (char c )
1113
1111
{
1114
1112
switch (c )
1115
1113
{
1116
- case 'p' : return "PLAIN" ;
1117
- case 'm' : return "MAIN" ;
1118
- case 'x' : return "EXTENDED" ;
1119
- case 'e' : return "EXTERNAL" ;
1120
- default : return "???" ;
1114
+ case 'p' :
1115
+ return "PLAIN" ;
1116
+ case 'm' :
1117
+ return "MAIN" ;
1118
+ case 'x' :
1119
+ return "EXTENDED" ;
1120
+ case 'e' :
1121
+ return "EXTERNAL" ;
1122
+ default :
1123
+ return "???" ;
1121
1124
}
1122
1125
}
1123
1126
@@ -1189,7 +1192,6 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1189
1192
List * constraints = NIL ;
1190
1193
int parentsWithOids = 0 ;
1191
1194
bool have_bogus_defaults = false;
1192
- bool have_bogus_comments = false;
1193
1195
int child_attno ;
1194
1196
static Node bogus_marker = { 0 }; /* marks conflicting defaults */
1195
1197
@@ -1354,7 +1356,8 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1354
1356
(errcode (ERRCODE_DATATYPE_MISMATCH ),
1355
1357
errmsg ("inherited column \"%s\" has a storage parameter conflict" ,
1356
1358
attributeName ),
1357
- errdetail ("%s versus %s" , storage_name (def -> storage ),
1359
+ errdetail ("%s versus %s" ,
1360
+ storage_name (def -> storage ),
1358
1361
storage_name (attribute -> attstorage ))));
1359
1362
1360
1363
def -> inhcount ++ ;
@@ -1375,10 +1378,10 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1375
1378
def -> inhcount = 1 ;
1376
1379
def -> is_local = false;
1377
1380
def -> is_not_null = attribute -> attnotnull ;
1381
+ def -> storage = attribute -> attstorage ;
1378
1382
def -> raw_default = NULL ;
1379
1383
def -> cooked_default = NULL ;
1380
1384
def -> constraints = NIL ;
1381
- def -> storage = attribute -> attstorage ;
1382
1385
inhSchema = lappend (inhSchema , def );
1383
1386
newattno [parent_attno - 1 ] = ++ child_attno ;
1384
1387
}
@@ -1525,7 +1528,8 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1525
1528
(errcode (ERRCODE_DATATYPE_MISMATCH ),
1526
1529
errmsg ("column \"%s\" has a storage parameter conflict" ,
1527
1530
attributeName ),
1528
- errdetail ("%s versus %s" , storage_name (def -> storage ),
1531
+ errdetail ("%s versus %s" ,
1532
+ storage_name (def -> storage ),
1529
1533
storage_name (newdef -> storage ))));
1530
1534
1531
1535
/* Mark the column as locally defined */
@@ -1580,20 +1584,6 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1580
1584
}
1581
1585
}
1582
1586
1583
- /* Raise an error if we found conflicting comments. */
1584
- if (have_bogus_comments )
1585
- {
1586
- foreach (entry , schema )
1587
- {
1588
- ColumnDef * def = lfirst (entry );
1589
-
1590
- if (def -> cooked_default == & bogus_marker )
1591
- ereport (ERROR ,
1592
- (errcode (ERRCODE_INVALID_COLUMN_DEFINITION ),
1593
- errmsg ("column \"%s\" inherits conflicting comments" , def -> colname )));
1594
- }
1595
- }
1596
-
1597
1587
* supOids = parentOids ;
1598
1588
* supconstr = constraints ;
1599
1589
* supOidCount = parentsWithOids ;
@@ -3903,6 +3893,7 @@ ATPrepAddOids(List **wqueue, Relation rel, bool recurse, AlterTableCmd *cmd)
3903
3893
cdef -> inhcount = 0 ;
3904
3894
cdef -> is_local = true;
3905
3895
cdef -> is_not_null = true;
3896
+ cdef -> storage = 0 ;
3906
3897
cmd -> def = (Node * ) cdef ;
3907
3898
}
3908
3899
ATPrepAddColumn (wqueue , rel , recurse , cmd );
0 commit comments