|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.210 2002/07/18 16:47:22 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.211 2002/07/19 22:21:17 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *
|
14 | 14 | * INTERFACE ROUTINES
|
@@ -793,7 +793,8 @@ heap_create_with_catalog(const char *relname,
|
793 | 793 | * Formerly, this routine checked for child relations and aborted the
|
794 | 794 | * deletion if any were found. Now we rely on the dependency mechanism
|
795 | 795 | * to check for or delete child relations. By the time we get here,
|
796 |
| - * there are no children and we need only remove the pg_inherits rows. |
| 796 | + * there are no children and we need only remove any pg_inherits rows |
| 797 | + * linking this relation to its parent(s). |
797 | 798 | */
|
798 | 799 | staticvoid
|
799 | 800 | RelationRemoveInheritance(Relationrelation)
|
@@ -1743,21 +1744,25 @@ static void
|
1743 | 1744 | RemoveStatistics(Relationrel)
|
1744 | 1745 | {
|
1745 | 1746 | Relationpgstatistic;
|
1746 |
| -HeapScanDescscan; |
| 1747 | +SysScanDescscan; |
1747 | 1748 | ScanKeyDatakey;
|
1748 | 1749 | HeapTupletuple;
|
1749 | 1750 |
|
1750 | 1751 | pgstatistic=heap_openr(StatisticRelationName,RowExclusiveLock);
|
1751 | 1752 |
|
1752 |
| -ScanKeyEntryInitialize(&key,0x0,Anum_pg_statistic_starelid, |
1753 |
| -F_OIDEQ, |
| 1753 | +ScanKeyEntryInitialize(&key,0x0, |
| 1754 | +Anum_pg_statistic_starelid,F_OIDEQ, |
1754 | 1755 | ObjectIdGetDatum(RelationGetRelid(rel)));
|
1755 |
| -scan=heap_beginscan(pgstatistic,SnapshotNow,1,&key); |
1756 | 1756 |
|
1757 |
| -while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL) |
| 1757 | +scan=systable_beginscan(pgstatistic,StatisticRelidAttnumIndex, true, |
| 1758 | +SnapshotNow,1,&key); |
| 1759 | + |
| 1760 | +while (HeapTupleIsValid(tuple=systable_getnext(scan))) |
| 1761 | +{ |
1758 | 1762 | simple_heap_delete(pgstatistic,&tuple->t_self);
|
| 1763 | +} |
1759 | 1764 |
|
1760 |
| -heap_endscan(scan); |
| 1765 | +systable_endscan(scan); |
1761 | 1766 | heap_close(pgstatistic,RowExclusiveLock);
|
1762 | 1767 | }
|
1763 | 1768 |
|
|