aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/heapam.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-03-27 23:53:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-03-27 23:53:05 +0000
commitbf3dbb5881e9b886ee9fe84bca2153c698eea885 (patch)
treeeaaf385364adebc2489c72f30e533f5fe60748ec /src/backend/access/heap/heapam.c
parent351519affcffb636de68c4872521c9ac22faa228 (diff)
downloadpostgresql-bf3dbb5881e9b886ee9fe84bca2153c698eea885.tar.gz
postgresql-bf3dbb5881e9b886ee9fe84bca2153c698eea885.zip
First steps towards index scans with heap access decoupled from index
access: define new index access method functions 'amgetmulti' that can fetch multiple TIDs per call. (The functions exist but are totally untested as yet.) Since I was modifying pg_am anyway, remove the no-longer-needed 'rel' parameter from amcostestimate functions, and also remove the vestigial amowner column that was creating useless work for Alvaro's shared-object-dependencies project. Initdb forced due to changes in pg_am.
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r--src/backend/access/heap/heapam.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 4b540c857b7..b5020863000 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.184 2005/03/20 23:40:23 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.185 2005/03/27 23:52:58 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -933,18 +933,35 @@ heap_release_fetch(Relation relation,
* Need share lock on buffer to examine tuple commit status.
*/
LockBuffer(buffer, BUFFER_LOCK_SHARE);
+ dp = (PageHeader) BufferGetPage(buffer);
/*
- * get the item line pointer corresponding to the requested tid
+ * We'd better check for out-of-range offnum in case of VACUUM since
+ * the TID was obtained.
*/
- dp = (PageHeader) BufferGetPage(buffer);
offnum = ItemPointerGetOffsetNumber(tid);
+ if (offnum < FirstOffsetNumber || offnum > PageGetMaxOffsetNumber(dp))
+ {
+ LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+ if (keep_buf)
+ *userbuf = buffer;
+ else
+ {
+ ReleaseBuffer(buffer);
+ *userbuf = InvalidBuffer;
+ }
+ tuple->t_datamcxt = NULL;
+ tuple->t_data = NULL;
+ return false;
+ }
+
+ /*
+ * get the item line pointer corresponding to the requested tid
+ */
lp = PageGetItemId(dp, offnum);
/*
- * must check for deleted tuple (see for example analyze.c, which is
- * careful to pass an offnum in range, but doesn't know if the offnum
- * actually corresponds to an undeleted tuple).
+ * Must check for deleted tuple.
*/
if (!ItemIdIsUsed(lp))
{