8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.289 2009/07/12 17:12:33 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.290 2009/07/16 06:33:42 petere Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -305,7 +305,7 @@ static void ATPrepAlterColumnType(List **wqueue,
305
305
bool recurse , bool recursing ,
306
306
AlterTableCmd * cmd );
307
307
static void ATExecAlterColumnType (AlteredTableInfo * tab , Relation rel ,
308
- const char * colName , TypeName * typename );
308
+ const char * colName , TypeName * typeName );
309
309
static void ATPostAlterTypeCleanup (List * * wqueue , AlteredTableInfo * tab );
310
310
static void ATPostAlterTypeParse (char * cmd , List * * wqueue );
311
311
static void change_owner_recurse_to_sequences (Oid relationOid ,
@@ -1280,15 +1280,15 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1280
1280
(errmsg ("merging multiple inherited definitions of column \"%s\"" ,
1281
1281
attributeName )));
1282
1282
def = (ColumnDef * ) list_nth (inhSchema , exist_attno - 1 );
1283
- defTypeId = typenameTypeId (NULL , def -> typename , & deftypmod );
1283
+ defTypeId = typenameTypeId (NULL , def -> typeName , & deftypmod );
1284
1284
if (defTypeId != attribute -> atttypid ||
1285
1285
deftypmod != attribute -> atttypmod )
1286
1286
ereport (ERROR ,
1287
1287
(errcode (ERRCODE_DATATYPE_MISMATCH ),
1288
1288
errmsg ("inherited column \"%s\" has a type conflict" ,
1289
1289
attributeName ),
1290
1290
errdetail ("%s versus %s" ,
1291
- TypeNameToString (def -> typename ),
1291
+ TypeNameToString (def -> typeName ),
1292
1292
format_type_be (attribute -> atttypid ))));
1293
1293
def -> inhcount ++ ;
1294
1294
/* Merge of NOT NULL constraints = OR 'em together */
@@ -1303,7 +1303,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1303
1303
*/
1304
1304
def = makeNode (ColumnDef );
1305
1305
def -> colname = pstrdup (attributeName );
1306
- def -> typename = makeTypeNameFromOid (attribute -> atttypid ,
1306
+ def -> typeName = makeTypeNameFromOid (attribute -> atttypid ,
1307
1307
attribute -> atttypmod );
1308
1308
def -> inhcount = 1 ;
1309
1309
def -> is_local = false;
@@ -1438,16 +1438,16 @@ MergeAttributes(List *schema, List *supers, bool istemp,
1438
1438
(errmsg ("merging column \"%s\" with inherited definition" ,
1439
1439
attributeName )));
1440
1440
def = (ColumnDef * ) list_nth (inhSchema , exist_attno - 1 );
1441
- defTypeId = typenameTypeId (NULL , def -> typename , & deftypmod );
1442
- newTypeId = typenameTypeId (NULL , newdef -> typename , & newtypmod );
1441
+ defTypeId = typenameTypeId (NULL , def -> typeName , & deftypmod );
1442
+ newTypeId = typenameTypeId (NULL , newdef -> typeName , & newtypmod );
1443
1443
if (defTypeId != newTypeId || deftypmod != newtypmod )
1444
1444
ereport (ERROR ,
1445
1445
(errcode (ERRCODE_DATATYPE_MISMATCH ),
1446
1446
errmsg ("column \"%s\" has a type conflict" ,
1447
1447
attributeName ),
1448
1448
errdetail ("%s versus %s" ,
1449
- TypeNameToString (def -> typename ),
1450
- TypeNameToString (newdef -> typename ))));
1449
+ TypeNameToString (def -> typeName ),
1450
+ TypeNameToString (newdef -> typeName ))));
1451
1451
/* Mark the column as locally defined */
1452
1452
def -> is_local = true;
1453
1453
/* Merge of NOT NULL constraints = OR 'em together */
@@ -1598,22 +1598,22 @@ change_varattnos_walker(Node *node, const AttrNumber *newattno)
1598
1598
* matching according to column name.
1599
1599
*/
1600
1600
AttrNumber *
1601
- varattnos_map (TupleDesc old , TupleDesc new )
1601
+ varattnos_map (TupleDesc olddesc , TupleDesc newdesc )
1602
1602
{
1603
1603
AttrNumber * attmap ;
1604
1604
int i ,
1605
1605
j ;
1606
1606
1607
- attmap = (AttrNumber * ) palloc0 (sizeof (AttrNumber ) * old -> natts );
1608
- for (i = 1 ; i <= old -> natts ; i ++ )
1607
+ attmap = (AttrNumber * ) palloc0 (sizeof (AttrNumber ) * olddesc -> natts );
1608
+ for (i = 1 ; i <= olddesc -> natts ; i ++ )
1609
1609
{
1610
- if (old -> attrs [i - 1 ]-> attisdropped )
1610
+ if (olddesc -> attrs [i - 1 ]-> attisdropped )
1611
1611
continue ; /* leave the entry as zero */
1612
1612
1613
- for (j = 1 ; j <= new -> natts ; j ++ )
1613
+ for (j = 1 ; j <= newdesc -> natts ; j ++ )
1614
1614
{
1615
- if (strcmp (NameStr (old -> attrs [i - 1 ]-> attname ),
1616
- NameStr (new -> attrs [j - 1 ]-> attname )) == 0 )
1615
+ if (strcmp (NameStr (olddesc -> attrs [i - 1 ]-> attname ),
1616
+ NameStr (newdesc -> attrs [j - 1 ]-> attname )) == 0 )
1617
1617
{
1618
1618
attmap [i - 1 ] = j ;
1619
1619
break ;
@@ -3530,7 +3530,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
3530
3530
int32 ctypmod ;
3531
3531
3532
3532
/* Child column must match by type */
3533
- ctypeId = typenameTypeId (NULL , colDef -> typename , & ctypmod );
3533
+ ctypeId = typenameTypeId (NULL , colDef -> typeName , & ctypmod );
3534
3534
if (ctypeId != childatt -> atttypid ||
3535
3535
ctypmod != childatt -> atttypmod )
3536
3536
ereport (ERROR ,
@@ -3597,7 +3597,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
3597
3597
MaxHeapAttributeNumber )));
3598
3598
}
3599
3599
3600
- typeTuple = typenameType (NULL , colDef -> typename , & typmod );
3600
+ typeTuple = typenameType (NULL , colDef -> typeName , & typmod );
3601
3601
tform = (Form_pg_type ) GETSTRUCT (typeTuple );
3602
3602
typeOid = HeapTupleGetOid (typeTuple );
3603
3603
@@ -3614,7 +3614,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
3614
3614
attribute .atttypmod = typmod ;
3615
3615
attribute .attnum = newattnum ;
3616
3616
attribute .attbyval = tform -> typbyval ;
3617
- attribute .attndims = list_length (colDef -> typename -> arrayBounds );
3617
+ attribute .attndims = list_length (colDef -> typeName -> arrayBounds );
3618
3618
attribute .attstorage = tform -> typstorage ;
3619
3619
attribute .attalign = tform -> typalign ;
3620
3620
attribute .attnotnull = colDef -> is_not_null ;
@@ -3788,7 +3788,7 @@ ATPrepAddOids(List **wqueue, Relation rel, bool recurse, AlterTableCmd *cmd)
3788
3788
ColumnDef * cdef = makeNode (ColumnDef );
3789
3789
3790
3790
cdef -> colname = pstrdup ("oid" );
3791
- cdef -> typename = makeTypeNameFromOid (OIDOID , -1 );
3791
+ cdef -> typeName = makeTypeNameFromOid (OIDOID , -1 );
3792
3792
cdef -> inhcount = 0 ;
3793
3793
cdef -> is_local = true;
3794
3794
cdef -> is_not_null = true;
@@ -5548,7 +5548,7 @@ ATPrepAlterColumnType(List **wqueue,
5548
5548
AlterTableCmd * cmd )
5549
5549
{
5550
5550
char * colName = cmd -> name ;
5551
- TypeName * typename = (TypeName * ) cmd -> def ;
5551
+ TypeName * typeName = (TypeName * ) cmd -> def ;
5552
5552
HeapTuple tuple ;
5553
5553
Form_pg_attribute attTup ;
5554
5554
AttrNumber attnum ;
@@ -5583,7 +5583,7 @@ ATPrepAlterColumnType(List **wqueue,
5583
5583
colName )));
5584
5584
5585
5585
/* Look up the target type */
5586
- targettype = typenameTypeId (NULL , typename , & targettypmod );
5586
+ targettype = typenameTypeId (NULL , typeName , & targettypmod );
5587
5587
5588
5588
/* make sure datatype is legal for a column */
5589
5589
CheckAttributeType (colName , targettype );
@@ -5678,7 +5678,7 @@ ATPrepAlterColumnType(List **wqueue,
5678
5678
5679
5679
static void
5680
5680
ATExecAlterColumnType (AlteredTableInfo * tab , Relation rel ,
5681
- const char * colName , TypeName * typename )
5681
+ const char * colName , TypeName * typeName )
5682
5682
{
5683
5683
HeapTuple heapTup ;
5684
5684
Form_pg_attribute attTup ;
@@ -5715,7 +5715,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
5715
5715
colName )));
5716
5716
5717
5717
/* Look up the target type (should not fail, since prep found it) */
5718
- typeTuple = typenameType (NULL , typename , & targettypmod );
5718
+ typeTuple = typenameType (NULL , typeName , & targettypmod );
5719
5719
tform = (Form_pg_type ) GETSTRUCT (typeTuple );
5720
5720
targettype = HeapTupleGetOid (typeTuple );
5721
5721
@@ -5962,7 +5962,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
5962
5962
*/
5963
5963
attTup -> atttypid = targettype ;
5964
5964
attTup -> atttypmod = targettypmod ;
5965
- attTup -> attndims = list_length (typename -> arrayBounds );
5965
+ attTup -> attndims = list_length (typeName -> arrayBounds );
5966
5966
attTup -> attlen = tform -> typlen ;
5967
5967
attTup -> attbyval = tform -> typbyval ;
5968
5968
attTup -> attalign = tform -> typalign ;
0 commit comments