8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.106 2000/10/10 17:13:30 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.107 2000/10/16 17:08:05 momjian Exp $
12
12
*
13
13
* NOTES
14
14
* The PerformAddAttribute() code, like most of the relation
@@ -311,10 +311,8 @@ AlterTableAddColumn(const char *relationName,
311
311
if (!allowSystemTableMods && IsSystemRelationName (relationName ))
312
312
elog (ERROR , "ALTER TABLE: relation \"%s\" is a system catalog" ,
313
313
relationName );
314
- #ifndef NO_SECURITY
315
314
if (!pg_ownercheck (GetUserId (), relationName , RELNAME ))
316
315
elog (ERROR , "ALTER TABLE: permission denied" );
317
- #endif
318
316
319
317
/*
320
318
* Grab an exclusive lock on the target table, which we will NOT
@@ -1149,7 +1147,7 @@ AlterTableAddConstraint(char *relationName,
1149
1147
scan = heap_beginscan (rel , false, SnapshotNow , 0 , NULL );
1150
1148
AssertState (scan != NULL );
1151
1149
1152
- /*
1150
+ /*
1153
1151
* We need to make a parse state and range table to allow
1154
1152
* us to transformExpr and fix_opids to get a version of
1155
1153
* the expression we can pass to ExecQual
@@ -1195,7 +1193,7 @@ AlterTableAddConstraint(char *relationName,
1195
1193
rte -> eref -> relname = relationName ;
1196
1194
rtlist = makeList1 (rte );
1197
1195
1198
- /*
1196
+ /*
1199
1197
* Scan through the rows now, making the necessary things
1200
1198
* for ExecQual, and then call it to evaluate the
1201
1199
* expression.
@@ -1224,13 +1222,13 @@ AlterTableAddConstraint(char *relationName,
1224
1222
pfree (rte );
1225
1223
1226
1224
heap_endscan (scan );
1227
- heap_close (rel , NoLock );
1225
+ heap_close (rel , NoLock );
1228
1226
1229
- if (!successful )
1227
+ if (!successful )
1230
1228
{
1231
1229
elog (ERROR , "AlterTableAddConstraint: rejected due to CHECK constraint %s" , name );
1232
1230
}
1233
- /*
1231
+ /*
1234
1232
* Call AddRelationRawConstraints to do the real adding --
1235
1233
* It duplicates some of the above, but does not check the
1236
1234
* validity of the constraint against tuples already in
@@ -1274,7 +1272,7 @@ AlterTableAddConstraint(char *relationName,
1274
1272
1275
1273
pkrel = heap_openr (fkconstraint -> pktable_name , AccessExclusiveLock );
1276
1274
if (pkrel -> rd_rel -> relkind != RELKIND_RELATION )
1277
- elog (ERROR , "referenced table \"%s\" not a relation" ,
1275
+ elog (ERROR , "referenced table \"%s\" not a relation" ,
1278
1276
fkconstraint -> pktable_name );
1279
1277
1280
1278
/*
@@ -1328,7 +1326,7 @@ AlterTableAddConstraint(char *relationName,
1328
1326
}
1329
1327
}
1330
1328
if (found )
1331
- break ;
1329
+ break ;
1332
1330
indexStruct = NULL ;
1333
1331
}
1334
1332
if (!found )
@@ -1591,7 +1589,7 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
1591
1589
1592
1590
if (((Form_pg_class ) GETSTRUCT (reltup ))-> reltoastrelid != InvalidOid )
1593
1591
{
1594
- if (silent )
1592
+ if (silent )
1595
1593
{
1596
1594
heap_close (rel , NoLock );
1597
1595
heap_close (class_rel , NoLock );
@@ -1601,14 +1599,14 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
1601
1599
1602
1600
elog (ERROR , "ALTER TABLE: relation \"%s\" already has a toast table" ,
1603
1601
relationName );
1604
- }
1602
+ }
1605
1603
1606
1604
/*
1607
1605
* Check to see whether the table actually needs a TOAST table.
1608
1606
*/
1609
1607
if (! needs_toast_table (rel ))
1610
1608
{
1611
- if (silent )
1609
+ if (silent )
1612
1610
{
1613
1611
heap_close (rel , NoLock );
1614
1612
heap_close (class_rel , NoLock );
@@ -1784,7 +1782,7 @@ LockTableCommand(LockStmt *lockstmt)
1784
1782
if (rel -> rd_rel -> relkind != RELKIND_RELATION )
1785
1783
elog (ERROR , "LOCK TABLE: %s is not a table" , lockstmt -> relname );
1786
1784
1787
- if (is_view (rel ))
1785
+ if (is_view (rel ))
1788
1786
elog (ERROR , "LOCK TABLE: cannot lock a view" );
1789
1787
1790
1788
if (lockstmt -> mode == AccessShareLock )
@@ -1842,7 +1840,7 @@ is_view(Relation rel)
1842
1840
1843
1841
while (HeapTupleIsValid (tuple = heap_getnext (scanDesc , 0 )))
1844
1842
{
1845
- if (tuple -> t_data != NULL )
1843
+ if (tuple -> t_data != NULL )
1846
1844
{
1847
1845
data = (Form_pg_rewrite ) GETSTRUCT (tuple );
1848
1846
if (data -> ev_type == '1' )
@@ -1856,6 +1854,6 @@ is_view(Relation rel)
1856
1854
1857
1855
heap_endscan (scanDesc );
1858
1856
heap_close (RewriteRelation , RowExclusiveLock );
1859
-
1857
+
1860
1858
return retval ;
1861
1859
}
0 commit comments