diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-08-19 02:04:17 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-08-19 02:04:17 +0000 |
commit | 7971539020a344dce3a8b3b9b93ff4f10e2f823a (patch) | |
tree | 8dca0af0d3ac8d431bff8c0dec793fe9733a1ee9 /src/backend/commands/copy.c | |
parent | 31de2c9461dff3284ad61084c73eba093fa3f68e (diff) | |
download | postgresql-7971539020a344dce3a8b3b9b93ff4f10e2f823a.tar.gz postgresql-7971539020a344dce3a8b3b9b93ff4f10e2f823a.zip |
heap_fetch requires buffer pointer, must be released; heap_getnext
no longer returns buffer pointer, can be gotten from scan;
descriptor; bootstrap can create multi-key indexes;
pg_procname index now is multi-key index; oidint2, oidint4, oidname
are gone (must be removed from regression tests); use System Cache
rather than sequential scan in many places; heap_modifytuple no
longer takes buffer parameter; remove unused buffer parameter in
a few other functions; oid8 is not index-able; remove some use of
single-character variable names; cleanup Buffer variables usage
and scan descriptor looping; cleaned up allocation and freeing of
tuples; 18k lines of diff;
Diffstat (limited to 'src/backend/commands/copy.c')
-rw-r--r-- | src/backend/commands/copy.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 4265cdf5c02..34372db2a7d 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.52 1998/07/27 19:37:51 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.53 1998/08/19 02:01:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -257,9 +257,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim) fwrite(&ntuples, sizeof(int32), 1, fp); } - for (tuple = heap_getnext(scandesc, 0, NULL); - tuple != NULL; - tuple = heap_getnext(scandesc, 0, NULL)) + while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0))) { if (oids && !binary) @@ -417,7 +415,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) if (rel->rd_rel->relhasindex) { - GetIndexRelations(rel->rd_id, &n_indices, &index_rels); + GetIndexRelations(RelationGetRelid(rel), &n_indices, &index_rels); if (n_indices > 0) { has_index = true; @@ -435,7 +433,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) itupdescArr[i] = RelationGetTupleDescriptor(index_rels[i]); pgIndexTup = SearchSysCacheTuple(INDEXRELID, - ObjectIdGetDatum(index_rels[i]->rd_id), + ObjectIdGetDatum(RelationGetRelid(index_rels[i])), 0, 0, 0); Assert(pgIndexTup); pgIndexP[i] = (IndexTupleForm) GETSTRUCT(pgIndexTup); @@ -758,7 +756,6 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) (AttrNumber *) &(pgIndexP[i]->indkey[0]), tuple, tupDesc, - InvalidBuffer, idatum, index_nulls, finfoP[i]); @@ -833,7 +830,6 @@ GetTypeElement(Oid type) ObjectIdGetDatum(type), 0, 0, 0); - if (HeapTupleIsValid(typeTuple)) return ((int) ((TypeTupleForm) GETSTRUCT(typeTuple))->typelem); @@ -913,9 +909,7 @@ GetIndexRelations(Oid main_relation_oid, scan = head; head->next = NULL; - for (tuple = heap_getnext(scandesc, 0, NULL); - tuple != NULL; - tuple = heap_getnext(scandesc, 0, NULL)) + while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0))) { index_relation_oid = @@ -1168,10 +1162,9 @@ CountTuples(Relation relation) scandesc = heap_beginscan(relation, 0, SnapshotNow, 0, NULL); - for (tuple = heap_getnext(scandesc, 0, NULL), i = 0; - tuple != NULL; - tuple = heap_getnext(scandesc, 0, NULL), i++) - ; + i = 0; + while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0))) + i++; heap_endscan(scandesc); return (i); } |