aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1997-09-08 02:41:22 +0000
committerBruce Momjian <bruce@momjian.us>1997-09-08 02:41:22 +0000
commit319dbfa7364721d3343af03a7ce063c2a2c9d385 (patch)
treea2146fe02c49ce1e497b7c287dfcaa367a703ae4 /src/backend/access
parenta90f12fd9d6886da4f0734288496361a304d3882 (diff)
downloadpostgresql-319dbfa7364721d3343af03a7ce063c2a2c9d385.tar.gz
postgresql-319dbfa7364721d3343af03a7ce063c2a2c9d385.zip
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/common/heaptuple.c678
-rw-r--r--src/backend/access/common/heapvalid.c18
-rw-r--r--src/backend/access/common/indextuple.c192
-rw-r--r--src/backend/access/common/indexvalid.c10
-rw-r--r--src/backend/access/common/printtup.c78
-rw-r--r--src/backend/access/common/tupdesc.c64
-rw-r--r--src/backend/access/gist/gist.c334
-rw-r--r--src/backend/access/gist/gistget.c78
-rw-r--r--src/backend/access/gist/gistscan.c112
-rw-r--r--src/backend/access/hash/hash.c72
-rw-r--r--src/backend/access/hash/hashfunc.c170
-rw-r--r--src/backend/access/hash/hashinsert.c44
-rw-r--r--src/backend/access/hash/hashovfl.c136
-rw-r--r--src/backend/access/hash/hashpage.c190
-rw-r--r--src/backend/access/hash/hashscan.c32
-rw-r--r--src/backend/access/hash/hashsearch.c242
-rw-r--r--src/backend/access/hash/hashstrat.c8
-rw-r--r--src/backend/access/hash/hashutil.c34
-rw-r--r--src/backend/access/heap/heapam.c62
-rw-r--r--src/backend/access/heap/hio.c30
-rw-r--r--src/backend/access/heap/stats.c6
-rw-r--r--src/backend/access/index/genam.c4
-rw-r--r--src/backend/access/index/indexam.c32
-rw-r--r--src/backend/access/index/istrat.c166
-rw-r--r--src/backend/access/nbtree/nbtcompare.c14
-rw-r--r--src/backend/access/nbtree/nbtinsert.c326
-rw-r--r--src/backend/access/nbtree/nbtpage.c98
-rw-r--r--src/backend/access/nbtree/nbtree.c86
-rw-r--r--src/backend/access/nbtree/nbtscan.c66
-rw-r--r--src/backend/access/nbtree/nbtsearch.c406
-rw-r--r--src/backend/access/nbtree/nbtsort.c300
-rw-r--r--src/backend/access/nbtree/nbtstrat.c12
-rw-r--r--src/backend/access/nbtree/nbtutils.c84
-rw-r--r--src/backend/access/rtree/rtget.c56
-rw-r--r--src/backend/access/rtree/rtproc.c20
-rw-r--r--src/backend/access/rtree/rtree.c292
-rw-r--r--src/backend/access/rtree/rtscan.c104
-rw-r--r--src/backend/access/rtree/rtstrat.c12
-rw-r--r--src/backend/access/transam/transam.c60
-rw-r--r--src/backend/access/transam/transsup.c114
-rw-r--r--src/backend/access/transam/varsup.c46
-rw-r--r--src/backend/access/transam/xact.c476
-rw-r--r--src/backend/access/transam/xid.c6
43 files changed, 2689 insertions, 2681 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 17257690303..9ce59d8165c 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.22 1997/09/07 04:37:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.23 1997/09/08 02:19:47 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -53,9 +53,9 @@ ComputeDataSize(TupleDesc tupleDesc,
Datum value[],
char nulls[])
{
- uint32 data_length;
- int i;
- int numberOfAttributes = tupleDesc->natts;
+ uint32 data_length;
+ int i;
+ int numberOfAttributes = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs;
for (data_length = 0, i = 0; i < numberOfAttributes; i++)
@@ -65,41 +65,41 @@ ComputeDataSize(TupleDesc tupleDesc,
switch (att[i]->attlen)
{
- case -1:
+ case -1:
- /*
- * This is the size of the disk representation and so must
- * include the additional sizeof long.
- */
- if (att[i]->attalign == 'd')
- {
- data_length = DOUBLEALIGN(data_length)
- + VARSIZE(DatumGetPointer(value[i]));
- }
- else
- {
- data_length = INTALIGN(data_length)
- + VARSIZE(DatumGetPointer(value[i]));
- }
- break;
- case sizeof(char):
- data_length++;
- break;
- case sizeof(short):
- data_length = SHORTALIGN(data_length + sizeof(short));
- break;
- case sizeof(int32):
- data_length = INTALIGN(data_length + sizeof(int32));
- break;
- default:
- if (att[i]->attlen < sizeof(int32))
- elog(WARN, "ComputeDataSize: attribute %d has len %d",
- i, att[i]->attlen);
- if (att[i]->attalign == 'd')
- data_length = DOUBLEALIGN(data_length) + att[i]->attlen;
- else
- data_length = LONGALIGN(data_length) + att[i]->attlen;
- break;
+ /*
+ * This is the size of the disk representation and so must
+ * include the additional sizeof long.
+ */
+ if (att[i]->attalign == 'd')
+ {
+ data_length = DOUBLEALIGN(data_length)
+ + VARSIZE(DatumGetPointer(value[i]));
+ }
+ else
+ {
+ data_length = INTALIGN(data_length)
+ + VARSIZE(DatumGetPointer(value[i]));
+ }
+ break;
+ case sizeof(char):
+ data_length++;
+ break;
+ case sizeof(short):
+ data_length = SHORTALIGN(data_length + sizeof(short));
+ break;
+ case sizeof(int32):
+ data_length = INTALIGN(data_length + sizeof(int32));
+ break;
+ default:
+ if (att[i]->attlen < sizeof(int32))
+ elog(WARN, "ComputeDataSize: attribute %d has len %d",
+ i, att[i]->attlen);
+ if (att[i]->attalign == 'd')
+ data_length = DOUBLEALIGN(data_length) + att[i]->attlen;
+ else
+ data_length = LONGALIGN(data_length) + att[i]->attlen;
+ break;
}
}
@@ -118,11 +118,11 @@ DataFill(char *data,
char *infomask,
bits8 * bit)
{
- bits8 *bitP = 0;
- int bitmask = 0;
- uint32 data_length;
- int i;
- int numberOfAttributes = tupleDesc->natts;
+ bits8 *bitP = 0;
+ int bitmask = 0;
+ uint32 data_length;
+ int i;
+ int numberOfAttributes = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs;
if (bit != NULL)
@@ -159,58 +159,58 @@ DataFill(char *data,
switch (att[i]->attlen)
{
- case -1:
- *infomask |= HEAP_HASVARLENA;
- if (att[i]->attalign == 'd')
- {
- data = (char *) DOUBLEALIGN(data);
- }
- else
- {
+ case -1:
+ *infomask |= HEAP_HASVARLENA;
+ if (att[i]->attalign == 'd')
+ {
+ data = (char *) DOUBLEALIGN(data);
+ }
+ else
+ {
+ data = (char *) INTALIGN(data);
+ }
+ data_length = VARSIZE(DatumGetPointer(value[i]));
+ memmove(data, DatumGetPointer(value[i]), data_length);
+ data += data_length;
+ break;
+ case sizeof(char):
+ *data = att[i]->attbyval ?
+ DatumGetChar(value[i]) : *((char *) value[i]);
+ data += sizeof(char);
+ break;
+ case sizeof(int16):
+ data = (char *) SHORTALIGN(data);
+ *(short *) data = (att[i]->attbyval ?
+ DatumGetInt16(value[i]) :
+ *((short *) value[i]));
+ data += sizeof(short);
+ break;
+ case sizeof(int32):
data = (char *) INTALIGN(data);
- }
- data_length = VARSIZE(DatumGetPointer(value[i]));
- memmove(data, DatumGetPointer(value[i]), data_length);
- data += data_length;
- break;
- case sizeof(char):
- *data = att[i]->attbyval ?
- DatumGetChar(value[i]) : *((char *) value[i]);
- data += sizeof(char);
- break;
- case sizeof(int16):
- data = (char *) SHORTALIGN(data);
- *(short *) data = (att[i]->attbyval ?
- DatumGetInt16(value[i]) :
- *((short *) value[i]));
- data += sizeof(short);
- break;
- case sizeof(int32):
- data = (char *) INTALIGN(data);
- *(int32 *) data = (att[i]->attbyval ?
- DatumGetInt32(value[i]) :
- *((int32 *) value[i]));
- data += sizeof(int32);
- break;
- default:
- if (att[i]->attlen < sizeof(int32))
- elog(WARN, "DataFill: attribute %d has len %d",
- i, att[i]->attlen);
- if (att[i]->attalign == 'd')
- {
- data = (char *) DOUBLEALIGN(data);
- memmove(data, DatumGetPointer(value[i]),
- att[i]->attlen);
- data += att[i]->attlen;
- }
- else
- {
- data = (char *) LONGALIGN(data);
- memmove(data, DatumGetPointer(value[i]),
- att[i]->attlen);
- data += att[i]->attlen;
- }
- break;
+ *(int32 *) data = (att[i]->attbyval ?
+ DatumGetInt32(value[i]) :
+ *((int32 *) value[i]));
+ data += sizeof(int32);
+ break;
+ default:
+ if (att[i]->attlen < sizeof(int32))
+ elog(WARN, "DataFill: attribute %d has len %d",
+ i, att[i]->attlen);
+ if (att[i]->attalign == 'd')
+ {
+ data = (char *) DOUBLEALIGN(data);
+ memmove(data, DatumGetPointer(value[i]),
+ att[i]->attlen);
+ data += att[i]->attlen;
+ }
+ else
+ {
+ data = (char *) LONGALIGN(data);
+ memmove(data, DatumGetPointer(value[i]),
+ att[i]->attlen);
+ data += att[i]->attlen;
+ }
+ break;
}
}
}
@@ -240,24 +240,24 @@ heap_attisnull(HeapTuple tup, int attnum)
else
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
- case ObjectIdAttributeNumber:
- case MinTransactionIdAttributeNumber:
- case MinCommandIdAttributeNumber:
- case MaxTransactionIdAttributeNumber:
- case MaxCommandIdAttributeNumber:
- case ChainItemPointerAttributeNumber:
- case AnchorItemPointerAttributeNumber:
- case MinAbsoluteTimeAttributeNumber:
- case MaxAbsoluteTimeAttributeNumber:
- case VersionTypeAttributeNumber:
- break;
+ case SelfItemPointerAttributeNumber:
+ case ObjectIdAttributeNumber:
+ case MinTransactionIdAttributeNumber:
+ case MinCommandIdAttributeNumber:
+ case MaxTransactionIdAttributeNumber:
+ case MaxCommandIdAttributeNumber:
+ case ChainItemPointerAttributeNumber:
+ case AnchorItemPointerAttributeNumber:
+ case MinAbsoluteTimeAttributeNumber:
+ case MaxAbsoluteTimeAttributeNumber:
+ case VersionTypeAttributeNumber:
+ break;
- case 0:
- elog(WARN, "heap_attisnull: zero attnum disallowed");
+ case 0:
+ elog(WARN, "heap_attisnull: zero attnum disallowed");
- default:
- elog(WARN, "heap_attisnull: undefined negative attnum");
+ default:
+ elog(WARN, "heap_attisnull: undefined negative attnum");
}
return (0);
@@ -277,38 +277,38 @@ heap_attisnull(HeapTuple tup, int attnum)
int
heap_sysattrlen(AttrNumber attno)
{
- HeapTupleData *f = NULL;
+ HeapTupleData *f = NULL;
switch (attno)
{
- case SelfItemPointerAttributeNumber:
- return sizeof f->t_ctid;
- case ObjectIdAttributeNumber:
- return sizeof f->t_oid;
- case MinTransactionIdAttributeNumber:
- return sizeof f->t_xmin;
- case MinCommandIdAttributeNumber:
- return sizeof f->t_cmin;
- case MaxTransactionIdAttributeNumber:
- return sizeof f->t_xmax;
- case MaxCommandIdAttributeNumber:
- return sizeof f->t_cmax;
- case ChainItemPointerAttributeNumber:
- return sizeof f->t_chain;
- case MinAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmin;
- case MaxAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmax;
- case VersionTypeAttributeNumber:
- return sizeof f->t_vtype;
-
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
- return 0;
-
- default:
- elog(WARN, "sysattrlen: System attribute number %d unknown.", attno);
- return 0;
+ case SelfItemPointerAttributeNumber:
+ return sizeof f->t_ctid;
+ case ObjectIdAttributeNumber:
+ return sizeof f->t_oid;
+ case MinTransactionIdAttributeNumber:
+ return sizeof f->t_xmin;
+ case MinCommandIdAttributeNumber:
+ return sizeof f->t_cmin;
+ case MaxTransactionIdAttributeNumber:
+ return sizeof f->t_xmax;
+ case MaxCommandIdAttributeNumber:
+ return sizeof f->t_cmax;
+ case ChainItemPointerAttributeNumber:
+ return sizeof f->t_chain;
+ case MinAbsoluteTimeAttributeNumber:
+ return sizeof f->t_tmin;
+ case MaxAbsoluteTimeAttributeNumber:
+ return sizeof f->t_tmax;
+ case VersionTypeAttributeNumber:
+ return sizeof f->t_vtype;
+
+ case AnchorItemPointerAttributeNumber:
+ elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
+ return 0;
+
+ default:
+ elog(WARN, "sysattrlen: System attribute number %d unknown.", attno);
+ return 0;
}
}
@@ -321,48 +321,48 @@ heap_sysattrlen(AttrNumber attno)
bool
heap_sysattrbyval(AttrNumber attno)
{
- bool byval;
+ bool byval;
switch (attno)
{
- case SelfItemPointerAttributeNumber:
- byval = false;
- break;
- case ObjectIdAttributeNumber:
- byval = true;
- break;
- case MinTransactionIdAttributeNumber:
- byval = true;
- break;
- case MinCommandIdAttributeNumber:
- byval = true;
- break;
- case MaxTransactionIdAttributeNumber:
- byval = true;
- break;
- case MaxCommandIdAttributeNumber:
- byval = true;
- break;
- case ChainItemPointerAttributeNumber:
- byval = false;
- break;
- case AnchorItemPointerAttributeNumber:
- byval = false;
- break;
- case MinAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case MaxAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case VersionTypeAttributeNumber:
- byval = true;
- break;
- default:
- byval = true;
- elog(WARN, "sysattrbyval: System attribute number %d unknown.",
- attno);
- break;
+ case SelfItemPointerAttributeNumber:
+ byval = false;
+ break;
+ case ObjectIdAttributeNumber:
+ byval = true;
+ break;
+ case MinTransactionIdAttributeNumber:
+ byval = true;
+ break;
+ case MinCommandIdAttributeNumber:
+ byval = true;
+ break;
+ case MaxTransactionIdAttributeNumber:
+ byval = true;
+ break;
+ case MaxCommandIdAttributeNumber:
+ byval = true;
+ break;
+ case ChainItemPointerAttributeNumber:
+ byval = false;
+ break;
+ case AnchorItemPointerAttributeNumber:
+ byval = false;
+ break;
+ case MinAbsoluteTimeAttributeNumber:
+ byval = true;
+ break;
+ case MaxAbsoluteTimeAttributeNumber:
+ byval = true;
+ break;
+ case VersionTypeAttributeNumber:
+ byval = true;
+ break;
+ default:
+ byval = true;
+ elog(WARN, "sysattrbyval: System attribute number %d unknown.",
+ attno);
+ break;
}
return byval;
@@ -372,57 +372,57 @@ heap_sysattrbyval(AttrNumber attno)
* heap_getsysattr
* ----------------
*/
-char *
+char *
heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
- return ((char *) &tup->t_ctid);
- case ObjectIdAttributeNumber:
- return ((char *) (long) tup->t_oid);
- case MinTransactionIdAttributeNumber:
- return ((char *) (long) tup->t_xmin);
- case MinCommandIdAttributeNumber:
- return ((char *) (long) tup->t_cmin);
- case MaxTransactionIdAttributeNumber:
- return ((char *) (long) tup->t_xmax);
- case MaxCommandIdAttributeNumber:
- return ((char *) (long) tup->t_cmax);
- case ChainItemPointerAttributeNumber:
- return ((char *) &tup->t_chain);
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_getsysattr: t_anchor does not exist!");
- break;
+ case SelfItemPointerAttributeNumber:
+ return ((char *) &tup->t_ctid);
+ case ObjectIdAttributeNumber:
+ return ((char *) (long) tup->t_oid);
+ case MinTransactionIdAttributeNumber:
+ return ((char *) (long) tup->t_xmin);
+ case MinCommandIdAttributeNumber:
+ return ((char *) (long) tup->t_cmin);
+ case MaxTransactionIdAttributeNumber:
+ return ((char *) (long) tup->t_xmax);
+ case MaxCommandIdAttributeNumber:
+ return ((char *) (long) tup->t_cmax);
+ case ChainItemPointerAttributeNumber:
+ return ((char *) &tup->t_chain);
+ case AnchorItemPointerAttributeNumber:
+ elog(WARN, "heap_getsysattr: t_anchor does not exist!");
+ break;
- /*
- * For tmin and tmax, we need to do some extra work. These don't
- * get filled in until the vacuum cleaner runs (or we manage to
- * flush a page after setting the value correctly below). If the
- * vacuum cleaner hasn't run yet, then the times stored in the
- * tuple are wrong, and we need to look up the commit time of the
- * transaction. We cache this value in the tuple to avoid doing
- * the work more than once.
- */
+ /*
+ * For tmin and tmax, we need to do some extra work. These
+ * don't get filled in until the vacuum cleaner runs (or we
+ * manage to flush a page after setting the value correctly
+ * below). If the vacuum cleaner hasn't run yet, then the
+ * times stored in the tuple are wrong, and we need to look up
+ * the commit time of the transaction. We cache this value in
+ * the tuple to avoid doing the work more than once.
+ */
- case MinAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
- TransactionIdDidCommit(tup->t_xmin))
- tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
- return ((char *) (long) tup->t_tmin);
- case MaxAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
- {
- if (TransactionIdDidCommit(tup->t_xmax))
- tup->t_tmax = TransactionIdGetCommitTime(tup->t_xmax);
- else
- tup->t_tmax = CURRENT_ABSTIME;
- }
- return ((char *) (long) tup->t_tmax);
- case VersionTypeAttributeNumber:
- return ((char *) (long) tup->t_vtype);
- default:
- elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
+ case MinAbsoluteTimeAttributeNumber:
+ if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
+ TransactionIdDidCommit(tup->t_xmin))
+ tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
+ return ((char *) (long) tup->t_tmin);
+ case MaxAbsoluteTimeAttributeNumber:
+ if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
+ {
+ if (TransactionIdDidCommit(tup->t_xmax))
+ tup->t_tmax = TransactionIdGetCommitTime(tup->t_xmax);
+ else
+ tup->t_tmax = CURRENT_ABSTIME;
+ }
+ return ((char *) (long) tup->t_tmax);
+ case VersionTypeAttributeNumber:
+ return ((char *) (long) tup->t_vtype);
+ default:
+ elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
}
return (NULL);
}
@@ -444,15 +444,15 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
* the same attribute descriptor will go much quicker. -cim 5/4/91
* ----------------
*/
-char *
+char *
fastgetattr(HeapTuple tup,
int attnum,
TupleDesc tupleDesc,
bool * isnull)
{
- char *tp; /* ptr to att in tuple */
- bits8 *bp = NULL; /* ptr to att in tuple */
- int slow; /* do we have to walk nulls? */
+ char *tp; /* ptr to att in tuple */
+ bits8 *bp = NULL; /* ptr to att in tuple */
+ int slow; /* do we have to walk nulls? */
AttributeTupleForm *att = tupleDesc->attrs;
/* ----------------
@@ -526,7 +526,7 @@ fastgetattr(HeapTuple tup,
*/
{
- register int i = 0; /* current offset in bp */
+ register int i = 0; /* current offset in bp */
for (i = 0; i < attnum && !slow; i++)
{
@@ -554,7 +554,7 @@ fastgetattr(HeapTuple tup,
}
else if (!HeapTupleAllFixed(tup))
{
- register int j = 0;
+ register int j = 0;
for (j = 0; j < attnum && !slow; j++)
if (att[j]->attlen < 1)
@@ -569,8 +569,8 @@ fastgetattr(HeapTuple tup,
*/
if (!slow)
{
- register int j = 1;
- register long off;
+ register int j = 1;
+ register long off;
/*
* need to set cache for some atts
@@ -587,30 +587,30 @@ fastgetattr(HeapTuple tup,
{
switch (att[j]->attlen)
{
- case -1:
- off = (att[j]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[j]->attlen < sizeof(int32))
- {
- elog(WARN,
- "fastgetattr: attribute %d has len %d",
- j, att[j]->attlen);
- }
- if (att[j]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
+ case -1:
+ off = (att[j]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[j]->attlen < sizeof(int32))
+ {
+ elog(WARN,
+ "fastgetattr: attribute %d has len %d",
+ j, att[j]->attlen);
+ }
+ if (att[j]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
+ break;
}
att[j]->attcacheoff = off;
@@ -622,9 +622,9 @@ fastgetattr(HeapTuple tup,
}
else
{
- register bool usecache = true;
- register int off = 0;
- register int i;
+ register bool usecache = true;
+ register int off = 0;
+ register int i;
/*
* Now we know that we have to walk the tuple CAREFULLY.
@@ -648,28 +648,28 @@ fastgetattr(HeapTuple tup,
}
switch (att[i]->attlen)
{
- case -1:
- off = (att[i]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[i]->attlen < sizeof(int32))
- elog(WARN,
- "fastgetattr2: attribute %d has len %d",
- i, att[i]->attlen);
- if (att[i]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
+ case -1:
+ off = (att[i]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[i]->attlen < sizeof(int32))
+ elog(WARN,
+ "fastgetattr2: attribute %d has len %d",
+ i, att[i]->attlen);
+ if (att[i]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
+ break;
}
if (usecache && att[i]->attcacheoff > 0)
{
@@ -687,47 +687,47 @@ fastgetattr(HeapTuple tup,
switch (att[i]->attlen)
{
+ case sizeof(char):
+ off++;
+ break;
+ case sizeof(int16):
+ off += sizeof(int16);
+ break;
+ case sizeof(int32):
+ off += sizeof(int32);
+ break;
+ case -1:
+ usecache = false;
+ off += VARSIZE(tp + off);
+ break;
+ default:
+ off += att[i]->attlen;
+ break;
+ }
+ }
+ switch (att[attnum]->attlen)
+ {
+ case -1:
+ off = (att[attnum]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
case sizeof(char):
- off++;
break;
- case sizeof(int16):
- off += sizeof(int16);
+ case sizeof(short):
+ off = SHORTALIGN(off);
break;
case sizeof(int32):
- off += sizeof(int32);
- break;
- case -1:
- usecache = false;
- off += VARSIZE(tp + off);
+ off = INTALIGN(off);
break;
default:
- off += att[i]->attlen;
+ if (att[attnum]->attlen < sizeof(int32))
+ elog(WARN, "fastgetattr3: attribute %d has len %d",
+ attnum, att[attnum]->attlen);
+ if (att[attnum]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
break;
- }
- }
- switch (att[attnum]->attlen)
- {
- case -1:
- off = (att[attnum]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[attnum]->attlen < sizeof(int32))
- elog(WARN, "fastgetattr3: attribute %d has len %d",
- attnum, att[attnum]->attlen);
- if (att[attnum]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
}
return ((char *) fetchatt(&(att[attnum]), tp + off));
}
@@ -742,7 +742,7 @@ fastgetattr(HeapTuple tup,
HeapTuple
heap_copytuple(HeapTuple tuple)
{
- HeapTuple newTuple;
+ HeapTuple newTuple;
if (!HeapTupleIsValid(tuple))
return (NULL);
@@ -772,15 +772,15 @@ heap_deformtuple(HeapTuple tuple,
Datum values[],
char nulls[])
{
- int i;
- int natts;
+ int i;
+ int natts;
Assert(HeapTupleIsValid(tuple));
natts = tuple->t_natts;
for (i = 0; i < natts; i++)
{
- bool isnull;
+ bool isnull;
values[i] = (Datum) heap_getattr(tuple,
InvalidBuffer,
@@ -819,14 +819,14 @@ heap_formtuple(TupleDesc tupleDescriptor,
Datum value[],
char nulls[])
{
- char *tp; /* tuple pointer */
- HeapTuple tuple; /* return tuple */
- int bitmaplen;
- long len;
- int hoff;
- bool hasnull = false;
- int i;
- int numberOfAttributes = tupleDescriptor->natts;
+ char *tp; /* tuple pointer */
+ HeapTuple tuple; /* return tuple */
+ int bitmaplen;
+ long len;
+ int hoff;
+ bool hasnull = false;
+ int i;
+ int numberOfAttributes = tupleDescriptor->natts;
len = sizeof *tuple - sizeof tuple->t_bits;
@@ -885,14 +885,14 @@ heap_modifytuple(HeapTuple tuple,
char replNull[],
char repl[])
{
- int attoff;
- int numberOfAttributes;
- Datum *value;
- char *nulls;
- bool isNull;
- HeapTuple newTuple;
- int madecopy;
- uint8 infomask;
+ int attoff;
+ int numberOfAttributes;
+ Datum *value;
+ char *nulls;
+ bool isNull;
+ HeapTuple newTuple;
+ int madecopy;
+ uint8 infomask;
/* ----------------
* sanity checks
@@ -936,7 +936,7 @@ heap_modifytuple(HeapTuple tuple,
if (repl[attoff] == ' ')
{
- char *attr;
+ char *attr;
attr =
heap_getattr(tuple,
@@ -1001,10 +1001,10 @@ heap_addheader(uint32 natts, /* max domain index */
int structlen, /* its length */
char *structure) /* pointer to the struct */
{
- register char *tp; /* tuple data pointer */
- HeapTuple tup;
- long len;
- int hoff;
+ register char *tp; /* tuple data pointer */
+ HeapTuple tup;
+ long len;
+ int hoff;
AssertArg(natts > 0);
diff --git a/src/backend/access/common/heapvalid.c b/src/backend/access/common/heapvalid.c
index 0caeb54e17c..ce0cb58d7dc 100644
--- a/src/backend/access/common/heapvalid.c
+++ b/src/backend/access/common/heapvalid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.17 1997/09/07 04:37:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.18 1997/09/08 02:19:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,9 +36,9 @@ heap_keytest(HeapTuple t,
int nkeys,
ScanKey keys)
{
- bool isnull;
- Datum atp;
- int test;
+ bool isnull;
+ Datum atp;
+ int test;
for (; nkeys--; keys++)
{
@@ -101,11 +101,11 @@ heap_tuple_satisfies(ItemId itemId,
int nKeys,
ScanKey key)
{
- HeapTuple tuple,
- result;
- bool res;
- TransactionId old_tmin,
- old_tmax;
+ HeapTuple tuple,
+ result;
+ bool res;
+ TransactionId old_tmin,
+ old_tmax;
if (!ItemIdIsUsed(itemId))
return NULL;
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index c133693801b..e0a6e2ba5ca 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.16 1997/09/07 04:37:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.17 1997/09/08 02:19:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,8 +26,8 @@
#include <string.h>
#endif
-static Size IndexInfoFindDataOffset(unsigned short t_info);
-static char *
+static Size IndexInfoFindDataOffset(unsigned short t_info);
+static char *
fastgetiattr(IndexTuple tup, int attnum,
TupleDesc att, bool * isnull);
@@ -45,15 +45,15 @@ index_formtuple(TupleDesc tupleDescriptor,
Datum value[],
char null[])
{
- register char *tp; /* tuple pointer */
- IndexTuple tuple; /* return tuple */
- Size size,
- hoff;
- int i;
- unsigned short infomask = 0;
- bool hasnull = false;
- char tupmask = 0;
- int numberOfAttributes = tupleDescriptor->natts;
+ register char *tp; /* tuple pointer */
+ IndexTuple tuple; /* return tuple */
+ Size size,
+ hoff;
+ int i;
+ unsigned short infomask = 0;
+ bool hasnull = false;
+ char tupmask = 0;
+ int numberOfAttributes = tupleDescriptor->natts;
if (numberOfAttributes > MaxIndexAttributeNumber)
elog(WARN, "index_formtuple: numberOfAttributes of %d > %d",
@@ -133,16 +133,16 @@ index_formtuple(TupleDesc tupleDescriptor,
* the same attribute descriptor will go much quicker. -cim 5/4/91
* ----------------
*/
-static char *
+static char *
fastgetiattr(IndexTuple tup,
int attnum,
TupleDesc tupleDesc,
bool * isnull)
{
- register char *tp; /* ptr to att in tuple */
- register char *bp = NULL; /* ptr to att in tuple */
- int slow; /* do we have to walk nulls? */
- register int data_off; /* tuple data offset */
+ register char *tp; /* ptr to att in tuple */
+ register char *bp = NULL; /* ptr to att in tuple */
+ int slow; /* do we have to walk nulls? */
+ register int data_off; /* tuple data offset */
AttributeTupleForm *att = tupleDesc->attrs;
/* ----------------
@@ -212,11 +212,11 @@ fastgetiattr(IndexTuple tup,
* ----------------
*/
{
- register int i = 0; /* current offset in bp */
- register int mask; /* bit in byte we're looking at */
- register char n; /* current byte in bp */
- register int byte,
- finalbit;
+ register int i = 0; /* current offset in bp */
+ register int mask; /* bit in byte we're looking at */
+ register char n; /* current byte in bp */
+ register int byte,
+ finalbit;
byte = attnum >> 3;
finalbit = attnum & 0x07;
@@ -256,7 +256,7 @@ fastgetiattr(IndexTuple tup,
}
else if (!IndexTupleAllFixed(tup))
{
- register int j = 0;
+ register int j = 0;
for (j = 0; j < attnum && !slow; j++)
if (att[j]->attlen < 1)
@@ -272,8 +272,8 @@ fastgetiattr(IndexTuple tup,
if (!slow)
{
- register int j = 1;
- register long off;
+ register int j = 1;
+ register long off;
/*
* need to set cache for some atts
@@ -297,26 +297,26 @@ fastgetiattr(IndexTuple tup,
switch (att[j]->attlen)
{
- case -1:
- off = (att[j]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[j]->attlen > sizeof(int32))
+ case -1:
off = (att[j]->attalign == 'd') ?
- DOUBLEALIGN(off) : LONGALIGN(off);
- else
- elog(WARN, "fastgetiattr: attribute %d has len %d",
- j, att[j]->attlen);
- break;
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[j]->attlen > sizeof(int32))
+ off = (att[j]->attalign == 'd') ?
+ DOUBLEALIGN(off) : LONGALIGN(off);
+ else
+ elog(WARN, "fastgetiattr: attribute %d has len %d",
+ j, att[j]->attlen);
+ break;
}
@@ -329,9 +329,9 @@ fastgetiattr(IndexTuple tup,
}
else
{
- register bool usecache = true;
- register int off = 0;
- register int i;
+ register bool usecache = true;
+ register int off = 0;
+ register int i;
/*
* Now we know that we have to walk the tuple CAREFULLY.
@@ -361,31 +361,31 @@ fastgetiattr(IndexTuple tup,
att[i]->attcacheoff = off;
switch (att[i]->attlen)
{
- case sizeof(char):
- off++;
- break;
- case sizeof(short):
- off = SHORTALIGN(off) +sizeof(short);
- break;
- case sizeof(int32):
- off = INTALIGN(off) + sizeof(int32);
- break;
- case -1:
- usecache = false;
- off = (att[i]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- off += VARSIZE(tp + off);
- break;
- default:
- if (att[i]->attlen > sizeof(int32))
+ case sizeof(char):
+ off++;
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off) +sizeof(short);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off) + sizeof(int32);
+ break;
+ case -1:
+ usecache = false;
off = (att[i]->attalign == 'd') ?
- DOUBLEALIGN(off) + att[i]->attlen :
- LONGALIGN(off) + att[i]->attlen;
- else
- elog(WARN, "fastgetiattr2: attribute %d has len %d",
- i, att[i]->attlen);
-
- break;
+ DOUBLEALIGN(off) : INTALIGN(off);
+ off += VARSIZE(tp + off);
+ break;
+ default:
+ if (att[i]->attlen > sizeof(int32))
+ off = (att[i]->attalign == 'd') ?
+ DOUBLEALIGN(off) + att[i]->attlen :
+ LONGALIGN(off) + att[i]->attlen;
+ else
+ elog(WARN, "fastgetiattr2: attribute %d has len %d",
+ i, att[i]->attlen);
+
+ break;
}
}
@@ -395,27 +395,27 @@ fastgetiattr(IndexTuple tup,
*/
switch (att[attnum]->attlen)
{
- case -1:
- off = (att[attnum]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[attnum]->attlen < sizeof(int32))
- elog(WARN, "fastgetattr3: attribute %d has len %d",
- attnum, att[attnum]->attlen);
- if (att[attnum]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
+ case -1:
+ off = (att[attnum]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[attnum]->attlen < sizeof(int32))
+ elog(WARN, "fastgetattr3: attribute %d has len %d",
+ attnum, att[attnum]->attlen);
+ if (att[attnum]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
+ break;
}
return (fetchatt(&att[attnum], tp + off));
@@ -461,14 +461,14 @@ FormRetrieveIndexResult(ItemPointer indexItemPointer,
*
* Change me if adding an attribute to IndexTuples!!!!!!!!!!!
*/
-static Size
+static Size
IndexInfoFindDataOffset(unsigned short t_info)
{
if (!(t_info & INDEX_NULL_MASK))
return ((Size) sizeof(IndexTupleData));
else
{
- Size size = sizeof(IndexTupleData);
+ Size size = sizeof(IndexTupleData);
if (t_info & INDEX_NULL_MASK)
{
@@ -485,8 +485,8 @@ IndexInfoFindDataOffset(unsigned short t_info)
void
CopyIndexTuple(IndexTuple source, IndexTuple * target)
{
- Size size;
- IndexTuple ret;
+ Size size;
+ IndexTuple ret;
size = IndexTupleSize(source);
if (*target == NULL)
diff --git a/src/backend/access/common/indexvalid.c b/src/backend/access/common/indexvalid.c
index 9f8501beb2e..5a9f351568c 100644
--- a/src/backend/access/common/indexvalid.c
+++ b/src/backend/access/common/indexvalid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.15 1997/09/07 04:37:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.16 1997/09/08 02:19:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
* index scan key qualification code
* ----------------------------------------------------------------
*/
-int NIndexTupleProcessed;
+int NIndexTupleProcessed;
/* ----------------
* index_keytest
@@ -40,9 +40,9 @@ index_keytest(IndexTuple tuple,
int scanKeySize,
ScanKey key)
{
- bool isNull;
- Datum datum;
- int test;
+ bool isNull;
+ Datum datum;
+ int test;
IncrIndexProcessed();
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 599ac59a455..f8ff685e387 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.16 1997/09/07 04:37:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.17 1997/09/08 02:19:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
Oid
typtoout(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -52,7 +52,7 @@ typtoout(Oid type)
Oid
gettypelem(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -73,13 +73,13 @@ gettypelem(Oid type)
void
printtup(HeapTuple tuple, TupleDesc typeinfo)
{
- int i,
- j,
- k;
- char *outputstr,
- *attr;
- bool isnull;
- Oid typoutput;
+ int i,
+ j,
+ k;
+ char *outputstr,
+ *attr;
+ bool isnull;
+ Oid typoutput;
/* ----------------
* tell the frontend to expect new tuple data
@@ -158,8 +158,8 @@ printatt(unsigned attributeId,
void
showatts(char *name, TupleDesc tupleDesc)
{
- int i;
- int natts = tupleDesc->natts;
+ int i;
+ int natts = tupleDesc->natts;
AttributeTupleForm *attinfo = tupleDesc->attrs;
puts(name);
@@ -175,11 +175,11 @@ showatts(char *name, TupleDesc tupleDesc)
void
debugtup(HeapTuple tuple, TupleDesc typeinfo)
{
- register int i;
- char *attr,
- *value;
- bool isnull;
- Oid typoutput;
+ register int i;
+ char *attr,
+ *value;
+ bool isnull;
+ Oid typoutput;
for (i = 0; i < tuple->t_natts; ++i)
{
@@ -209,11 +209,11 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
void
printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
{
- int i,
- j,
- k;
- char *attr;
- bool isnull;
+ int i,
+ j,
+ k;
+ char *attr;
+ bool isnull;
/* ----------------
* tell the frontend to expect new tuple data
@@ -254,7 +254,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
#endif
for (i = 0; i < tuple->t_natts; ++i)
{
- int32 len = typeinfo->attrs[i]->attlen;
+ int32 len = typeinfo->attrs[i]->attlen;
attr = heap_getattr(tuple, InvalidBuffer, i + 1, typeinfo, &isnull);
if (!isnull)
@@ -269,7 +269,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
pq_putnchar(VARDATA(attr), len);
#ifdef IPORTAL_DEBUG
{
- char *d = VARDATA(attr);
+ char *d = VARDATA(attr);
fprintf(stderr, "length %d data %x%x%x%x\n",
len, *d, *(d + 1), *(d + 2), *(d + 3));
@@ -281,25 +281,25 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
/* fixed size */
if (typeinfo->attrs[i]->attbyval)
{
- int8 i8;
- int16 i16;
- int32 i32;
+ int8 i8;
+ int16 i16;
+ int32 i32;
pq_putint(len, sizeof(int32));
switch (len)
{
- case sizeof(int8):
- i8 = DatumGetChar(attr);
- pq_putnchar((char *) &i8, len);
- break;
- case sizeof(int16):
- i16 = DatumGetInt16(attr);
- pq_putnchar((char *) &i16, len);
- break;
- case sizeof(int32):
- i32 = DatumGetInt32(attr);
- pq_putnchar((char *) &i32, len);
- break;
+ case sizeof(int8):
+ i8 = DatumGetChar(attr);
+ pq_putnchar((char *) &i8, len);
+ break;
+ case sizeof(int16):
+ i16 = DatumGetInt16(attr);
+ pq_putnchar((char *) &i16, len);
+ break;
+ case sizeof(int32):
+ i32 = DatumGetInt32(attr);
+ pq_putnchar((char *) &i32, len);
+ break;
}
#ifdef IPORTAL_DEBUG
fprintf(stderr, "byval length %d data %d\n", len, attr);
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index e616702a8ea..d4b5e893bdd 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.20 1997/09/07 04:37:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.21 1997/09/08 02:19:56 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -42,8 +42,8 @@
TupleDesc
CreateTemplateTupleDesc(int natts)
{
- uint32 size;
- TupleDesc desc;
+ uint32 size;
+ TupleDesc desc;
/* ----------------
* sanity checks
@@ -77,7 +77,7 @@ CreateTemplateTupleDesc(int natts)
TupleDesc
CreateTupleDesc(int natts, AttributeTupleForm * attrs)
{
- TupleDesc desc;
+ TupleDesc desc;
/* ----------------
* sanity checks
@@ -105,9 +105,9 @@ CreateTupleDesc(int natts, AttributeTupleForm * attrs)
TupleDesc
CreateTupleDescCopy(TupleDesc tupdesc)
{
- TupleDesc desc;
- int i,
- size;
+ TupleDesc desc;
+ int i,
+ size;
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts;
@@ -139,10 +139,10 @@ CreateTupleDescCopy(TupleDesc tupdesc)
TupleDesc
CreateTupleDescCopyConstr(TupleDesc tupdesc)
{
- TupleDesc desc;
- TupleConstr *constr = tupdesc->constr;
- int i,
- size;
+ TupleDesc desc;
+ TupleConstr *constr = tupdesc->constr;
+ int i,
+ size;
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts;
@@ -158,7 +158,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
}
if (constr)
{
- TupleConstr *cpy = (TupleConstr *) palloc(sizeof(TupleConstr));
+ TupleConstr *cpy = (TupleConstr *) palloc(sizeof(TupleConstr));
cpy->has_not_null = constr->has_not_null;
@@ -201,7 +201,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
void
FreeTupleDesc(TupleDesc tupdesc)
{
- int i;
+ int i;
for (i = 0; i < tupdesc->natts; i++)
pfree(tupdesc->attrs[i]);
@@ -210,7 +210,7 @@ FreeTupleDesc(TupleDesc tupdesc)
{
if (tupdesc->constr->num_defval > 0)
{
- AttrDefault *attrdef = tupdesc->constr->defval;
+ AttrDefault *attrdef = tupdesc->constr->defval;
for (i = tupdesc->constr->num_defval - 1; i >= 0; i--)
{
@@ -223,7 +223,7 @@ FreeTupleDesc(TupleDesc tupdesc)
}
if (tupdesc->constr->num_check > 0)
{
- ConstrCheck *check = tupdesc->constr->check;
+ ConstrCheck *check = tupdesc->constr->check;
for (i = tupdesc->constr->num_check - 1; i >= 0; i--)
{
@@ -258,8 +258,8 @@ TupleDescInitEntry(TupleDesc desc,
int attdim,
bool attisset)
{
- HeapTuple tuple;
- TypeTupleForm typeForm;
+ HeapTuple tuple;
+ TypeTupleForm typeForm;
AttributeTupleForm att;
/* ----------------
@@ -378,7 +378,7 @@ TupleDescInitEntry(TupleDesc desc,
*/
if (attisset)
{
- Type t = type("oid");
+ Type t = type("oid");
att->attlen = tlen(t);
att->attbyval = tbyval(t);
@@ -411,7 +411,7 @@ TupleDescMakeSelfReference(TupleDesc desc,
char *relname)
{
AttributeTupleForm att;
- Type t = type("oid");
+ Type t = type("oid");
att = desc->attrs[attnum - 1];
att->atttypid = TypeShellMake(relname);
@@ -439,17 +439,17 @@ TupleDescMakeSelfReference(TupleDesc desc,
TupleDesc
BuildDescForRelation(List * schema, char *relname)
{
- int natts;
- AttrNumber attnum;
- List *p;
- TupleDesc desc;
- AttrDefault *attrdef = NULL;
- TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
- char *attname;
- char *typename;
- int attdim;
- int ndef = 0;
- bool attisset;
+ int natts;
+ AttrNumber attnum;
+ List *p;
+ TupleDesc desc;
+ AttrDefault *attrdef = NULL;
+ TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
+ char *attname;
+ char *typename;
+ int attdim;
+ int ndef = 0;
+ bool attisset;
/* ----------------
* allocate a new tuple descriptor
@@ -465,8 +465,8 @@ BuildDescForRelation(List * schema, char *relname)
foreach(p, schema)
{
- ColumnDef *entry;
- List *arry;
+ ColumnDef *entry;
+ List *arry;
/* ----------------
* for each entry in the list, get the name and type
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 598f9ed8f02..d12e4e5c6ea 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -55,7 +55,7 @@ gistSplit(Relation r, Buffer buffer,
static void
gistnewroot(GISTSTATE * giststate, Relation r, IndexTuple lt,
IndexTuple rt);
-static void GISTInitBuffer(Buffer b, uint32 f);
+static void GISTInitBuffer(Buffer b, uint32 f);
static BlockNumber
gistChooseSubtree(Relation r, IndexTuple itup, int level,
GISTSTATE * giststate,
@@ -63,13 +63,13 @@ gistChooseSubtree(Relation r, IndexTuple itup, int level,
static OffsetNumber
gistchoose(Relation r, Page p, IndexTuple it,
GISTSTATE * giststate);
-static int gistnospace(Page p, IndexTuple it);
-void gistdelete(Relation r, ItemPointer tid);
+static int gistnospace(Page p, IndexTuple it);
+void gistdelete(Relation r, ItemPointer tid);
static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t);
static void
gistcentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr,
Relation r, Page pg, OffsetNumber o, int b, bool l);
-static char *int_range_out(INTRANGE * r);
+static char *int_range_out(INTRANGE * r);
/*
** routine to build an index. Basically calls insert over and over
@@ -85,33 +85,33 @@ gistbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc scan;
- Buffer buffer;
- AttrNumber i;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc hd,
- id;
+ HeapScanDesc scan;
+ Buffer buffer;
+ AttrNumber i;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc hd,
+ id;
InsertIndexResult res;
- Datum *d;
- bool *nulls;
- int nb,
- nh,
- ni;
+ Datum *d;
+ bool *nulls;
+ int nb,
+ nh,
+ ni;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
- GISTSTATE giststate;
- GISTENTRY tmpcentry;
- bool *compvec;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
+ GISTSTATE giststate;
+ GISTENTRY tmpcentry;
+ bool *compvec;
/* GiSTs only know how to do stupid locking now */
RelationSetLockForWrite(index);
@@ -220,8 +220,8 @@ gistbuild(Relation heap,
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -331,11 +331,11 @@ InsertIndexResult
gistinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
InsertIndexResult res;
- IndexTuple itup;
- GISTSTATE giststate;
- GISTENTRY tmpentry;
- int i;
- bool *compvec;
+ IndexTuple itup;
+ GISTSTATE giststate;
+ GISTENTRY tmpentry;
+ int i;
+ bool *compvec;
initGISTstate(&giststate, r);
@@ -373,7 +373,7 @@ gistinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation
** that knowledge (some compression routines may want to fish around
** on the page, for example, or do something special for leaf nodes.)
*/
-static OffsetNumber
+static OffsetNumber
gistPageAddItem(GISTSTATE * giststate,
Relation r,
Page page,
@@ -384,8 +384,8 @@ gistPageAddItem(GISTSTATE * giststate,
GISTENTRY * dentry,
IndexTuple * newtup)
{
- GISTENTRY tmpcentry;
- IndexTuple itup = (IndexTuple) item;
+ GISTENTRY tmpcentry;
+ IndexTuple itup = (IndexTuple) item;
/*
* recompress the item given that we now know the exact page and
@@ -408,20 +408,20 @@ gistPageAddItem(GISTSTATE * giststate,
}
-static InsertIndexResult
+static InsertIndexResult
gistdoinsert(Relation r,
IndexTuple itup, /* itup contains compressed entry */
GISTSTATE * giststate)
{
- GISTENTRY tmpdentry;
+ GISTENTRY tmpdentry;
InsertIndexResult res;
- OffsetNumber l;
- GISTSTACK *stack;
- Buffer buffer;
- BlockNumber blk;
- Page page;
- OffsetNumber off;
- IndexTuple newtup;
+ OffsetNumber l;
+ GISTSTACK *stack;
+ Buffer buffer;
+ BlockNumber blk;
+ Page page;
+ OffsetNumber off;
+ IndexTuple newtup;
/* 3rd arg is ignored for now */
blk = gistChooseSubtree(r, itup, 0, giststate, &stack, &buffer);
@@ -464,7 +464,7 @@ gistdoinsert(Relation r,
}
-static BlockNumber
+static BlockNumber
gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
* entry */
int level,
@@ -472,12 +472,12 @@ gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
GISTSTACK ** retstack /* out */ ,
Buffer * leafbuf /* out */ )
{
- Buffer buffer;
- BlockNumber blk;
- GISTSTACK *stack;
- Page page;
- GISTPageOpaque opaque;
- IndexTuple which;
+ Buffer buffer;
+ BlockNumber blk;
+ GISTSTACK *stack;
+ Page page;
+ GISTPageOpaque opaque;
+ IndexTuple which;
blk = GISTP_ROOT;
buffer = InvalidBuffer;
@@ -496,8 +496,8 @@ gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
opaque = (GISTPageOpaque) PageGetSpecialPointer(page);
if (!(opaque->flags & F_LEAF))
{
- GISTSTACK *n;
- ItemId iid;
+ GISTSTACK *n;
+ ItemId iid;
n = (GISTSTACK *) palloc(sizeof(GISTSTACK));
n->gs_parent = stack;
@@ -526,17 +526,17 @@ gistAdjustKeys(Relation r,
int att_size,
GISTSTATE * giststate)
{
- char *oldud;
- Page p;
- Buffer b;
- bool result;
- bytea *evec;
- GISTENTRY centry,
- *ev0p,
- *ev1p;
- int size,
- datumsize;
- IndexTuple tid;
+ char *oldud;
+ Page p;
+ Buffer b;
+ bool result;
+ bytea *evec;
+ GISTENTRY centry,
+ *ev0p,
+ *ev1p;
+ int size,
+ datumsize;
+ IndexTuple tid;
if (stk == (GISTSTACK *) NULL)
return;
@@ -570,7 +570,7 @@ gistAdjustKeys(Relation r,
(giststate->equalFn) (ev0p->pred, datum, &result);
if (!result)
{
- TupleDesc td = RelationGetTupleDescriptor(r);
+ TupleDesc td = RelationGetTupleDescriptor(r);
/* compress datum for storage on page */
gistcentryinit(giststate, &centry, datum, ev0p->rel, ev0p->page,
@@ -595,10 +595,10 @@ gistAdjustKeys(Relation r,
* delete the old entry and insert the new * one. Note that
* this may cause a split here!
*/
- IndexTuple newtup;
+ IndexTuple newtup;
ItemPointerData oldtid;
- char *isnull;
- TupleDesc tupDesc;
+ char *isnull;
+ TupleDesc tupDesc;
InsertIndexResult res;
/* delete old tuple */
@@ -641,41 +641,41 @@ gistAdjustKeys(Relation r,
* gistSplit -- split a page in the tree.
*
*/
-static InsertIndexResult
+static InsertIndexResult
gistSplit(Relation r,
Buffer buffer,
GISTSTACK * stack,
IndexTuple itup, /* contains compressed entry */
GISTSTATE * giststate)
{
- Page p;
- Buffer leftbuf,
- rightbuf;
- Page left,
- right;
- ItemId itemid;
- IndexTuple item;
- IndexTuple ltup,
- rtup,
- newtup;
- OffsetNumber maxoff;
- OffsetNumber i;
- OffsetNumber leftoff,
- rightoff;
- BlockNumber lbknum,
- rbknum;
- BlockNumber bufblock;
- GISTPageOpaque opaque;
- int blank;
+ Page p;
+ Buffer leftbuf,
+ rightbuf;
+ Page left,
+ right;
+ ItemId itemid;
+ IndexTuple item;
+ IndexTuple ltup,
+ rtup,
+ newtup;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ OffsetNumber leftoff,
+ rightoff;
+ BlockNumber lbknum,
+ rbknum;
+ BlockNumber bufblock;
+ GISTPageOpaque opaque;
+ int blank;
InsertIndexResult res;
- char *isnull;
- GIST_SPLITVEC v;
- TupleDesc tupDesc;
- bytea *entryvec;
- bool *decompvec;
- IndexTuple item_1;
- GISTENTRY tmpdentry,
- tmpentry;
+ char *isnull;
+ GIST_SPLITVEC v;
+ TupleDesc tupDesc;
+ bytea *entryvec;
+ bool *decompvec;
+ IndexTuple item_1;
+ GISTENTRY tmpdentry,
+ tmpentry;
isnull = (char *) palloc(r->rd_rel->relnatts);
for (blank = 0; blank < r->rd_rel->relnatts; blank++)
@@ -911,11 +911,11 @@ static void
gistentryinserttwo(Relation r, GISTSTACK * stk, IndexTuple ltup,
IndexTuple rtup, GISTSTATE * giststate)
{
- Buffer b;
- Page p;
+ Buffer b;
+ Page p;
InsertIndexResult res;
- GISTENTRY tmpentry;
- IndexTuple newtup;
+ GISTENTRY tmpentry;
+ IndexTuple newtup;
b = ReadBuffer(r, stk->gs_blk);
p = BufferGetPage(b);
@@ -949,16 +949,16 @@ gistentryinserttwo(Relation r, GISTSTACK * stk, IndexTuple ltup,
/*
** Insert an entry onto a page
*/
-static InsertIndexResult
+static InsertIndexResult
gistentryinsert(Relation r, GISTSTACK * stk, IndexTuple tup,
GISTSTATE * giststate)
{
- Buffer b;
- Page p;
+ Buffer b;
+ Page p;
InsertIndexResult res;
- OffsetNumber off;
- GISTENTRY tmpentry;
- IndexTuple newtup;
+ OffsetNumber off;
+ GISTENTRY tmpentry;
+ IndexTuple newtup;
b = ReadBuffer(r, stk->gs_blk);
p = BufferGetPage(b);
@@ -992,10 +992,10 @@ gistentryinsert(Relation r, GISTSTACK * stk, IndexTuple tup,
static void
gistnewroot(GISTSTATE * giststate, Relation r, IndexTuple lt, IndexTuple rt)
{
- Buffer b;
- Page p;
- GISTENTRY tmpentry;
- IndexTuple newtup;
+ Buffer b;
+ Page p;
+ GISTENTRY tmpentry;
+ IndexTuple newtup;
b = ReadBuffer(r, GISTP_ROOT);
GISTInitBuffer(b, 0);
@@ -1022,9 +1022,9 @@ gistnewroot(GISTSTATE * giststate, Relation r, IndexTuple lt, IndexTuple rt)
static void
GISTInitBuffer(Buffer b, uint32 f)
{
- GISTPageOpaque opaque;
- Page page;
- Size pageSize;
+ GISTPageOpaque opaque;
+ Page page;
+ Size pageSize;
pageSize = BufferGetPageSize(b);
@@ -1040,21 +1040,21 @@ GISTInitBuffer(Buffer b, uint32 f)
/*
** find entry with lowest penalty
*/
-static OffsetNumber
+static OffsetNumber
gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
GISTSTATE * giststate)
{
- OffsetNumber maxoff;
- OffsetNumber i;
- char *id;
- char *datum;
- float usize;
- OffsetNumber which;
- float which_grow;
- GISTENTRY entry,
- identry;
- int size,
- idsize;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ char *id;
+ char *datum;
+ float usize;
+ OffsetNumber which;
+ float which_grow;
+ GISTENTRY entry,
+ identry;
+ int size,
+ idsize;
idsize = IndexTupleSize(it) - sizeof(IndexTupleData);
id = ((char *) it) + sizeof(IndexTupleData);
@@ -1097,7 +1097,7 @@ gistnospace(Page p, IndexTuple it)
void
gistfreestack(GISTSTACK * s)
{
- GISTSTACK *p;
+ GISTSTACK *p;
while (s != (GISTSTACK *) NULL)
{
@@ -1114,10 +1114,10 @@ gistfreestack(GISTSTACK * s)
void
gistdelete(Relation r, ItemPointer tid)
{
- BlockNumber blkno;
- OffsetNumber offnum;
- Buffer buf;
- Page page;
+ BlockNumber blkno;
+ OffsetNumber offnum;
+ Buffer buf;
+ Page page;
/* must write-lock on delete */
RelationSetLockForWrite(r);
@@ -1142,17 +1142,17 @@ gistdelete(Relation r, ItemPointer tid)
void
initGISTstate(GISTSTATE * giststate, Relation index)
{
- RegProcedure consistent_proc,
- union_proc,
- compress_proc,
- decompress_proc;
- RegProcedure penalty_proc,
- picksplit_proc,
- equal_proc;
- func_ptr user_fn;
- int pronargs;
- HeapTuple htup;
- IndexTupleForm itupform;
+ RegProcedure consistent_proc,
+ union_proc,
+ compress_proc,
+ decompress_proc;
+ RegProcedure penalty_proc,
+ picksplit_proc,
+ equal_proc;
+ func_ptr user_fn;
+ int pronargs;
+ HeapTuple htup;
+ IndexTupleForm itupform;
consistent_proc = index_getprocid(index, 1, GIST_CONSISTENT_PROC);
union_proc = index_getprocid(index, 1, GIST_UNION_PROC);
@@ -1209,10 +1209,10 @@ initGISTstate(GISTSTATE * giststate, Relation index)
** the key with another key, which may involve generating a new IndexTuple
** if the sizes don't match
*/
-static IndexTuple
+static IndexTuple
gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
{
- char *datum = (((char *) t) + sizeof(IndexTupleData));
+ char *datum = (((char *) t) + sizeof(IndexTupleData));
/* if new entry fits in index tuple, copy it in */
if (entry.bytes < IndexTupleSize(t) - sizeof(IndexTupleData))
@@ -1228,10 +1228,10 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
else
{
/* generate a new index tuple for the compressed entry */
- TupleDesc tupDesc = r->rd_att;
- IndexTuple newtup;
- char *isnull;
- int blank;
+ TupleDesc tupDesc = r->rd_att;
+ IndexTuple newtup;
+ char *isnull;
+ int blank;
isnull = (char *) palloc(r->rd_rel->relnatts);
for (blank = 0; blank < r->rd_rel->relnatts; blank++)
@@ -1253,7 +1253,7 @@ void
gistdentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr, Relation r,
Page pg, OffsetNumber o, int b, bool l)
{
- GISTENTRY *dep;
+ GISTENTRY *dep;
gistentryinit(*e, pr, r, pg, o, b, l);
if (giststate->haskeytype)
@@ -1274,7 +1274,7 @@ static void
gistcentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr, Relation r,
Page pg, OffsetNumber o, int b, bool l)
{
- GISTENTRY *cep;
+ GISTENTRY *cep;
gistentryinit(*e, pr, r, pg, o, b, l);
if (giststate->haskeytype)
@@ -1299,18 +1299,18 @@ gistcentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr, Relation r,
void
_gistdump(Relation r)
{
- Buffer buf;
- Page page;
- OffsetNumber offnum,
- maxoff;
- BlockNumber blkno;
- BlockNumber nblocks;
- GISTPageOpaque po;
- IndexTuple itup;
- BlockNumber itblkno;
- OffsetNumber itoffno;
- char *datum;
- char *itkey;
+ Buffer buf;
+ Page page;
+ OffsetNumber offnum,
+ maxoff;
+ BlockNumber blkno;
+ BlockNumber nblocks;
+ GISTPageOpaque po;
+ IndexTuple itup;
+ BlockNumber itblkno;
+ OffsetNumber itoffno;
+ char *datum;
+ char *itkey;
nblocks = RelationGetNumberOfBlocks(r);
for (blkno = 0; blkno < nblocks; blkno++)
@@ -1350,12 +1350,12 @@ _gistdump(Relation r)
}
#ifdef NOT_USED
-static char *
+static char *
text_range_out(TXTRANGE * r)
{
- char *result;
- char *lower,
- *upper;
+ char *result;
+ char *lower,
+ *upper;
if (r == NULL)
return (NULL);
@@ -1377,10 +1377,10 @@ text_range_out(TXTRANGE * r)
#endif
-static char *
+static char *
int_range_out(INTRANGE * r)
{
- char *result;
+ char *result;
if (r == NULL)
return (NULL);
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index cad4cef267e..0820389ff43 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -62,19 +62,19 @@ gistgettuple(IndexScanDesc s, ScanDirection dir)
return (res);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
gistfirst(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
- GISTPageOpaque po;
- GISTScanOpaque so;
- GISTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ GISTPageOpaque po;
+ GISTScanOpaque so;
+ GISTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
b = ReadBuffer(s->relation, GISTP_ROOT);
p = BufferGetPage(b);
@@ -145,19 +145,19 @@ gistfirst(IndexScanDesc s, ScanDirection dir)
}
}
-static RetrieveIndexResult
+static RetrieveIndexResult
gistnext(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
- GISTPageOpaque po;
- GISTScanOpaque so;
- GISTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ GISTPageOpaque po;
+ GISTScanOpaque so;
+ GISTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
blk = ItemPointerGetBlockNumber(&(s->currentItemData));
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
@@ -247,7 +247,7 @@ gistnext(IndexScanDesc s, ScanDirection dir)
}
/* Similar to index_keytest, but decompresses the key in the IndexTuple */
-static bool
+static bool
gistindex_keytest(IndexTuple tuple,
TupleDesc tupdesc,
int scanKeySize,
@@ -257,10 +257,10 @@ gistindex_keytest(IndexTuple tuple,
Page p,
OffsetNumber offset)
{
- bool isNull;
- Datum datum;
- int test;
- GISTENTRY de;
+ bool isNull;
+ Datum datum;
+ int test;
+ GISTENTRY de;
IncrIndexProcessed();
@@ -308,14 +308,14 @@ gistindex_keytest(IndexTuple tuple,
}
-static OffsetNumber
+static OffsetNumber
gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
{
- OffsetNumber maxoff;
- char *it;
- GISTPageOpaque po;
- GISTScanOpaque so;
- GISTSTATE *giststate;
+ OffsetNumber maxoff;
+ char *it;
+ GISTPageOpaque po;
+ GISTScanOpaque so;
+ GISTSTATE *giststate;
maxoff = PageGetMaxOffsetNumber(p);
po = (GISTPageOpaque) PageGetSpecialPointer(p);
@@ -355,11 +355,11 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
return (n);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
gistscancache(IndexScanDesc s, ScanDirection dir)
{
RetrieveIndexResult res;
- ItemPointer ip;
+ ItemPointer ip;
if (!(ScanDirectionIsNoMovement(dir)
&& ItemPointerIsValid(&(s->currentItemData))))
@@ -384,14 +384,14 @@ gistscancache(IndexScanDesc s, ScanDirection dir)
* gistheapptr returns the item pointer to the tuple in the heap relation
* for which itemp is the index relation item pointer.
*/
-static ItemPointer
+static ItemPointer
gistheapptr(Relation r, ItemPointer itemp)
{
- Buffer b;
- Page p;
- IndexTuple it;
- ItemPointer ip;
- OffsetNumber n;
+ Buffer b;
+ Page p;
+ IndexTuple it;
+ ItemPointer ip;
+ OffsetNumber n;
ip = (ItemPointer) palloc(sizeof(ItemPointerData));
if (ItemPointerIsValid(itemp))
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index ec680558d88..67070997754 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -27,8 +27,8 @@
#endif
/* routines defined and used here */
-static void gistregscan(IndexScanDesc s);
-static void gistdropscan(IndexScanDesc s);
+static void gistregscan(IndexScanDesc s);
+static void gistdropscan(IndexScanDesc s);
static void
gistadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum);
@@ -51,9 +51,9 @@ adjustiptr(IndexScanDesc s, ItemPointer iptr,
typedef struct GISTScanListData
{
- IndexScanDesc gsl_scan;
+ IndexScanDesc gsl_scan;
struct GISTScanListData *gsl_next;
-} GISTScanListData;
+} GISTScanListData;
typedef GISTScanListData *GISTScanList;
@@ -66,7 +66,7 @@ gistbeginscan(Relation r,
uint16 nkeys,
ScanKey key)
{
- IndexScanDesc s;
+ IndexScanDesc s;
RelationSetLockForRead(r);
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
@@ -78,8 +78,8 @@ gistbeginscan(Relation r,
void
gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
{
- GISTScanOpaque p;
- int i;
+ GISTScanOpaque p;
+ int i;
if (!IndexScanIsValid(s))
{
@@ -173,10 +173,10 @@ gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
void
gistmarkpos(IndexScanDesc s)
{
- GISTScanOpaque p;
- GISTSTACK *o,
- *n,
- *tmp;
+ GISTScanOpaque p;
+ GISTSTACK *o,
+ *n,
+ *tmp;
s->currentMarkData = s->currentItemData;
p = (GISTScanOpaque) s->opaque;
@@ -206,10 +206,10 @@ gistmarkpos(IndexScanDesc s)
void
gistrestrpos(IndexScanDesc s)
{
- GISTScanOpaque p;
- GISTSTACK *o,
- *n,
- *tmp;
+ GISTScanOpaque p;
+ GISTSTACK *o,
+ *n,
+ *tmp;
s->currentItemData = s->currentMarkData;
p = (GISTScanOpaque) s->opaque;
@@ -239,7 +239,7 @@ gistrestrpos(IndexScanDesc s)
void
gistendscan(IndexScanDesc s)
{
- GISTScanOpaque p;
+ GISTScanOpaque p;
p = (GISTScanOpaque) s->opaque;
@@ -257,7 +257,7 @@ gistendscan(IndexScanDesc s)
static void
gistregscan(IndexScanDesc s)
{
- GISTScanList l;
+ GISTScanList l;
l = (GISTScanList) palloc(sizeof(GISTScanListData));
l->gsl_scan = s;
@@ -268,8 +268,8 @@ gistregscan(IndexScanDesc s)
static void
gistdropscan(IndexScanDesc s)
{
- GISTScanList l;
- GISTScanList prev;
+ GISTScanList l;
+ GISTScanList prev;
prev = (GISTScanList) NULL;
@@ -294,8 +294,8 @@ gistdropscan(IndexScanDesc s)
void
gistadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum)
{
- GISTScanList l;
- Oid relid;
+ GISTScanList l;
+ Oid relid;
relid = r->rd_id;
for (l = GISTScans; l != (GISTScanList) NULL; l = l->gsl_next)
@@ -321,7 +321,7 @@ gistadjone(IndexScanDesc s,
BlockNumber blkno,
OffsetNumber offnum)
{
- GISTScanOpaque so;
+ GISTScanOpaque so;
adjustiptr(s, &(s->currentItemData), op, blkno, offnum);
adjustiptr(s, &(s->currentMarkData), op, blkno, offnum);
@@ -349,8 +349,8 @@ adjustiptr(IndexScanDesc s,
BlockNumber blkno,
OffsetNumber offnum)
{
- OffsetNumber curoff;
- GISTScanOpaque so;
+ OffsetNumber curoff;
+ GISTScanOpaque so;
if (ItemPointerIsValid(iptr))
{
@@ -361,39 +361,43 @@ adjustiptr(IndexScanDesc s,
switch (op)
{
- case GISTOP_DEL:
- /* back up one if we need to */
- if (curoff >= offnum)
- {
-
- if (curoff > FirstOffsetNumber)
- {
- /* just adjust the item pointer */
- ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
- }
- else
+ case GISTOP_DEL:
+ /* back up one if we need to */
+ if (curoff >= offnum)
{
- /* remember that we're before the current tuple */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags |= GS_CURBEFORE;
+
+ if (curoff > FirstOffsetNumber)
+ {
+ /* just adjust the item pointer */
+ ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
+ }
else
- so->s_flags |= GS_MRKBEFORE;
+ {
+
+ /*
+ * remember that we're before the current
+ * tuple
+ */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags |= GS_CURBEFORE;
+ else
+ so->s_flags |= GS_MRKBEFORE;
+ }
}
- }
- break;
-
- case GISTOP_SPLIT:
- /* back to start of page on split */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags &= ~GS_CURBEFORE;
- else
- so->s_flags &= ~GS_MRKBEFORE;
- break;
-
- default:
- elog(WARN, "Bad operation in GiST scan adjust: %d", op);
+ break;
+
+ case GISTOP_SPLIT:
+ /* back to start of page on split */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags &= ~GS_CURBEFORE;
+ else
+ so->s_flags &= ~GS_MRKBEFORE;
+ break;
+
+ default:
+ elog(WARN, "Bad operation in GiST scan adjust: %d", op);
}
}
}
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index e13539c4ad9..97e1a631a1e 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.13 1997/09/07 04:37:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.14 1997/09/08 02:20:10 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -31,7 +31,7 @@
#include <string.h>
#endif
-bool BuildingHash = false;
+bool BuildingHash = false;
/*
* hashbuild() -- build a new hash index.
@@ -52,30 +52,30 @@ hashbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc hscan;
- Buffer buffer;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc htupdesc,
- itupdesc;
- Datum *attdata;
- bool *nulls;
+ HeapScanDesc hscan;
+ Buffer buffer;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc htupdesc,
+ itupdesc;
+ Datum *attdata;
+ bool *nulls;
InsertIndexResult res;
- int nhtups,
- nitups;
- int i;
- HashItem hitem;
+ int nhtups,
+ nitups;
+ int i;
+ HashItem hitem;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
/* note that this is a new btree */
BuildingHash = true;
@@ -171,8 +171,8 @@ hashbuild(Relation heap,
*/
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -280,8 +280,8 @@ hashbuild(Relation heap,
InsertIndexResult
hashinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
- HashItem hitem;
- IndexTuple itup;
+ HashItem hitem;
+ IndexTuple itup;
InsertIndexResult res;
@@ -306,7 +306,7 @@ hashinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relati
/*
* hashgettuple() -- Get the next tuple in the scan.
*/
-char *
+char *
hashgettuple(IndexScanDesc scan, ScanDirection dir)
{
RetrieveIndexResult res;
@@ -329,14 +329,14 @@ hashgettuple(IndexScanDesc scan, ScanDirection dir)
/*
* hashbeginscan() -- start a scan on a hash index
*/
-char *
+char *
hashbeginscan(Relation rel,
bool fromEnd,
uint16 keysz,
ScanKey scankey)
{
- IndexScanDesc scan;
- HashScanOpaque so;
+ IndexScanDesc scan;
+ HashScanOpaque so;
scan = RelationGetIndexScan(rel, fromEnd, keysz, scankey);
so = (HashScanOpaque) palloc(sizeof(HashScanOpaqueData));
@@ -356,8 +356,8 @@ hashbeginscan(Relation rel,
void
hashrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
so = (HashScanOpaque) scan->opaque;
@@ -391,8 +391,8 @@ void
hashendscan(IndexScanDesc scan)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
so = (HashScanOpaque) scan->opaque;
@@ -426,8 +426,8 @@ hashendscan(IndexScanDesc scan)
void
hashmarkpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
/*
* see if we ever call this code. if we do, then so_mrkbuf a useful
@@ -463,8 +463,8 @@ hashmarkpos(IndexScanDesc scan)
void
hashrestrpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
/*
* see if we ever call this code. if we do, then so_mrkbuf a useful
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index a3cbaa1a94c..11785867691 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.4 1997/09/07 04:37:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.5 1997/09/08 02:20:13 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -36,10 +36,10 @@ hashint4(uint32 key)
uint32
hashfloat4(float32 keyp)
{
- int len;
- int loop;
- uint32 h;
- char *kp = (char *) keyp;
+ int len;
+ int loop;
+ uint32 h;
+ char *kp = (char *) keyp;
len = sizeof(float32data);
@@ -55,25 +55,25 @@ hashfloat4(float32 keyp)
switch (len & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASH4;
- case 7:
- HASH4;
- case 6:
- HASH4;
- case 5:
- HASH4;
- case 4:
- HASH4;
- case 3:
- HASH4;
- case 2:
- HASH4;
- case 1:
- HASH4;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASH4;
+ case 7:
+ HASH4;
+ case 6:
+ HASH4;
+ case 5:
+ HASH4;
+ case 4:
+ HASH4;
+ case 3:
+ HASH4;
+ case 2:
+ HASH4;
+ case 1:
+ HASH4;
+ } while (--loop);
}
}
return (h);
@@ -83,10 +83,10 @@ hashfloat4(float32 keyp)
uint32
hashfloat8(float64 keyp)
{
- int len;
- int loop;
- uint32 h;
- char *kp = (char *) keyp;
+ int len;
+ int loop;
+ uint32 h;
+ char *kp = (char *) keyp;
len = sizeof(float64data);
@@ -102,25 +102,25 @@ hashfloat8(float64 keyp)
switch (len & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASH4;
- case 7:
- HASH4;
- case 6:
- HASH4;
- case 5:
- HASH4;
- case 4:
- HASH4;
- case 3:
- HASH4;
- case 2:
- HASH4;
- case 1:
- HASH4;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASH4;
+ case 7:
+ HASH4;
+ case 6:
+ HASH4;
+ case 5:
+ HASH4;
+ case 4:
+ HASH4;
+ case 3:
+ HASH4;
+ case 2:
+ HASH4;
+ case 1:
+ HASH4;
+ } while (--loop);
}
}
return (h);
@@ -137,8 +137,8 @@ hashoid(Oid key)
uint32
hashchar(char key)
{
- int len;
- uint32 h;
+ int len;
+ uint32 h;
len = sizeof(char);
@@ -156,9 +156,9 @@ hashchar(char key)
uint32
hashchar2(uint16 intkey)
{
- uint32 h;
- int len;
- char *key = (char *) &intkey;
+ uint32 h;
+ int len;
+ char *key = (char *) &intkey;
h = 0;
len = sizeof(uint16);
@@ -173,9 +173,9 @@ hashchar2(uint16 intkey)
uint32
hashchar4(uint32 intkey)
{
- uint32 h;
- int len;
- char *key = (char *) &intkey;
+ uint32 h;
+ int len;
+ char *key = (char *) &intkey;
h = 0;
len = sizeof(uint32);
@@ -190,8 +190,8 @@ hashchar4(uint32 intkey)
uint32
hashchar8(char *key)
{
- uint32 h;
- int len;
+ uint32 h;
+ int len;
h = 0;
len = sizeof(char8);
@@ -206,9 +206,9 @@ hashchar8(char *key)
uint32
hashname(NameData * n)
{
- uint32 h;
- int len;
- char *key;
+ uint32 h;
+ int len;
+ char *key;
key = n->data;
@@ -226,8 +226,8 @@ hashname(NameData * n)
uint32
hashchar16(char *key)
{
- uint32 h;
- int len;
+ uint32 h;
+ int len;
h = 0;
len = sizeof(char16);
@@ -254,10 +254,10 @@ hashchar16(char *key)
uint32
hashtext(struct varlena * key)
{
- int keylen;
- char *keydata;
- uint32 n;
- int loop;
+ int keylen;
+ char *keydata;
+ uint32 n;
+ int loop;
keydata = VARDATA(key);
keylen = VARSIZE(key);
@@ -274,25 +274,25 @@ hashtext(struct varlena * key)
switch (keylen & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASHC;
- case 7:
- HASHC;
- case 6:
- HASHC;
- case 5:
- HASHC;
- case 4:
- HASHC;
- case 3:
- HASHC;
- case 2:
- HASHC;
- case 1:
- HASHC;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASHC;
+ case 7:
+ HASHC;
+ case 6:
+ HASHC;
+ case 5:
+ HASHC;
+ case 4:
+ HASHC;
+ case 3:
+ HASHC;
+ case 2:
+ HASHC;
+ case 1:
+ HASHC;
+ } while (--loop);
}
}
return (n);
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index 4829093589a..f76aba41794 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.9 1997/09/07 04:37:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.10 1997/09/08 02:20:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,15 +32,15 @@ static OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf, int keysz, ScanKey
InsertIndexResult
_hash_doinsert(Relation rel, HashItem hitem)
{
- Buffer buf;
- Buffer metabuf;
- BlockNumber blkno;
- HashMetaPage metap;
- IndexTuple itup;
+ Buffer buf;
+ Buffer metabuf;
+ BlockNumber blkno;
+ HashMetaPage metap;
+ IndexTuple itup;
InsertIndexResult res;
- ScanKey itup_scankey;
- int natts;
- Page page;
+ ScanKey itup_scankey;
+ int natts;
+ Page page;
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_READ);
metap = (HashMetaPage) BufferGetPage(metabuf);
@@ -101,7 +101,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
* we will have dropped both the pin and the write lock on the buffer.
*
*/
-static InsertIndexResult
+static InsertIndexResult
_hash_insertonpg(Relation rel,
Buffer buf,
int keysz,
@@ -110,15 +110,15 @@ _hash_insertonpg(Relation rel,
Buffer metabuf)
{
InsertIndexResult res;
- Page page;
- BlockNumber itup_blkno;
- OffsetNumber itup_off;
- int itemsz;
- HashPageOpaque pageopaque;
- bool do_expand = false;
- Buffer ovflbuf;
- HashMetaPage metap;
- Bucket bucket;
+ Page page;
+ BlockNumber itup_blkno;
+ OffsetNumber itup_off;
+ int itemsz;
+ HashPageOpaque pageopaque;
+ bool do_expand = false;
+ Buffer ovflbuf;
+ HashMetaPage metap;
+ Bucket bucket;
metap = (HashMetaPage) BufferGetPage(metabuf);
_hash_checkpage((Page) metap, LH_META_PAGE);
@@ -218,7 +218,7 @@ _hash_insertonpg(Relation rel,
* write lock and reference associated with the page's buffer. It is
* an error to call pgaddtup() without a write lock and reference.
*/
-static OffsetNumber
+static OffsetNumber
_hash_pgaddtup(Relation rel,
Buffer buf,
int keysz,
@@ -226,8 +226,8 @@ _hash_pgaddtup(Relation rel,
Size itemsize,
HashItem hitem)
{
- OffsetNumber itup_off;
- Page page;
+ OffsetNumber itup_off;
+ Page page;
page = BufferGetPage(buf);
_hash_checkpage(page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index b6882d4d3e1..5d764b34724 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.10 1997/09/07 04:37:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.11 1997/09/08 02:20:17 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
@@ -27,7 +27,7 @@
#endif
static OverflowPageAddress _hash_getovfladdr(Relation rel, Buffer * metabufp);
-static uint32 _hash_firstfreebit(uint32 map);
+static uint32 _hash_firstfreebit(uint32 map);
/*
* _hash_addovflpage
@@ -44,13 +44,13 @@ _hash_addovflpage(Relation rel, Buffer * metabufp, Buffer buf)
{
OverflowPageAddress oaddr;
- BlockNumber ovflblkno;
- Buffer ovflbuf;
- HashMetaPage metap;
- HashPageOpaque ovflopaque;
- HashPageOpaque pageopaque;
- Page page;
- Page ovflpage;
+ BlockNumber ovflblkno;
+ Buffer ovflbuf;
+ HashMetaPage metap;
+ HashPageOpaque ovflopaque;
+ HashPageOpaque pageopaque;
+ Page page;
+ Page ovflpage;
/* this had better be the last page in a bucket chain */
page = BufferGetPage(buf);
@@ -99,24 +99,24 @@ _hash_addovflpage(Relation rel, Buffer * metabufp, Buffer buf)
* is exchanged for a read lock.
*
*/
-static OverflowPageAddress
+static OverflowPageAddress
_hash_getovfladdr(Relation rel, Buffer * metabufp)
{
- HashMetaPage metap;
- Buffer mapbuf = 0;
- BlockNumber blkno;
- PageOffset offset;
+ HashMetaPage metap;
+ Buffer mapbuf = 0;
+ BlockNumber blkno;
+ PageOffset offset;
OverflowPageAddress oaddr;
- SplitNumber splitnum;
- uint32 *freep = NULL;
- uint32 max_free;
- uint32 bit;
- uint32 first_page;
- uint32 free_bit;
- uint32 free_page;
- uint32 in_use_bits;
- uint32 i,
- j;
+ SplitNumber splitnum;
+ uint32 *freep = NULL;
+ uint32 max_free;
+ uint32 bit;
+ uint32 first_page;
+ uint32 free_bit;
+ uint32 free_page;
+ uint32 in_use_bits;
+ uint32 i,
+ j;
metap = (HashMetaPage) _hash_chgbufaccess(rel, metabufp, HASH_READ, HASH_WRITE);
@@ -130,7 +130,7 @@ _hash_getovfladdr(Relation rel, Buffer * metabufp)
first_page = metap->LAST_FREED >> (metap->BSHIFT + BYTE_TO_BIT);
for (i = first_page; i <= free_page; i++)
{
- Page mappage;
+ Page mappage;
blkno = metap->hashm_mapp[i];
mapbuf = _hash_getbuf(rel, blkno, HASH_WRITE);
@@ -279,11 +279,11 @@ found:
* splitnumber.
*
*/
-static uint32
+static uint32
_hash_firstfreebit(uint32 map)
{
- uint32 i,
- mask;
+ uint32 i,
+ mask;
mask = 0x1;
for (i = 0; i < BITS_PER_MAP; i++)
@@ -306,22 +306,22 @@ _hash_firstfreebit(uint32 map)
Buffer
_hash_freeovflpage(Relation rel, Buffer ovflbuf)
{
- HashMetaPage metap;
- Buffer metabuf;
- Buffer mapbuf;
- BlockNumber prevblkno;
- BlockNumber blkno;
- BlockNumber nextblkno;
- HashPageOpaque ovflopaque;
- Page ovflpage;
- Page mappage;
+ HashMetaPage metap;
+ Buffer metabuf;
+ Buffer mapbuf;
+ BlockNumber prevblkno;
+ BlockNumber blkno;
+ BlockNumber nextblkno;
+ HashPageOpaque ovflopaque;
+ Page ovflpage;
+ Page mappage;
OverflowPageAddress addr;
- SplitNumber splitnum;
- uint32 *freep;
- uint32 ovflpgno;
- int32 bitmappage,
- bitmapbit;
- Bucket bucket;
+ SplitNumber splitnum;
+ uint32 *freep;
+ uint32 ovflpgno;
+ int32 bitmappage,
+ bitmapbit;
+ Bucket bucket;
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_WRITE);
metap = (HashMetaPage) BufferGetPage(metabuf);
@@ -348,9 +348,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
*/
if (BlockNumberIsValid(prevblkno))
{
- Buffer prevbuf = _hash_getbuf(rel, prevblkno, HASH_WRITE);
- Page prevpage = BufferGetPage(prevbuf);
- HashPageOpaque prevopaque =
+ Buffer prevbuf = _hash_getbuf(rel, prevblkno, HASH_WRITE);
+ Page prevpage = BufferGetPage(prevbuf);
+ HashPageOpaque prevopaque =
(HashPageOpaque) PageGetSpecialPointer(prevpage);
_hash_checkpage(prevpage, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
@@ -360,9 +360,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
}
if (BlockNumberIsValid(nextblkno))
{
- Buffer nextbuf = _hash_getbuf(rel, nextblkno, HASH_WRITE);
- Page nextpage = BufferGetPage(nextbuf);
- HashPageOpaque nextopaque =
+ Buffer nextbuf = _hash_getbuf(rel, nextblkno, HASH_WRITE);
+ Page nextpage = BufferGetPage(nextbuf);
+ HashPageOpaque nextopaque =
(HashPageOpaque) PageGetSpecialPointer(nextpage);
_hash_checkpage(nextpage, LH_OVERFLOW_PAGE);
@@ -436,13 +436,13 @@ _hash_initbitmap(Relation rel,
int32 nbits,
int32 ndx)
{
- Buffer buf;
- BlockNumber blkno;
- Page pg;
- HashPageOpaque op;
- uint32 *freep;
- int clearbytes,
- clearints;
+ Buffer buf;
+ BlockNumber blkno;
+ Page pg;
+ HashPageOpaque op;
+ uint32 *freep;
+ int clearbytes,
+ clearints;
blkno = OADDR_TO_BLKNO(pnum);
buf = _hash_getbuf(rel, blkno, HASH_WRITE);
@@ -496,18 +496,18 @@ _hash_squeezebucket(Relation rel,
HashMetaPage metap,
Bucket bucket)
{
- Buffer wbuf;
- Buffer rbuf = 0;
- BlockNumber wblkno;
- BlockNumber rblkno;
- Page wpage;
- Page rpage;
- HashPageOpaque wopaque;
- HashPageOpaque ropaque;
- OffsetNumber woffnum;
- OffsetNumber roffnum;
- HashItem hitem;
- int itemsz;
+ Buffer wbuf;
+ Buffer rbuf = 0;
+ BlockNumber wblkno;
+ BlockNumber rblkno;
+ Page wpage;
+ Page rpage;
+ HashPageOpaque wopaque;
+ HashPageOpaque ropaque;
+ OffsetNumber woffnum;
+ OffsetNumber roffnum;
+ HashItem hitem;
+ int itemsz;
/* elog(DEBUG, "_hash_squeezebucket: squeezing bucket %d", bucket); */
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 6c819b652d2..17fdaab37fd 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.10 1997/09/07 04:38:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.11 1997/09/08 02:20:18 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -38,9 +38,9 @@
#include <string.h>
#endif
-static void _hash_setpagelock(Relation rel, BlockNumber blkno, int access);
-static void _hash_unsetpagelock(Relation rel, BlockNumber blkno, int access);
-static void _hash_splitpage(Relation rel, Buffer metabuf, Bucket obucket, Bucket nbucket);
+static void _hash_setpagelock(Relation rel, BlockNumber blkno, int access);
+static void _hash_unsetpagelock(Relation rel, BlockNumber blkno, int access);
+static void _hash_splitpage(Relation rel, Buffer metabuf, Bucket obucket, Bucket nbucket);
/*
* We use high-concurrency locking on hash indices. There are two cases in
@@ -68,16 +68,16 @@ static void _hash_splitpage(Relation rel, Buffer metabuf, Bucket obucket, Bucke
void
_hash_metapinit(Relation rel)
{
- HashMetaPage metap;
- HashPageOpaque pageopaque;
- Buffer metabuf;
- Buffer buf;
- Page pg;
- int nbuckets;
- uint32 nelem; /* number elements */
- uint32 lg2nelem; /* _hash_log2(nelem) */
- uint32 nblocks;
- uint16 i;
+ HashMetaPage metap;
+ HashPageOpaque pageopaque;
+ Buffer metabuf;
+ Buffer buf;
+ Page pg;
+ int nbuckets;
+ uint32 nelem; /* number elements */
+ uint32 lg2nelem; /* _hash_log2(nelem) */
+ uint32 nblocks;
+ uint16 i;
/* can't be sharing this with anyone, now... */
if (USELOCKING)
@@ -188,7 +188,7 @@ _hash_metapinit(Relation rel)
Buffer
_hash_getbuf(Relation rel, BlockNumber blkno, int access)
{
- Buffer buf;
+ Buffer buf;
if (blkno == P_NEW)
{
@@ -196,14 +196,14 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
}
switch (access)
{
- case HASH_WRITE:
- case HASH_READ:
- _hash_setpagelock(rel, blkno, access);
- break;
- default:
- elog(WARN, "_hash_getbuf: invalid access (%d) on new blk: %s",
- access, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ case HASH_READ:
+ _hash_setpagelock(rel, blkno, access);
+ break;
+ default:
+ elog(WARN, "_hash_getbuf: invalid access (%d) on new blk: %s",
+ access, RelationGetRelationName(rel));
+ break;
}
buf = ReadBuffer(rel, blkno);
@@ -217,19 +217,19 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
void
_hash_relbuf(Relation rel, Buffer buf, int access)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
switch (access)
{
- case HASH_WRITE:
- case HASH_READ:
- _hash_unsetpagelock(rel, blkno, access);
- break;
- default:
- elog(WARN, "_hash_relbuf: invalid access (%d) on blk %x: %s",
- access, blkno, RelationGetRelationName(rel));
+ case HASH_WRITE:
+ case HASH_READ:
+ _hash_unsetpagelock(rel, blkno, access);
+ break;
+ default:
+ elog(WARN, "_hash_relbuf: invalid access (%d) on blk %x: %s",
+ access, blkno, RelationGetRelationName(rel));
}
ReleaseBuffer(buf);
@@ -245,7 +245,7 @@ _hash_relbuf(Relation rel, Buffer buf, int access)
void
_hash_wrtbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteBuffer(buf);
@@ -262,7 +262,7 @@ _hash_wrtbuf(Relation rel, Buffer buf)
void
_hash_wrtnorelbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteNoReleaseBuffer(buf);
@@ -274,22 +274,22 @@ _hash_chgbufaccess(Relation rel,
int from_access,
int to_access)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(*bufp);
switch (from_access)
{
- case HASH_WRITE:
- _hash_wrtbuf(rel, *bufp);
- break;
- case HASH_READ:
- _hash_relbuf(rel, *bufp, from_access);
- break;
- default:
- elog(WARN, "_hash_chgbufaccess: invalid access (%d) on blk %x: %s",
- from_access, blkno, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ _hash_wrtbuf(rel, *bufp);
+ break;
+ case HASH_READ:
+ _hash_relbuf(rel, *bufp, from_access);
+ break;
+ default:
+ elog(WARN, "_hash_chgbufaccess: invalid access (%d) on blk %x: %s",
+ from_access, blkno, RelationGetRelationName(rel));
+ break;
}
*bufp = _hash_getbuf(rel, blkno, to_access);
return (BufferGetPage(*bufp));
@@ -328,16 +328,16 @@ _hash_setpagelock(Relation rel,
switch (access)
{
- case HASH_WRITE:
- RelationSetSingleWLockPage(rel, &iptr);
- break;
- case HASH_READ:
- RelationSetSingleRLockPage(rel, &iptr);
- break;
- default:
- elog(WARN, "_hash_setpagelock: invalid access (%d) on blk %x: %s",
- access, blkno, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ RelationSetSingleWLockPage(rel, &iptr);
+ break;
+ case HASH_READ:
+ RelationSetSingleRLockPage(rel, &iptr);
+ break;
+ default:
+ elog(WARN, "_hash_setpagelock: invalid access (%d) on blk %x: %s",
+ access, blkno, RelationGetRelationName(rel));
+ break;
}
}
}
@@ -355,16 +355,16 @@ _hash_unsetpagelock(Relation rel,
switch (access)
{
- case HASH_WRITE:
- RelationUnsetSingleWLockPage(rel, &iptr);
- break;
- case HASH_READ:
- RelationUnsetSingleRLockPage(rel, &iptr);
- break;
- default:
- elog(WARN, "_hash_unsetpagelock: invalid access (%d) on blk %x: %s",
- access, blkno, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ RelationUnsetSingleWLockPage(rel, &iptr);
+ break;
+ case HASH_READ:
+ RelationUnsetSingleRLockPage(rel, &iptr);
+ break;
+ default:
+ elog(WARN, "_hash_unsetpagelock: invalid access (%d) on blk %x: %s",
+ access, blkno, RelationGetRelationName(rel));
+ break;
}
}
}
@@ -372,13 +372,13 @@ _hash_unsetpagelock(Relation rel,
void
_hash_pagedel(Relation rel, ItemPointer tid)
{
- Buffer buf;
- Buffer metabuf;
- Page page;
- BlockNumber blkno;
- OffsetNumber offno;
- HashMetaPage metap;
- HashPageOpaque opaque;
+ Buffer buf;
+ Buffer metabuf;
+ Page page;
+ BlockNumber blkno;
+ OffsetNumber offno;
+ HashMetaPage metap;
+ HashPageOpaque opaque;
blkno = ItemPointerGetBlockNumber(tid);
offno = ItemPointerGetOffsetNumber(tid);
@@ -414,10 +414,10 @@ _hash_pagedel(Relation rel, ItemPointer tid)
void
_hash_expandtable(Relation rel, Buffer metabuf)
{
- HashMetaPage metap;
- Bucket old_bucket;
- Bucket new_bucket;
- uint32 spare_ndx;
+ HashMetaPage metap;
+ Bucket old_bucket;
+ Bucket new_bucket;
+ uint32 spare_ndx;
/* elog(DEBUG, "_hash_expandtable: expanding..."); */
@@ -472,26 +472,26 @@ _hash_splitpage(Relation rel,
Bucket obucket,
Bucket nbucket)
{
- Bucket bucket;
- Buffer obuf;
- Buffer nbuf;
- Buffer ovflbuf;
- BlockNumber oblkno;
- BlockNumber nblkno;
- bool null;
- Datum datum;
- HashItem hitem;
- HashPageOpaque oopaque;
- HashPageOpaque nopaque;
- HashMetaPage metap;
- IndexTuple itup;
- int itemsz;
- OffsetNumber ooffnum;
- OffsetNumber noffnum;
- OffsetNumber omaxoffnum;
- Page opage;
- Page npage;
- TupleDesc itupdesc;
+ Bucket bucket;
+ Buffer obuf;
+ Buffer nbuf;
+ Buffer ovflbuf;
+ BlockNumber oblkno;
+ BlockNumber nblkno;
+ bool null;
+ Datum datum;
+ HashItem hitem;
+ HashPageOpaque oopaque;
+ HashPageOpaque nopaque;
+ HashMetaPage metap;
+ IndexTuple itup;
+ int itemsz;
+ OffsetNumber ooffnum;
+ OffsetNumber noffnum;
+ OffsetNumber omaxoffnum;
+ Page opage;
+ Page npage;
+ TupleDesc itupdesc;
/* elog(DEBUG, "_hash_splitpage: splitting %d into %d,%d",
obucket, obucket, nbucket);
diff --git a/src/backend/access/hash/hashscan.c b/src/backend/access/hash/hashscan.c
index 79fa33f747c..de64ebdd061 100644
--- a/src/backend/access/hash/hashscan.c
+++ b/src/backend/access/hash/hashscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.9 1997/09/07 04:38:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.10 1997/09/08 02:20:20 momjian Exp $
*
* NOTES
* Because we can be doing an index scan on a relation while we
@@ -31,14 +31,14 @@
#include <access/hash.h>
-static void _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
-static bool _hash_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
+static void _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
+static bool _hash_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
typedef struct HashScanListData
{
- IndexScanDesc hashsl_scan;
+ IndexScanDesc hashsl_scan;
struct HashScanListData *hashsl_next;
-} HashScanListData;
+} HashScanListData;
typedef HashScanListData *HashScanList;
@@ -50,7 +50,7 @@ static HashScanList HashScans = (HashScanList) NULL;
void
_hash_regscan(IndexScanDesc scan)
{
- HashScanList new_el;
+ HashScanList new_el;
new_el = (HashScanList) palloc(sizeof(HashScanListData));
new_el->hashsl_scan = scan;
@@ -64,8 +64,8 @@ _hash_regscan(IndexScanDesc scan)
void
_hash_dropscan(IndexScanDesc scan)
{
- HashScanList chk,
- last;
+ HashScanList chk,
+ last;
last = (HashScanList) NULL;
for (chk = HashScans;
@@ -89,8 +89,8 @@ _hash_dropscan(IndexScanDesc scan)
void
_hash_adjscans(Relation rel, ItemPointer tid)
{
- HashScanList l;
- Oid relid;
+ HashScanList l;
+ Oid relid;
relid = rel->rd_id;
for (l = HashScans; l != (HashScanList) NULL; l = l->hashsl_next)
@@ -104,10 +104,10 @@ _hash_adjscans(Relation rel, ItemPointer tid)
static void
_hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
{
- ItemPointer current;
- Buffer buf;
- Buffer metabuf;
- HashScanOpaque so;
+ ItemPointer current;
+ Buffer buf;
+ Buffer metabuf;
+ HashScanOpaque so;
if (!_hash_scantouched(scan, blkno, offno))
return;
@@ -144,12 +144,12 @@ _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
}
}
-static bool
+static bool
_hash_scantouched(IndexScanDesc scan,
BlockNumber blkno,
OffsetNumber offno)
{
- ItemPointer current;
+ ItemPointer current;
current = &(scan->currentItemData);
if (ItemPointerIsValid(current)
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index 0a42ad05065..7c3b91b9c0c 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.11 1997/09/07 04:38:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.12 1997/09/08 02:20:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,9 +34,9 @@ _hash_search(Relation rel,
Buffer * bufP,
HashMetaPage metap)
{
- BlockNumber blkno;
- Datum keyDatum;
- Bucket bucket;
+ BlockNumber blkno;
+ Datum keyDatum;
+ Bucket bucket;
if (scankey == (ScanKey) NULL ||
(keyDatum = scankey[0].sk_argument) == (Datum) NULL)
@@ -70,16 +70,16 @@ _hash_search(Relation rel,
RetrieveIndexResult
_hash_next(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Buffer metabuf;
- Page page;
- OffsetNumber offnum;
+ Relation rel;
+ Buffer buf;
+ Buffer metabuf;
+ Page page;
+ OffsetNumber offnum;
RetrieveIndexResult res;
- ItemPointer current;
- HashItem hitem;
- IndexTuple itup;
- HashScanOpaque so;
+ ItemPointer current;
+ HashItem hitem;
+ IndexTuple itup;
+ HashScanOpaque so;
rel = scan->relation;
so = (HashScanOpaque) scan->opaque;
@@ -129,7 +129,7 @@ static void
_hash_readnext(Relation rel,
Buffer * bufp, Page * pagep, HashPageOpaque * opaquep)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = (*opaquep)->hasho_nextblkno;
_hash_relbuf(rel, *bufp, HASH_READ);
@@ -148,7 +148,7 @@ static void
_hash_readprev(Relation rel,
Buffer * bufp, Page * pagep, HashPageOpaque * opaquep)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = (*opaquep)->hasho_prevblkno;
_hash_relbuf(rel, *bufp, HASH_READ);
@@ -180,18 +180,18 @@ _hash_readprev(Relation rel,
RetrieveIndexResult
_hash_first(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Buffer metabuf;
- Page page;
- HashPageOpaque opaque;
- HashMetaPage metap;
- HashItem hitem;
- IndexTuple itup;
- ItemPointer current;
- OffsetNumber offnum;
+ Relation rel;
+ Buffer buf;
+ Buffer metabuf;
+ Page page;
+ HashPageOpaque opaque;
+ HashMetaPage metap;
+ HashItem hitem;
+ IndexTuple itup;
+ ItemPointer current;
+ OffsetNumber offnum;
RetrieveIndexResult res;
- HashScanOpaque so;
+ HashScanOpaque so;
rel = scan->relation;
so = (HashScanOpaque) scan->opaque;
@@ -286,20 +286,20 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
bool
_hash_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir, Buffer metabuf)
{
- Relation rel;
- ItemPointer current;
- HashScanOpaque so;
- int allbuckets;
- HashMetaPage metap;
- Buffer buf;
- Page page;
- HashPageOpaque opaque;
- OffsetNumber maxoff;
- OffsetNumber offnum;
- Bucket bucket;
- BlockNumber blkno;
- HashItem hitem;
- IndexTuple itup;
+ Relation rel;
+ ItemPointer current;
+ HashScanOpaque so;
+ int allbuckets;
+ HashMetaPage metap;
+ Buffer buf;
+ Page page;
+ HashPageOpaque opaque;
+ OffsetNumber maxoff;
+ OffsetNumber offnum;
+ Bucket bucket;
+ BlockNumber blkno;
+ HashItem hitem;
+ IndexTuple itup;
rel = scan->relation;
current = &(scan->currentItemData);
@@ -341,107 +341,107 @@ _hash_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir, Buffer metabuf)
switch (dir)
{
- case ForwardScanDirection:
- if (offnum != InvalidOffsetNumber)
- {
- offnum = OffsetNumberNext(offnum); /* move forward */
- }
- else
- {
- offnum = FirstOffsetNumber; /* new page */
- }
- while (offnum > maxoff)
- {
+ case ForwardScanDirection:
+ if (offnum != InvalidOffsetNumber)
+ {
+ offnum = OffsetNumberNext(offnum); /* move forward */
+ }
+ else
+ {
+ offnum = FirstOffsetNumber; /* new page */
+ }
+ while (offnum > maxoff)
+ {
- /*
- * either this page is empty (maxoff ==
- * InvalidOffsetNumber) or we ran off the end.
- */
- _hash_readnext(rel, &buf, &page, &opaque);
- if (BufferIsInvalid(buf))
- { /* end of chain */
- if (allbuckets && bucket < metap->hashm_maxbucket)
- {
- ++bucket;
- blkno = BUCKET_TO_BLKNO(bucket);
- buf = _hash_getbuf(rel, blkno, HASH_READ);
- page = BufferGetPage(buf);
- _hash_checkpage(page, LH_BUCKET_PAGE);
- opaque = (HashPageOpaque) PageGetSpecialPointer(page);
- Assert(opaque->hasho_bucket == bucket);
- while (PageIsEmpty(page) &&
+ /*
+ * either this page is empty (maxoff ==
+ * InvalidOffsetNumber) or we ran off the end.
+ */
+ _hash_readnext(rel, &buf, &page, &opaque);
+ if (BufferIsInvalid(buf))
+ { /* end of chain */
+ if (allbuckets && bucket < metap->hashm_maxbucket)
+ {
+ ++bucket;
+ blkno = BUCKET_TO_BLKNO(bucket);
+ buf = _hash_getbuf(rel, blkno, HASH_READ);
+ page = BufferGetPage(buf);
+ _hash_checkpage(page, LH_BUCKET_PAGE);
+ opaque = (HashPageOpaque) PageGetSpecialPointer(page);
+ Assert(opaque->hasho_bucket == bucket);
+ while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno))
+ {
+ _hash_readnext(rel, &buf, &page, &opaque);
+ }
+ maxoff = PageGetMaxOffsetNumber(page);
+ offnum = FirstOffsetNumber;
+ }
+ else
{
- _hash_readnext(rel, &buf, &page, &opaque);
+ maxoff = offnum = InvalidOffsetNumber;
+ break; /* while */
}
- maxoff = PageGetMaxOffsetNumber(page);
- offnum = FirstOffsetNumber;
}
else
{
- maxoff = offnum = InvalidOffsetNumber;
- break; /* while */
+ /* _hash_readnext never returns an empty page */
+ maxoff = PageGetMaxOffsetNumber(page);
+ offnum = FirstOffsetNumber;
}
}
+ break;
+ case BackwardScanDirection:
+ if (offnum != InvalidOffsetNumber)
+ {
+ offnum = OffsetNumberPrev(offnum); /* move back */
+ }
else
{
- /* _hash_readnext never returns an empty page */
- maxoff = PageGetMaxOffsetNumber(page);
- offnum = FirstOffsetNumber;
+ offnum = maxoff; /* new page */
}
- }
- break;
- case BackwardScanDirection:
- if (offnum != InvalidOffsetNumber)
- {
- offnum = OffsetNumberPrev(offnum); /* move back */
- }
- else
- {
- offnum = maxoff;/* new page */
- }
- while (offnum < FirstOffsetNumber)
- {
+ while (offnum < FirstOffsetNumber)
+ {
- /*
- * either this page is empty (offnum ==
- * InvalidOffsetNumber) or we ran off the end.
- */
- _hash_readprev(rel, &buf, &page, &opaque);
- if (BufferIsInvalid(buf))
- { /* end of chain */
- if (allbuckets && bucket > 0)
- {
- --bucket;
- blkno = BUCKET_TO_BLKNO(bucket);
- buf = _hash_getbuf(rel, blkno, HASH_READ);
- page = BufferGetPage(buf);
- _hash_checkpage(page, LH_BUCKET_PAGE);
- opaque = (HashPageOpaque) PageGetSpecialPointer(page);
- Assert(opaque->hasho_bucket == bucket);
- while (BlockNumberIsValid(opaque->hasho_nextblkno))
+ /*
+ * either this page is empty (offnum ==
+ * InvalidOffsetNumber) or we ran off the end.
+ */
+ _hash_readprev(rel, &buf, &page, &opaque);
+ if (BufferIsInvalid(buf))
+ { /* end of chain */
+ if (allbuckets && bucket > 0)
{
- _hash_readnext(rel, &buf, &page, &opaque);
+ --bucket;
+ blkno = BUCKET_TO_BLKNO(bucket);
+ buf = _hash_getbuf(rel, blkno, HASH_READ);
+ page = BufferGetPage(buf);
+ _hash_checkpage(page, LH_BUCKET_PAGE);
+ opaque = (HashPageOpaque) PageGetSpecialPointer(page);
+ Assert(opaque->hasho_bucket == bucket);
+ while (BlockNumberIsValid(opaque->hasho_nextblkno))
+ {
+ _hash_readnext(rel, &buf, &page, &opaque);
+ }
+ maxoff = offnum = PageGetMaxOffsetNumber(page);
+ }
+ else
+ {
+ maxoff = offnum = InvalidOffsetNumber;
+ break; /* while */
}
- maxoff = offnum = PageGetMaxOffsetNumber(page);
}
else
{
- maxoff = offnum = InvalidOffsetNumber;
- break; /* while */
+ /* _hash_readprev never returns an empty page */
+ maxoff = offnum = PageGetMaxOffsetNumber(page);
}
}
- else
- {
- /* _hash_readprev never returns an empty page */
- maxoff = offnum = PageGetMaxOffsetNumber(page);
- }
- }
- break;
- default:
- /* NoMovementScanDirection */
- /* this should not be reached */
- break;
+ break;
+ default:
+ /* NoMovementScanDirection */
+ /* this should not be reached */
+ break;
}
/* we ran off the end of the world without finding a match */
diff --git a/src/backend/access/hash/hashstrat.c b/src/backend/access/hash/hashstrat.c
index f1bdbdb8a3a..a3a3656d76f 100644
--- a/src/backend/access/hash/hashstrat.c
+++ b/src/backend/access/hash/hashstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.10 1997/09/07 04:38:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.11 1997/09/08 02:20:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,12 +52,12 @@ static StrategyEvaluationData HTEvaluationData = {
*/
#ifdef NOT_USED
-static StrategyNumber
+static StrategyNumber
_hash_getstrat(Relation rel,
AttrNumber attno,
RegProcedure proc)
{
- StrategyNumber strat;
+ StrategyNumber strat;
strat = RelationGetStrategy(rel, attno, &HTEvaluationData, proc);
@@ -69,7 +69,7 @@ _hash_getstrat(Relation rel,
#endif
#ifdef NOT_USED
-static bool
+static bool
_hash_invokestrat(Relation rel,
AttrNumber attno,
StrategyNumber strat,
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index f9fbe0e2d17..573c6c2dd4f 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.10 1997/09/07 04:38:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.11 1997/09/08 02:20:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,13 @@
ScanKey
_hash_mkscankey(Relation rel, IndexTuple itup, HashMetaPage metap)
{
- ScanKey skey;
- TupleDesc itupdesc;
- int natts;
- AttrNumber i;
- Datum arg;
- RegProcedure proc;
- bool null;
+ ScanKey skey;
+ TupleDesc itupdesc;
+ int natts;
+ AttrNumber i;
+ Datum arg;
+ RegProcedure proc;
+ bool null;
natts = rel->rd_rel->relnatts;
itupdesc = RelationGetTupleDescriptor(rel);
@@ -73,9 +73,9 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
HashItem
_hash_formitem(IndexTuple itup)
{
- int nbytes_hitem;
- HashItem hitem;
- Size tuplen;
+ int nbytes_hitem;
+ HashItem hitem;
+ Size tuplen;
/* disallow nulls in hash keys */
if (itup->t_info & INDEX_NULL_MASK)
@@ -95,9 +95,9 @@ _hash_formitem(IndexTuple itup)
Bucket
_hash_call(Relation rel, HashMetaPage metap, Datum key)
{
- uint32 n;
- Bucket bucket;
- RegProcedure proc;
+ uint32 n;
+ Bucket bucket;
+ RegProcedure proc;
proc = metap->hashm_procid;
n = (uint32) fmgr(proc, key);
@@ -113,8 +113,8 @@ _hash_call(Relation rel, HashMetaPage metap, Datum key)
uint32
_hash_log2(uint32 num)
{
- uint32 i,
- limit;
+ uint32 i,
+ limit;
limit = 1;
for (i = 0; limit < num; limit = limit << 1, i++)
@@ -128,7 +128,7 @@ _hash_log2(uint32 num)
void
_hash_checkpage(Page page, int flags)
{
- HashPageOpaque opaque;
+ HashPageOpaque opaque;
Assert(page);
Assert(((PageHeader) (page))->pd_lower >= (sizeof(PageHeaderData) - sizeof(ItemIdData)));
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b7ab8625140..fa4dbae7ae1 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.16 1997/09/07 04:38:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.17 1997/09/08 02:20:28 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -96,7 +96,7 @@
#include <string.h>
#endif
-static bool ImmediateInvalidation;
+static bool ImmediateInvalidation;
/* ----------------------------------------------------------------
* heap support routines
@@ -210,7 +210,7 @@ nextpage(int page, int dir)
* real work in scanning tuples.
* ----------------
*/
-static HeapTuple
+static HeapTuple
heapgettup(Relation relation,
ItemPointer tid,
int dir,
@@ -219,14 +219,14 @@ heapgettup(Relation relation,
int nkeys,
ScanKey key)
{
- ItemId lpp;
- Page dp;
- int page;
- int pages;
- int lines;
- HeapTuple rtup;
- OffsetNumber lineoff;
- int linesleft;
+ ItemId lpp;
+ Page dp;
+ int page;
+ int pages;
+ int lines;
+ HeapTuple rtup;
+ OffsetNumber lineoff;
+ int linesleft;
/* ----------------
* increment access statistics
@@ -432,7 +432,7 @@ heapgettup(Relation relation,
if ((rtup = heap_tuple_satisfies(lpp, relation, *b, (PageHeader) dp,
timeQual, nkeys, key)) != NULL)
{
- ItemPointer iptr = &(rtup->t_ctid);
+ ItemPointer iptr = &(rtup->t_ctid);
if (ItemPointerGetBlockNumber(iptr) != page)
{
@@ -541,7 +541,7 @@ SetHeapAccessMethodImmediateInvalidation(bool on)
Relation
heap_open(Oid relationId)
{
- Relation r;
+ Relation r;
/* ----------------
* increment access statistics
@@ -570,7 +570,7 @@ heap_open(Oid relationId)
Relation
heap_openr(char *relationName)
{
- Relation r;
+ Relation r;
/* ----------------
* increment access statistics
@@ -621,7 +621,7 @@ heap_beginscan(Relation relation,
unsigned nkeys,
ScanKey key)
{
- HeapScanDesc sdesc;
+ HeapScanDesc sdesc;
/* ----------------
* increment access statistics
@@ -808,7 +808,7 @@ heap_getnext(HeapScanDesc scandesc,
Buffer * b)
{
register HeapScanDesc sdesc = scandesc;
- Buffer localb;
+ Buffer localb;
/* ----------------
* increment access statistics
@@ -880,7 +880,7 @@ heap_getnext(HeapScanDesc scandesc,
}
else
{ /* NONTUP */
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = (sdesc->rs_ctup != NULL) ?
&(sdesc->rs_ctup->t_ctid) : (ItemPointer) NULL;
@@ -967,7 +967,7 @@ heap_getnext(HeapScanDesc scandesc,
}
else
{ /* NONTUP */
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = (sdesc->rs_ctup != NULL) ?
&sdesc->rs_ctup->t_ctid : (ItemPointer) NULL;
@@ -1035,11 +1035,11 @@ heap_fetch(Relation relation,
ItemPointer tid,
Buffer * b)
{
- ItemId lp;
- Buffer buffer;
- PageHeader dp;
- HeapTuple tuple;
- OffsetNumber offnum;
+ ItemId lp;
+ Buffer buffer;
+ PageHeader dp;
+ HeapTuple tuple;
+ OffsetNumber offnum;
/* ----------------
* increment access statistics
@@ -1203,10 +1203,10 @@ heap_insert(Relation relation, HeapTuple tup)
int
heap_delete(Relation relation, ItemPointer tid)
{
- ItemId lp;
- HeapTuple tp;
- PageHeader dp;
- Buffer b;
+ ItemId lp;
+ HeapTuple tp;
+ PageHeader dp;
+ Buffer b;
/* ----------------
* increment access statistics
@@ -1313,10 +1313,10 @@ heap_delete(Relation relation, ItemPointer tid)
int
heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
{
- ItemId lp;
- HeapTuple tp;
- Page dp;
- Buffer buffer;
+ ItemId lp;
+ HeapTuple tp;
+ Page dp;
+ Buffer buffer;
/* ----------------
* increment access statistics
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 0854b69bf0b..21202b15376 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Id: hio.c,v 1.10 1997/09/07 04:38:11 momjian Exp $
+ * $Id: hio.c,v 1.11 1997/09/08 02:20:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,13 +35,13 @@ RelationPutHeapTuple(Relation relation,
BlockNumber blockIndex,
HeapTuple tuple)
{
- Buffer buffer;
- Page pageHeader;
- BlockNumber numberOfBlocks;
- OffsetNumber offnum;
- unsigned int len;
- ItemId itemId;
- Item item;
+ Buffer buffer;
+ Page pageHeader;
+ BlockNumber numberOfBlocks;
+ OffsetNumber offnum;
+ unsigned int len;
+ ItemId itemId;
+ Item item;
/* ----------------
* increment access statistics
@@ -108,13 +108,13 @@ RelationPutHeapTuple(Relation relation,
void
RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
{
- Buffer buffer;
- Page pageHeader;
- BlockNumber lastblock;
- OffsetNumber offnum;
- unsigned int len;
- ItemId itemId;
- Item item;
+ Buffer buffer;
+ Page pageHeader;
+ BlockNumber lastblock;
+ OffsetNumber offnum;
+ unsigned int len;
+ ItemId itemId;
+ Item item;
Assert(RelationIsValid(relation));
Assert(HeapTupleIsValid(tuple));
diff --git a/src/backend/access/heap/stats.c b/src/backend/access/heap/stats.c
index aa16803779c..2bebfd9b0be 100644
--- a/src/backend/access/heap/stats.c
+++ b/src/backend/access/heap/stats.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.12 1997/09/07 04:38:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.13 1997/09/08 02:20:31 momjian Exp $
*
* NOTES
* initam should be moved someplace else.
@@ -28,7 +28,7 @@
#include <string.h>
#endif
-static void InitHeapAccessStatistics(void);
+static void InitHeapAccessStatistics(void);
/* ----------------
* InitHeapAccessStatistics
@@ -39,7 +39,7 @@ HeapAccessStatistics heap_access_stats = (HeapAccessStatistics) NULL;
static void
InitHeapAccessStatistics()
{
- MemoryContext oldContext;
+ MemoryContext oldContext;
HeapAccessStatistics stats;
/* ----------------
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index da7fc0dc09f..83655b7d618 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.8 1997/09/07 04:38:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.9 1997/09/08 02:20:33 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
@@ -98,7 +98,7 @@ RelationGetIndexScan(Relation relation,
uint16 numberOfKeys,
ScanKey key)
{
- IndexScanDesc scan;
+ IndexScanDesc scan;
if (!RelationIsValid(relation))
elog(WARN, "RelationGetIndexScan: relation invalid");
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 6841899fa39..9d0eee39b64 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.14 1997/09/07 04:38:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.15 1997/09/08 02:20:37 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
@@ -167,7 +167,7 @@ index_insert(Relation relation,
ItemPointer heap_t_ctid,
Relation heapRel)
{
- RegProcedure procedure;
+ RegProcedure procedure;
InsertIndexResult specificResult;
RELATION_CHECKS;
@@ -207,7 +207,7 @@ index_insert(Relation relation,
void
index_delete(Relation relation, ItemPointer indexItem)
{
- RegProcedure procedure;
+ RegProcedure procedure;
RELATION_CHECKS;
GET_REL_PROCEDURE(delete, amdelete);
@@ -225,8 +225,8 @@ index_beginscan(Relation relation,
uint16 numberOfKeys,
ScanKey key)
{
- IndexScanDesc scandesc;
- RegProcedure procedure;
+ IndexScanDesc scandesc;
+ RegProcedure procedure;
RELATION_CHECKS;
GET_REL_PROCEDURE(beginscan, ambeginscan);
@@ -246,7 +246,7 @@ index_beginscan(Relation relation,
void
index_rescan(IndexScanDesc scan, bool scanFromEnd, ScanKey key)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(rescan, amrescan);
@@ -261,7 +261,7 @@ index_rescan(IndexScanDesc scan, bool scanFromEnd, ScanKey key)
void
index_endscan(IndexScanDesc scan)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(endscan, amendscan);
@@ -279,7 +279,7 @@ index_endscan(IndexScanDesc scan)
void
index_markpos(IndexScanDesc scan)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(markpos, ammarkpos);
@@ -297,7 +297,7 @@ index_markpos(IndexScanDesc scan)
void
index_restrpos(IndexScanDesc scan)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(restrpos, amrestrpos);
@@ -317,7 +317,7 @@ RetrieveIndexResult
index_getnext(IndexScanDesc scan,
ScanDirection direction)
{
- RegProcedure procedure;
+ RegProcedure procedure;
RetrieveIndexResult result;
SCAN_CHECKS;
@@ -354,8 +354,8 @@ index_getprocid(Relation irel,
AttrNumber attnum,
uint16 procnum)
{
- RegProcedure *loc;
- int natts;
+ RegProcedure *loc;
+ int natts;
natts = irel->rd_rel->relnatts;
@@ -375,13 +375,13 @@ GetIndexValue(HeapTuple tuple,
bool * attNull,
Buffer buffer)
{
- Datum returnVal;
- bool isNull;
+ Datum returnVal;
+ bool isNull;
if (PointerIsValid(fInfo) && FIgetProcOid(fInfo) != InvalidOid)
{
- int i;
- Datum *attData = (Datum *) palloc(FIgetnArgs(fInfo) * sizeof(Datum));
+ int i;
+ Datum *attData = (Datum *) palloc(FIgetnArgs(fInfo) * sizeof(Datum));
for (i = 0; i < FIgetnArgs(fInfo); i++)
{
diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c
index 35158c22170..9cc9c06e98f 100644
--- a/src/backend/access/index/istrat.c
+++ b/src/backend/access/index/istrat.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.10 1997/09/07 04:38:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.11 1997/09/08 02:20:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,7 @@
#include <fmgr.h>
#ifndef NO_ASSERT_CHECKING
-static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation);
+static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation);
static bool
StrategyExpressionIsValid(StrategyExpression expression,
StrategyNumber maxStrategy);
@@ -68,7 +68,7 @@ StrategyTermIsValid(StrategyTerm term,
* Assumes that the index strategy number is valid.
* Bounds checking should be done outside this routine.
*/
-static ScanKey
+static ScanKey
StrategyMapGetScanKeyEntry(StrategyMap map,
StrategyNumber strategyNumber)
{
@@ -122,7 +122,7 @@ AttributeNumberGetIndexStrategySize(AttrNumber maxAttributeNumber,
* StrategyOperatorIsValid
* ----------------
*/
-static bool
+static bool
StrategyOperatorIsValid(StrategyOperator operator,
StrategyNumber maxStrategy)
{
@@ -136,11 +136,11 @@ StrategyOperatorIsValid(StrategyOperator operator,
* StrategyTermIsValid
* ----------------
*/
-static bool
+static bool
StrategyTermIsValid(StrategyTerm term,
StrategyNumber maxStrategy)
{
- Index index;
+ Index index;
if (!PointerIsValid(term) || term->degree == 0)
return false;
@@ -162,11 +162,11 @@ StrategyTermIsValid(StrategyTerm term,
* StrategyExpressionIsValid
* ----------------
*/
-static bool
+static bool
StrategyExpressionIsValid(StrategyExpression expression,
StrategyNumber maxStrategy)
{
- StrategyTerm *termP;
+ StrategyTerm *termP;
if (!PointerIsValid(expression))
return true;
@@ -186,10 +186,10 @@ StrategyExpressionIsValid(StrategyExpression expression,
* StrategyEvaluationIsValid
* ----------------
*/
-static bool
+static bool
StrategyEvaluationIsValid(StrategyEvaluation evaluation)
{
- Index index;
+ Index index;
if (!PointerIsValid(evaluation) ||
!StrategyNumberIsValid(evaluation->maxStrategy) ||
@@ -219,17 +219,17 @@ StrategyEvaluationIsValid(StrategyEvaluation evaluation)
* StrategyTermEvaluate
* ----------------
*/
-static bool
+static bool
StrategyTermEvaluate(StrategyTerm term,
StrategyMap map,
Datum left,
Datum right)
{
- Index index;
- long tmpres = 0;
- bool result = 0;
+ Index index;
+ long tmpres = 0;
+ bool result = 0;
StrategyOperator operator;
- ScanKey entry;
+ ScanKey entry;
for (index = 0, operator = &term->operatorData[0];
index < term->degree; index += 1, operator += 1)
@@ -241,29 +241,29 @@ StrategyTermEvaluate(StrategyTerm term,
switch (operator->flags ^ entry->sk_flags)
{
- case 0x0:
- tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- left, right);
- break;
-
- case SK_NEGATE:
- tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- left, right);
- break;
-
- case SK_COMMUTE:
- tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- right, left);
- break;
-
- case SK_NEGATE | SK_COMMUTE:
- tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- right, left);
- break;
-
- default:
- elog(FATAL, "StrategyTermEvaluate: impossible case %d",
- operator->flags ^ entry->sk_flags);
+ case 0x0:
+ tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ left, right);
+ break;
+
+ case SK_NEGATE:
+ tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ left, right);
+ break;
+
+ case SK_COMMUTE:
+ tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ right, left);
+ break;
+
+ case SK_NEGATE | SK_COMMUTE:
+ tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ right, left);
+ break;
+
+ default:
+ elog(FATAL, "StrategyTermEvaluate: impossible case %d",
+ operator->flags ^ entry->sk_flags);
}
result = (bool) tmpres;
@@ -285,11 +285,11 @@ RelationGetStrategy(Relation relation,
StrategyEvaluation evaluation,
RegProcedure procedure)
{
- StrategyNumber strategy;
- StrategyMap strategyMap;
- ScanKey entry;
- Index index;
- int numattrs;
+ StrategyNumber strategy;
+ StrategyMap strategyMap;
+ ScanKey entry;
+ Index index;
+ int numattrs;
Assert(RelationIsValid(relation));
numattrs = RelationGetNumberOfAttributes(relation);
@@ -325,23 +325,23 @@ RelationGetStrategy(Relation relation,
switch (entry->sk_flags & (SK_NEGATE | SK_COMMUTE))
{
- case 0x0:
- return strategy;
+ case 0x0:
+ return strategy;
- case SK_NEGATE:
- strategy = evaluation->negateTransform->strategy[strategy - 1];
- break;
+ case SK_NEGATE:
+ strategy = evaluation->negateTransform->strategy[strategy - 1];
+ break;
- case SK_COMMUTE:
- strategy = evaluation->commuteTransform->strategy[strategy - 1];
- break;
+ case SK_COMMUTE:
+ strategy = evaluation->commuteTransform->strategy[strategy - 1];
+ break;
- case SK_NEGATE | SK_COMMUTE:
- strategy = evaluation->negateCommuteTransform->strategy[strategy - 1];
- break;
+ case SK_NEGATE | SK_COMMUTE:
+ strategy = evaluation->negateCommuteTransform->strategy[strategy - 1];
+ break;
- default:
- elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags);
+ default:
+ elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags);
}
@@ -368,11 +368,11 @@ RelationInvokeStrategy(Relation relation,
Datum left,
Datum right)
{
- StrategyNumber newStrategy;
- StrategyMap strategyMap;
- ScanKey entry;
+ StrategyNumber newStrategy;
+ StrategyMap strategyMap;
+ ScanKey entry;
StrategyTermData termData;
- int numattrs;
+ int numattrs;
Assert(RelationIsValid(relation));
Assert(relation->rd_rel->relkind == RELKIND_INDEX); /* XXX use accessor */
@@ -453,12 +453,12 @@ RelationInvokeStrategy(Relation relation,
if (PointerIsValid(evaluation->expression[strategy - 1]))
{
- StrategyTerm *termP;
+ StrategyTerm *termP;
termP = &evaluation->expression[strategy - 1]->term[0];
while (PointerIsValid(*termP))
{
- Index index;
+ Index index;
for (index = 0; index < (*termP)->degree; index += 1)
{
@@ -499,9 +499,9 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
Oid operatorObjectId,
ScanKey entry)
{
- HeapScanDesc scan;
- ScanKeyData scanKeyData;
- HeapTuple tuple;
+ HeapScanDesc scan;
+ ScanKeyData scanKeyData;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&scanKeyData, 0,
ObjectIdAttributeNumber,
@@ -547,15 +547,15 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
StrategyNumber maxSupportNumber,
AttrNumber maxAttributeNumber)
{
- Relation relation;
- Relation operatorRelation;
- HeapScanDesc scan;
- HeapTuple tuple;
- ScanKeyData entry[2];
- StrategyMap map;
- AttrNumber attributeNumber;
- int attributeIndex;
- Oid operatorClassObjectId[MaxIndexAttributeNumber];
+ Relation relation;
+ Relation operatorRelation;
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ ScanKeyData entry[2];
+ StrategyMap map;
+ AttrNumber attributeNumber;
+ int attributeIndex;
+ Oid operatorClassObjectId[MaxIndexAttributeNumber];
maxStrategyNumber = AMStrategies(maxStrategyNumber);
@@ -575,7 +575,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
*/
for (attributeIndex = 0; attributeIndex < maxAttributeNumber; attributeIndex++)
{
- IndexTupleForm iform;
+ IndexTupleForm iform;
iform = (IndexTupleForm) GETSTRUCT(tuple);
@@ -614,9 +614,9 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
attributeNumber--)
{
- int16 support;
- Form_pg_amproc form;
- RegProcedure *loc;
+ int16 support;
+ Form_pg_amproc form;
+ RegProcedure *loc;
loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)];
@@ -659,7 +659,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
attributeNumber--)
{
- StrategyNumber strategy;
+ StrategyNumber strategy;
entry[1].sk_argument =
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
@@ -676,7 +676,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
{
- Form_pg_amop form;
+ Form_pg_amop form;
form = (Form_pg_amop) GETSTRUCT(tuple);
@@ -702,9 +702,9 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
StrategyNumber numberOfStrategies,
int numberOfAttributes)
{
- StrategyMap strategyMap;
- AttrNumber attributeNumber;
- StrategyNumber strategyNumber;
+ StrategyMap strategyMap;
+ AttrNumber attributeNumber;
+ StrategyNumber strategyNumber;
for (attributeNumber = 1; attributeNumber <= numberOfAttributes;
attributeNumber += 1)
diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c
index 0312bbb69d7..f107e2138a1 100644
--- a/src/backend/access/nbtree/nbtcompare.c
+++ b/src/backend/access/nbtree/nbtcompare.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.11 1997/09/07 04:38:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.12 1997/09/08 02:20:44 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -134,13 +134,13 @@ btnamecmp(NameData * a, NameData * b)
int32
bttextcmp(struct varlena * a, struct varlena * b)
{
- int res;
- unsigned char *ap,
- *bp;
+ int res;
+ unsigned char *ap,
+ *bp;
#ifdef USE_LOCALE
- int la = VARSIZE(a) - VARHDRSZ;
- int lb = VARSIZE(b) - VARHDRSZ;
+ int la = VARSIZE(a) - VARHDRSZ;
+ int lb = VARSIZE(b) - VARHDRSZ;
ap = (unsigned char *) palloc(la + 1);
bp = (unsigned char *) palloc(lb + 1);
@@ -156,7 +156,7 @@ bttextcmp(struct varlena * a, struct varlena * b)
pfree(bp);
#else
- int len = VARSIZE(a);
+ int len = VARSIZE(a);
/* len is the length of the shorter of the two strings */
if (len > VARSIZE(b))
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index 4bafbc2ddbb..53c56d43ec5 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.18 1997/09/07 04:38:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.19 1997/09/08 02:20:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,13 @@
#endif
static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf, BTStack stack, int keysz, ScanKey scankey, BTItem btitem, BTItem afteritem);
-static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright);
+static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright);
static OffsetNumber _bt_findsplitloc(Relation rel, Page page, OffsetNumber start, OffsetNumber maxoff, Size llimit);
-static void _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
+static void _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
static OffsetNumber _bt_pgaddtup(Relation rel, Buffer buf, int keysz, ScanKey itup_scankey, Size itemsize, BTItem btitem, BTItem afteritem);
-static bool _bt_goesonpg(Relation rel, Buffer buf, Size keysz, ScanKey scankey, BTItem afteritem);
-static void _bt_updateitem(Relation rel, Size keysz, Buffer buf, BTItem oldItem, BTItem newItem);
-static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, int keysz, ScanKey scankey);
+static bool _bt_goesonpg(Relation rel, Buffer buf, Size keysz, ScanKey scankey, BTItem afteritem);
+static void _bt_updateitem(Relation rel, Size keysz, Buffer buf, BTItem oldItem, BTItem newItem);
+static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, int keysz, ScanKey scankey);
/*
* _bt_doinsert() -- Handle insertion of a single btitem in the tree.
@@ -46,12 +46,12 @@ static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, int
InsertIndexResult
_bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel)
{
- ScanKey itup_scankey;
- IndexTuple itup;
- BTStack stack;
- Buffer buf;
- BlockNumber blkno;
- int natts = rel->rd_rel->relnatts;
+ ScanKey itup_scankey;
+ IndexTuple itup;
+ BTStack stack;
+ Buffer buf;
+ BlockNumber blkno;
+ int natts = rel->rd_rel->relnatts;
InsertIndexResult res;
itup = &(btitem->bti_itup);
@@ -82,9 +82,9 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
/* already in the node */
if (index_is_unique)
{
- OffsetNumber offset,
- maxoff;
- Page page;
+ OffsetNumber offset,
+ maxoff;
+ Page page;
page = BufferGetPage(buf);
maxoff = PageGetMaxOffsetNumber(page);
@@ -95,13 +95,13 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
/* key on the page before trying to compare it */
if (!PageIsEmpty(page) && offset <= maxoff)
{
- TupleDesc itupdesc;
- BTItem btitem;
- IndexTuple itup;
- HeapTuple htup;
- BTPageOpaque opaque;
- Buffer nbuf;
- BlockNumber blkno;
+ TupleDesc itupdesc;
+ BTItem btitem;
+ IndexTuple itup;
+ HeapTuple htup;
+ BTPageOpaque opaque;
+ Buffer nbuf;
+ BlockNumber blkno;
itupdesc = RelationGetTupleDescriptor(rel);
nbuf = InvalidBuffer;
@@ -213,7 +213,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
* 'afteritem' parameter to position ourselves correctly for the
* insertion on internal pages.
*/
-static InsertIndexResult
+static InsertIndexResult
_bt_insertonpg(Relation rel,
Buffer buf,
BTStack stack,
@@ -223,14 +223,14 @@ _bt_insertonpg(Relation rel,
BTItem afteritem)
{
InsertIndexResult res;
- Page page;
- BTPageOpaque lpageop;
- BlockNumber itup_blkno;
- OffsetNumber itup_off;
- OffsetNumber firstright = InvalidOffsetNumber;
- int itemsz;
- bool do_split = false;
- bool keys_equal = false;
+ Page page;
+ BTPageOpaque lpageop;
+ BlockNumber itup_blkno;
+ OffsetNumber itup_off;
+ OffsetNumber firstright = InvalidOffsetNumber;
+ int itemsz;
+ bool do_split = false;
+ bool keys_equal = false;
page = BufferGetPage(buf);
lpageop = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -251,9 +251,9 @@ _bt_insertonpg(Relation rel,
*/
if (lpageop->btpo_flags & BTP_CHAIN)
{
- OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
- ItemId hitemid;
- BTItem hitem;
+ OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
+ ItemId hitemid;
+ BTItem hitem;
Assert(!P_RIGHTMOST(lpageop));
hitemid = PageGetItemId(page, P_HIKEY);
@@ -280,8 +280,8 @@ _bt_insertonpg(Relation rel,
else
/* "eat" page */
{
- Buffer pbuf;
- Page ppage;
+ Buffer pbuf;
+ Page ppage;
itup_blkno = BufferGetBlockNumber(buf);
itup_off = PageAddItem(page, (Item) btitem, itemsz,
@@ -315,13 +315,13 @@ _bt_insertonpg(Relation rel,
do_split = true;
else if (PageGetFreeSpace(page) < 3 * itemsz + 2 * sizeof(ItemIdData))
{
- OffsetNumber offnum = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
- OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
- ItemId itid;
- BTItem previtem,
- chkitem;
- Size maxsize;
- Size currsize;
+ OffsetNumber offnum = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
+ OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
+ ItemId itid;
+ BTItem previtem,
+ chkitem;
+ Size maxsize;
+ Size currsize;
itid = PageGetItemId(page, offnum);
previtem = (BTItem) PageGetItem(page, itid);
@@ -351,19 +351,19 @@ _bt_insertonpg(Relation rel,
if (do_split)
{
- Buffer rbuf;
- Page rpage;
- BTItem ritem;
- BlockNumber rbknum;
- BTPageOpaque rpageop;
- Buffer pbuf;
- Page ppage;
- BTPageOpaque ppageop;
- BlockNumber bknum = BufferGetBlockNumber(buf);
- BTItem lowLeftItem;
- OffsetNumber maxoff;
- bool shifted = false;
- bool left_chained = (lpageop->btpo_flags & BTP_CHAIN) ? true : false;
+ Buffer rbuf;
+ Page rpage;
+ BTItem ritem;
+ BlockNumber rbknum;
+ BTPageOpaque rpageop;
+ Buffer pbuf;
+ Page ppage;
+ BTPageOpaque ppageop;
+ BlockNumber bknum = BufferGetBlockNumber(buf);
+ BTItem lowLeftItem;
+ OffsetNumber maxoff;
+ bool shifted = false;
+ bool left_chained = (lpageop->btpo_flags & BTP_CHAIN) ? true : false;
/*
* If we have to split leaf page in the chain of duplicates by new
@@ -372,7 +372,7 @@ _bt_insertonpg(Relation rel,
if ((lpageop->btpo_flags & BTP_CHAIN) &&
(lpageop->btpo_flags & BTP_LEAF) && keys_equal)
{
- bool use_left = true;
+ bool use_left = true;
rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE);
rpage = BufferGetPage(rbuf);
@@ -429,8 +429,8 @@ _bt_insertonpg(Relation rel,
*/
else if (!(lpageop->btpo_flags & BTP_CHAIN))
{
- OffsetNumber start = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
- Size llimit;
+ OffsetNumber start = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
+ Size llimit;
maxoff = PageGetMaxOffsetNumber(page);
llimit = PageGetPageSize(page) - sizeof(PageHeaderData) -
@@ -547,13 +547,13 @@ _bt_insertonpg(Relation rel,
}
else
{
- ScanKey newskey;
+ ScanKey newskey;
InsertIndexResult newres;
- BTItem new_item;
- OffsetNumber upditem_offset = P_HIKEY;
- bool do_update = false;
- bool update_in_place = true;
- bool parent_chained;
+ BTItem new_item;
+ OffsetNumber upditem_offset = P_HIKEY;
+ bool do_update = false;
+ bool update_in_place = true;
+ bool parent_chained;
/* form a index tuple that points at the new right page */
rbknum = BufferGetBlockNumber(rbuf);
@@ -790,27 +790,27 @@ _bt_insertonpg(Relation rel,
* Returns the new right sibling of buf, pinned and write-locked. The
* pin and lock on buf are maintained.
*/
-static Buffer
+static Buffer
_bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
{
- Buffer rbuf;
- Page origpage;
- Page leftpage,
- rightpage;
- BTPageOpaque ropaque,
- lopaque,
- oopaque;
- Buffer sbuf;
- Page spage;
- BTPageOpaque sopaque;
- Size itemsz;
- ItemId itemid;
- BTItem item;
- OffsetNumber leftoff,
- rightoff;
- OffsetNumber start;
- OffsetNumber maxoff;
- OffsetNumber i;
+ Buffer rbuf;
+ Page origpage;
+ Page leftpage,
+ rightpage;
+ BTPageOpaque ropaque,
+ lopaque,
+ oopaque;
+ Buffer sbuf;
+ Page spage;
+ BTPageOpaque sopaque;
+ Size itemsz;
+ ItemId itemid;
+ BTItem item;
+ OffsetNumber leftoff,
+ rightoff;
+ OffsetNumber start;
+ OffsetNumber maxoff;
+ OffsetNumber i;
rbuf = _bt_getbuf(rel, P_NEW, BT_WRITE);
origpage = BufferGetPage(buf);
@@ -871,7 +871,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
maxoff = PageGetMaxOffsetNumber(origpage);
if (firstright == InvalidOffsetNumber)
{
- Size llimit = PageGetFreeSpace(leftpage) / 2;
+ Size llimit = PageGetFreeSpace(leftpage) / 2;
firstright = _bt_findsplitloc(rel, origpage, start, maxoff, llimit);
}
@@ -987,21 +987,21 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
* may be split as
* [2 2 2 2] [2 3 4].
*/
-static OffsetNumber
+static OffsetNumber
_bt_findsplitloc(Relation rel,
Page page,
OffsetNumber start,
OffsetNumber maxoff,
Size llimit)
{
- OffsetNumber i;
- OffsetNumber saferight;
- ItemId nxtitemid,
- safeitemid;
- BTItem safeitem,
- nxtitem;
- Size nbytes;
- int natts;
+ OffsetNumber i;
+ OffsetNumber saferight;
+ ItemId nxtitemid,
+ safeitemid;
+ BTItem safeitem,
+ nxtitem;
+ Size nbytes;
+ int natts;
if (start >= maxoff)
elog(FATAL, "btree: cannot split if start (%d) >= maxoff (%d)",
@@ -1072,18 +1072,18 @@ _bt_findsplitloc(Relation rel,
static void
_bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
{
- Buffer rootbuf;
- Page lpage,
- rpage,
- rootpage;
- BlockNumber lbkno,
- rbkno;
- BlockNumber rootbknum;
- BTPageOpaque rootopaque;
- ItemId itemid;
- BTItem item;
- Size itemsz;
- BTItem new_item;
+ Buffer rootbuf;
+ Page lpage,
+ rpage,
+ rootpage;
+ BlockNumber lbkno,
+ rbkno;
+ BlockNumber rootbknum;
+ BTPageOpaque rootopaque;
+ ItemId itemid;
+ BTItem item;
+ Size itemsz;
+ BTItem new_item;
/* get a new root page */
rootbuf = _bt_getbuf(rel, P_NEW, BT_WRITE);
@@ -1158,7 +1158,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* to follow. Otherwise, we do a binary search for the correct place
* and insert the new item there.
*/
-static OffsetNumber
+static OffsetNumber
_bt_pgaddtup(Relation rel,
Buffer buf,
int keysz,
@@ -1167,11 +1167,11 @@ _bt_pgaddtup(Relation rel,
BTItem btitem,
BTItem afteritem)
{
- OffsetNumber itup_off;
- OffsetNumber first;
- Page page;
- BTPageOpaque opaque;
- BTItem chkitem;
+ OffsetNumber itup_off;
+ OffsetNumber first;
+ Page page;
+ BTPageOpaque opaque;
+ BTItem chkitem;
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -1213,20 +1213,20 @@ _bt_pgaddtup(Relation rel,
* + the item it is to follow ("afteritem") appears on this
* page.
*/
-static bool
+static bool
_bt_goesonpg(Relation rel,
Buffer buf,
Size keysz,
ScanKey scankey,
BTItem afteritem)
{
- Page page;
- ItemId hikey;
- BTPageOpaque opaque;
- BTItem chkitem;
- OffsetNumber offnum,
- maxoff;
- bool found;
+ Page page;
+ ItemId hikey;
+ BTPageOpaque opaque;
+ BTItem chkitem;
+ OffsetNumber offnum,
+ maxoff;
+ bool found;
page = BufferGetPage(buf);
@@ -1314,16 +1314,16 @@ _bt_itemcmp(Relation rel,
BTItem item2,
StrategyNumber strat)
{
- TupleDesc tupDes;
- IndexTuple indexTuple1,
- indexTuple2;
- Datum attrDatum1,
- attrDatum2;
- int i;
- bool isFirstNull,
- isSecondNull;
- bool compare;
- bool useEqual = false;
+ TupleDesc tupDes;
+ IndexTuple indexTuple1,
+ indexTuple2;
+ Datum attrDatum1,
+ attrDatum2;
+ int i;
+ bool isFirstNull,
+ isSecondNull;
+ bool compare;
+ bool useEqual = false;
if (strat == BTLessEqualStrategyNumber)
{
@@ -1406,14 +1406,14 @@ _bt_updateitem(Relation rel,
BTItem oldItem,
BTItem newItem)
{
- Page page;
- OffsetNumber maxoff;
- OffsetNumber i;
+ Page page;
+ OffsetNumber maxoff;
+ OffsetNumber i;
ItemPointerData itemPtrData;
- BTItem item;
- IndexTuple oldIndexTuple,
- newIndexTuple;
- int first;
+ BTItem item;
+ IndexTuple oldIndexTuple,
+ newIndexTuple;
+ int first;
page = BufferGetPage(buf);
maxoff = PageGetMaxOffsetNumber(page);
@@ -1460,18 +1460,18 @@ _bt_updateitem(Relation rel,
*
* Rule is simple: NOT_NULL not equal NULL, NULL not_equal NULL too.
*/
-static bool
+static bool
_bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
int keysz, ScanKey scankey)
{
- Datum datum;
- BTItem btitem;
- IndexTuple itup;
- ScanKey entry;
- AttrNumber attno;
- long result;
- int i;
- bool null;
+ Datum datum;
+ BTItem btitem;
+ IndexTuple itup;
+ ScanKey entry;
+ AttrNumber attno;
+ long result;
+ int i;
+ bool null;
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &(btitem->bti_itup);
@@ -1504,27 +1504,27 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
*
* NOTE: tested for shifting leftmost page only, having btitem < hikey.
*/
-static InsertIndexResult
+static InsertIndexResult
_bt_shift(Relation rel, Buffer buf, BTStack stack, int keysz,
ScanKey scankey, BTItem btitem, BTItem hikey)
{
InsertIndexResult res;
- int itemsz;
- Page page;
- BlockNumber bknum;
- BTPageOpaque pageop;
- Buffer rbuf;
- Page rpage;
- BTPageOpaque rpageop;
- Buffer pbuf;
- Page ppage;
- BTPageOpaque ppageop;
- Buffer nbuf;
- Page npage;
- BTPageOpaque npageop;
- BlockNumber nbknum;
- BTItem nitem;
- OffsetNumber afteroff;
+ int itemsz;
+ Page page;
+ BlockNumber bknum;
+ BTPageOpaque pageop;
+ Buffer rbuf;
+ Page rpage;
+ BTPageOpaque rpageop;
+ Buffer pbuf;
+ Page ppage;
+ BTPageOpaque ppageop;
+ Buffer nbuf;
+ Page npage;
+ BTPageOpaque npageop;
+ BlockNumber nbknum;
+ BTItem nitem;
+ OffsetNumber afteroff;
btitem = _bt_formitem(&(btitem->bti_itup));
hikey = _bt_formitem(&(hikey->bti_itup));
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 6551af4c17c..fe3bebbccdf 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.10 1997/09/07 04:38:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.11 1997/09/08 02:20:49 momjian Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
@@ -36,8 +36,8 @@
#include <string.h>
#endif
-static void _bt_setpagelock(Relation rel, BlockNumber blkno, int access);
-static void _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access);
+static void _bt_setpagelock(Relation rel, BlockNumber blkno, int access);
+static void _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access);
#define BTREE_METAPAGE 0
#define BTREE_MAGIC 0x053162
@@ -50,18 +50,18 @@ static void _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access);
typedef struct BTMetaPageData
{
- uint32 btm_magic;
- uint32 btm_version;
- BlockNumber btm_root;
+ uint32 btm_magic;
+ uint32 btm_version;
+ BlockNumber btm_root;
#ifdef BTREE_VERSION_1
- int32 btm_level;
+ int32 btm_level;
#endif
-} BTMetaPageData;
+} BTMetaPageData;
#define BTPageGetMeta(p) \
((BTMetaPageData *) &((PageHeader) p)->pd_linp[0])
-extern bool BuildingBtree;
+extern bool BuildingBtree;
/*
* We use high-concurrency locking on btrees. There are two cases in
@@ -85,11 +85,11 @@ extern bool BuildingBtree;
void
_bt_metapinit(Relation rel)
{
- Buffer buf;
- Page pg;
- int nblocks;
- BTMetaPageData metad;
- BTPageOpaque op;
+ Buffer buf;
+ Page pg;
+ int nblocks;
+ BTMetaPageData metad;
+ BTPageOpaque op;
/* can't be sharing this with anyone, now... */
if (USELOCKING)
@@ -131,11 +131,11 @@ _bt_metapinit(Relation rel)
void
_bt_checkmeta(Relation rel)
{
- Buffer metabuf;
- Page metap;
+ Buffer metabuf;
+ Page metap;
BTMetaPageData *metad;
- BTPageOpaque op;
- int nblocks;
+ BTPageOpaque op;
+ int nblocks;
/* if the relation is empty, this is init time; don't complain */
if ((nblocks = RelationGetNumberOfBlocks(rel)) == 0)
@@ -187,13 +187,13 @@ _bt_checkmeta(Relation rel)
Buffer
_bt_getroot(Relation rel, int access)
{
- Buffer metabuf;
- Page metapg;
- BTPageOpaque metaopaque;
- Buffer rootbuf;
- Page rootpg;
- BTPageOpaque rootopaque;
- BlockNumber rootblkno;
+ Buffer metabuf;
+ Page metapg;
+ BTPageOpaque metaopaque;
+ Buffer rootbuf;
+ Page rootpg;
+ BTPageOpaque rootopaque;
+ BlockNumber rootblkno;
BTMetaPageData *metad;
metabuf = _bt_getbuf(rel, BTREE_METAPAGE, BT_READ);
@@ -319,8 +319,8 @@ _bt_getroot(Relation rel, int access)
Buffer
_bt_getbuf(Relation rel, BlockNumber blkno, int access)
{
- Buffer buf;
- Page page;
+ Buffer buf;
+ Page page;
/*
* If we want a new block, we can't set a lock of the appropriate type
@@ -359,7 +359,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
void
_bt_relbuf(Relation rel, Buffer buf, int access)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
@@ -382,7 +382,7 @@ _bt_relbuf(Relation rel, Buffer buf, int access)
void
_bt_wrtbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteBuffer(buf);
@@ -399,7 +399,7 @@ _bt_wrtbuf(Relation rel, Buffer buf)
void
_bt_wrtnorelbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteNoReleaseBuffer(buf);
@@ -439,9 +439,9 @@ _bt_pageinit(Page page, Size size)
void
_bt_metaproot(Relation rel, BlockNumber rootbknum, int level)
{
- Buffer metabuf;
- Page metap;
- BTPageOpaque metaopaque;
+ Buffer metabuf;
+ Page metap;
+ BTPageOpaque metaopaque;
BTMetaPageData *metad;
metabuf = _bt_getbuf(rel, BTREE_METAPAGE, BT_WRITE);
@@ -473,18 +473,18 @@ _bt_metaproot(Relation rel, BlockNumber rootbknum, int level)
Buffer
_bt_getstackbuf(Relation rel, BTStack stack, int access)
{
- Buffer buf;
- BlockNumber blkno;
- OffsetNumber start,
- offnum,
- maxoff;
- OffsetNumber i;
- Page page;
- ItemId itemid;
- BTItem item;
- BTPageOpaque opaque;
- BTItem item_save;
- int item_nbytes;
+ Buffer buf;
+ BlockNumber blkno;
+ OffsetNumber start,
+ offnum,
+ maxoff;
+ OffsetNumber i;
+ Page page;
+ ItemId itemid;
+ BTItem item;
+ BTPageOpaque opaque;
+ BTItem item_save;
+ int item_nbytes;
blkno = stack->bts_blkno;
buf = _bt_getbuf(rel, blkno, access);
@@ -603,10 +603,10 @@ _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access)
void
_bt_pagedel(Relation rel, ItemPointer tid)
{
- Buffer buf;
- Page page;
- BlockNumber blkno;
- OffsetNumber offno;
+ Buffer buf;
+ Page page;
+ BlockNumber blkno;
+ OffsetNumber offno;
blkno = ItemPointerGetBlockNumber(tid);
offno = ItemPointerGetOffsetNumber(tid);
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index dccbd77b355..9f7b59327a9 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.20 1997/09/07 04:38:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.21 1997/09/08 02:20:50 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -35,14 +35,14 @@
#ifdef BTREE_BUILD_STATS
#include <tcop/tcopprot.h>
-extern int ShowExecutorStats;
+extern int ShowExecutorStats;
#endif
-bool BuildingBtree = false; /* see comment in btbuild() */
-bool FastBuild = true; /* use sort/build instead of
- * insertion build */
+bool BuildingBtree = false; /* see comment in btbuild() */
+bool FastBuild = true; /* use sort/build instead of insertion
+ * build */
/*
* btbuild() -- build a new btree index.
@@ -63,33 +63,33 @@ btbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc hscan;
- Buffer buffer;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc htupdesc,
- itupdesc;
- Datum *attdata;
- bool *nulls;
+ HeapScanDesc hscan;
+ Buffer buffer;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc htupdesc,
+ itupdesc;
+ Datum *attdata;
+ bool *nulls;
InsertIndexResult res = 0;
- int nhtups,
- nitups;
- int i;
- BTItem btitem;
+ int nhtups,
+ nitups;
+ int i;
+ BTItem btitem;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext = (ExprContext *) NULL;
- TupleTable tupleTable = (TupleTable) NULL;
+ ExprContext *econtext = (ExprContext *) NULL;
+ TupleTable tupleTable = (TupleTable) NULL;
TupleTableSlot *slot = (TupleTableSlot *) NULL;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
- void *spool = (void *) NULL;
- bool isunique;
- bool usefast;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
+ void *spool = (void *) NULL;
+ bool isunique;
+ bool usefast;
/* note that this is a new btree */
BuildingBtree = true;
@@ -211,8 +211,8 @@ btbuild(Relation heap,
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -358,8 +358,8 @@ btbuild(Relation heap,
InsertIndexResult
btinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
- BTItem btitem;
- IndexTuple itup;
+ BTItem btitem;
+ IndexTuple itup;
InsertIndexResult res;
/* generate an index tuple */
@@ -389,7 +389,7 @@ btinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation
/*
* btgettuple() -- Get the next tuple in the scan.
*/
-char *
+char *
btgettuple(IndexScanDesc scan, ScanDirection dir)
{
RetrieveIndexResult res;
@@ -411,10 +411,10 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
/*
* btbeginscan() -- start a scan on a btree index
*/
-char *
+char *
btbeginscan(Relation rel, bool fromEnd, uint16 keysz, ScanKey scankey)
{
- IndexScanDesc scan;
+ IndexScanDesc scan;
/* get the scan */
scan = RelationGetIndexScan(rel, fromEnd, keysz, scankey);
@@ -431,8 +431,8 @@ btbeginscan(Relation rel, bool fromEnd, uint16 keysz, ScanKey scankey)
void
btrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -483,8 +483,8 @@ btrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey)
void
btmovescan(IndexScanDesc scan, Datum v)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -506,8 +506,8 @@ btmovescan(IndexScanDesc scan, Datum v)
void
btendscan(IndexScanDesc scan)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -541,8 +541,8 @@ btendscan(IndexScanDesc scan)
void
btmarkpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -570,8 +570,8 @@ btmarkpos(IndexScanDesc scan)
void
btrestrpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
diff --git a/src/backend/access/nbtree/nbtscan.c b/src/backend/access/nbtree/nbtscan.c
index 8a2042403ad..4f3ee1ffe62 100644
--- a/src/backend/access/nbtree/nbtscan.c
+++ b/src/backend/access/nbtree/nbtscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.8 1997/09/07 04:38:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.9 1997/09/08 02:20:52 momjian Exp $
*
*
* NOTES
@@ -34,16 +34,16 @@
typedef struct BTScanListData
{
- IndexScanDesc btsl_scan;
+ IndexScanDesc btsl_scan;
struct BTScanListData *btsl_next;
-} BTScanListData;
+} BTScanListData;
typedef BTScanListData *BTScanList;
static BTScanList BTScans = (BTScanList) NULL;
-static void _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno);
-static bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
+static void _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno);
+static bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
/*
* _bt_regscan() -- register a new scan.
@@ -51,7 +51,7 @@ static bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber
void
_bt_regscan(IndexScanDesc scan)
{
- BTScanList new_el;
+ BTScanList new_el;
new_el = (BTScanList) palloc(sizeof(BTScanListData));
new_el->btsl_scan = scan;
@@ -65,8 +65,8 @@ _bt_regscan(IndexScanDesc scan)
void
_bt_dropscan(IndexScanDesc scan)
{
- BTScanList chk,
- last;
+ BTScanList chk,
+ last;
last = (BTScanList) NULL;
for (chk = BTScans;
@@ -94,8 +94,8 @@ _bt_dropscan(IndexScanDesc scan)
void
_bt_adjscans(Relation rel, ItemPointer tid, int op)
{
- BTScanList l;
- Oid relid;
+ BTScanList l;
+ Oid relid;
relid = rel->rd_id;
for (l = BTScans; l != (BTScanList) NULL; l = l->btsl_next)
@@ -130,9 +130,9 @@ _bt_adjscans(Relation rel, ItemPointer tid, int op)
static void
_bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
{
- ItemPointer current;
- Buffer buf;
- BTScanOpaque so;
+ ItemPointer current;
+ Buffer buf;
+ BTScanOpaque so;
if (!_bt_scantouched(scan, blkno, offno))
return;
@@ -147,15 +147,15 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
{
switch (op)
{
- case BT_INSERT:
- _bt_step(scan, &buf, ForwardScanDirection);
- break;
- case BT_DELETE:
- _bt_step(scan, &buf, BackwardScanDirection);
- break;
- default:
- elog(WARN, "_bt_scandel: bad operation '%d'", op);
- /* NOTREACHED */
+ case BT_INSERT:
+ _bt_step(scan, &buf, ForwardScanDirection);
+ break;
+ case BT_DELETE:
+ _bt_step(scan, &buf, BackwardScanDirection);
+ break;
+ default:
+ elog(WARN, "_bt_scandel: bad operation '%d'", op);
+ /* NOTREACHED */
}
so->btso_curbuf = buf;
}
@@ -172,15 +172,15 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
scan->currentItemData = tmp;
switch (op)
{
- case BT_INSERT:
- _bt_step(scan, &buf, ForwardScanDirection);
- break;
- case BT_DELETE:
- _bt_step(scan, &buf, BackwardScanDirection);
- break;
- default:
- elog(WARN, "_bt_scandel: bad operation '%d'", op);
- /* NOTREACHED */
+ case BT_INSERT:
+ _bt_step(scan, &buf, ForwardScanDirection);
+ break;
+ case BT_DELETE:
+ _bt_step(scan, &buf, BackwardScanDirection);
+ break;
+ default:
+ elog(WARN, "_bt_scandel: bad operation '%d'", op);
+ /* NOTREACHED */
}
so->btso_mrkbuf = buf;
tmp = *current;
@@ -193,10 +193,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
* _bt_scantouched() -- check to see if a scan is affected by a given
* change to the index
*/
-static bool
+static bool
_bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
{
- ItemPointer current;
+ ItemPointer current;
current = &(scan->currentItemData);
if (ItemPointerIsValid(current)
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 8b1f75b7533..50f2031779f 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.24 1997/09/07 04:38:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.25 1997/09/08 02:20:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,19 +28,19 @@
#endif
-static BTStack
+static BTStack
_bt_searchr(Relation rel, int keysz, ScanKey scankey,
Buffer * bufP, BTStack stack_in);
-static OffsetNumber
+static OffsetNumber
_bt_firsteq(Relation rel, TupleDesc itupdesc, Page page,
Size keysz, ScanKey scankey, OffsetNumber offnum);
static int
_bt_compare(Relation rel, TupleDesc itupdesc, Page page,
int keysz, ScanKey scankey, OffsetNumber offnum);
-static bool
- _bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir);
-static RetrieveIndexResult
- _bt_endpoint(IndexScanDesc scan, ScanDirection dir);
+static bool
+ _bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir);
+static RetrieveIndexResult
+ _bt_endpoint(IndexScanDesc scan, ScanDirection dir);
/*
* _bt_search() -- Search for a scan key in the index.
@@ -58,24 +58,24 @@ _bt_search(Relation rel, int keysz, ScanKey scankey, Buffer * bufP)
/*
* _bt_searchr() -- Search the tree recursively for a particular scankey.
*/
-static BTStack
+static BTStack
_bt_searchr(Relation rel,
int keysz,
ScanKey scankey,
Buffer * bufP,
BTStack stack_in)
{
- BTStack stack;
- OffsetNumber offnum;
- Page page;
- BTPageOpaque opaque;
- BlockNumber par_blkno;
- BlockNumber blkno;
- ItemId itemid;
- BTItem btitem;
- BTItem item_save;
- int item_nbytes;
- IndexTuple itup;
+ BTStack stack;
+ OffsetNumber offnum;
+ Page page;
+ BTPageOpaque opaque;
+ BlockNumber par_blkno;
+ BlockNumber blkno;
+ ItemId itemid;
+ BTItem btitem;
+ BTItem item_save;
+ int item_nbytes;
+ IndexTuple itup;
/* if this is a leaf page, we're done */
page = BufferGetPage(*bufP);
@@ -155,11 +155,11 @@ _bt_moveright(Relation rel,
ScanKey scankey,
int access)
{
- Page page;
- BTPageOpaque opaque;
- ItemId hikey;
- BlockNumber rblkno;
- int natts = rel->rd_rel->relnatts;
+ Page page;
+ BTPageOpaque opaque;
+ ItemId hikey;
+ BlockNumber rblkno;
+ int natts = rel->rd_rel->relnatts;
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -183,7 +183,7 @@ _bt_moveright(Relation rel,
/* move right as long as we need to */
do
{
- OffsetNumber offmax = PageGetMaxOffsetNumber(page);
+ OffsetNumber offmax = PageGetMaxOffsetNumber(page);
/*
* If this page consists of all duplicate keys (hikey and
@@ -197,8 +197,8 @@ _bt_moveright(Relation rel,
* if number of attrs > keysize. Example: (2,0) - last items
* on this page, (2,1) - first item on next page (hikey), our
* scankey is x = 2. Scankey == (2,1) because of we compare
- * first attrs only, but we shouldn't to move right of here.
- * - vadim 04/15/97
+ * first attrs only, but we shouldn't to move right of here. -
+ * vadim 04/15/97
*/
if (_bt_skeycmp(rel, keysz, scankey, page, hikey,
@@ -268,17 +268,17 @@ _bt_skeycmp(Relation rel,
ItemId itemid,
StrategyNumber strat)
{
- BTItem item;
- IndexTuple indexTuple;
- TupleDesc tupDes;
- ScanKey entry;
- int i;
- Datum attrDatum;
- Datum keyDatum;
- bool compare;
- bool isNull;
- bool useEqual = false;
- bool keyNull;
+ BTItem item;
+ IndexTuple indexTuple;
+ TupleDesc tupDes;
+ ScanKey entry;
+ int i;
+ Datum attrDatum;
+ Datum keyDatum;
+ bool compare;
+ bool isNull;
+ bool useEqual = false;
+ bool keyNull;
if (strat == BTLessEqualStrategyNumber)
{
@@ -382,14 +382,14 @@ _bt_binsrch(Relation rel,
ScanKey scankey,
int srchtype)
{
- TupleDesc itupdesc;
- Page page;
- BTPageOpaque opaque;
- OffsetNumber low,
- mid,
- high;
- int natts = rel->rd_rel->relnatts;
- int result;
+ TupleDesc itupdesc;
+ Page page;
+ BTPageOpaque opaque;
+ OffsetNumber low,
+ mid,
+ high;
+ int natts = rel->rd_rel->relnatts;
+ int result;
itupdesc = RelationGetTupleDescriptor(rel);
page = BufferGetPage(buf);
@@ -515,7 +515,7 @@ _bt_binsrch(Relation rel,
}
}
-static OffsetNumber
+static OffsetNumber
_bt_firsteq(Relation rel,
TupleDesc itupdesc,
Page page,
@@ -523,8 +523,8 @@ _bt_firsteq(Relation rel,
ScanKey scankey,
OffsetNumber offnum)
{
- BTPageOpaque opaque;
- OffsetNumber limit;
+ BTPageOpaque opaque;
+ OffsetNumber limit;
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -572,16 +572,16 @@ _bt_compare(Relation rel,
ScanKey scankey,
OffsetNumber offnum)
{
- Datum datum;
- BTItem btitem;
- ItemId itemid;
- IndexTuple itup;
- BTPageOpaque opaque;
- ScanKey entry;
- AttrNumber attno;
- int result;
- int i;
- bool null;
+ Datum datum;
+ BTItem btitem;
+ ItemId itemid;
+ IndexTuple itup;
+ BTPageOpaque opaque;
+ ScanKey entry;
+ AttrNumber attno;
+ int result;
+ int i;
+ bool null;
/*
* If this is a leftmost internal page, and if our comparison is with
@@ -650,7 +650,7 @@ _bt_compare(Relation rel,
for (i = 1; i <= keysz; i++)
{
- long tmpres;
+ long tmpres;
entry = &scankey[i - 1];
attno = entry->sk_attno;
@@ -697,16 +697,16 @@ _bt_compare(Relation rel,
RetrieveIndexResult
_bt_next(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Page page;
- OffsetNumber offnum;
+ Relation rel;
+ Buffer buf;
+ Page page;
+ OffsetNumber offnum;
RetrieveIndexResult res;
- ItemPointer current;
- BTItem btitem;
- IndexTuple itup;
- BTScanOpaque so;
- Size keysok;
+ ItemPointer current;
+ BTItem btitem;
+ IndexTuple itup;
+ BTScanOpaque so;
+ Size keysok;
rel = scan->relation;
so = (BTScanOpaque) scan->opaque;
@@ -769,26 +769,26 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
RetrieveIndexResult
_bt_first(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- TupleDesc itupdesc;
- Buffer buf;
- Page page;
- BTPageOpaque pop;
- BTStack stack;
- OffsetNumber offnum,
- maxoff;
- bool offGmax = false;
- BTItem btitem;
- IndexTuple itup;
- ItemPointer current;
- BlockNumber blkno;
- StrategyNumber strat;
+ Relation rel;
+ TupleDesc itupdesc;
+ Buffer buf;
+ Page page;
+ BTPageOpaque pop;
+ BTStack stack;
+ OffsetNumber offnum,
+ maxoff;
+ bool offGmax = false;
+ BTItem btitem;
+ IndexTuple itup;
+ ItemPointer current;
+ BlockNumber blkno;
+ StrategyNumber strat;
RetrieveIndexResult res;
- RegProcedure proc;
- int result;
- BTScanOpaque so;
- ScanKeyData skdata;
- Size keysok;
+ RegProcedure proc;
+ int result;
+ BTScanOpaque so;
+ ScanKeyData skdata;
+ Size keysok;
rel = scan->relation;
so = (BTScanOpaque) scan->opaque;
@@ -915,69 +915,69 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
switch (strat)
{
- case BTLessStrategyNumber:
- if (result <= 0)
- {
- do
+ case BTLessStrategyNumber:
+ if (result <= 0)
{
- if (!_bt_twostep(scan, &buf, BackwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, BackwardScanDirection))
+ break;
- offnum = ItemPointerGetOffsetNumber(current);
- page = BufferGetPage(buf);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result <= 0);
+ offnum = ItemPointerGetOffsetNumber(current);
+ page = BufferGetPage(buf);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result <= 0);
- /* if this is true, the key we just looked at is gone */
- if (result > 0)
- _bt_twostep(scan, &buf, ForwardScanDirection);
- }
- break;
+ /* if this is true, the key we just looked at is gone */
+ if (result > 0)
+ _bt_twostep(scan, &buf, ForwardScanDirection);
+ }
+ break;
- case BTLessEqualStrategyNumber:
- if (result >= 0)
- {
- do
+ case BTLessEqualStrategyNumber:
+ if (result >= 0)
{
- if (!_bt_twostep(scan, &buf, ForwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, ForwardScanDirection))
+ break;
- offnum = ItemPointerGetOffsetNumber(current);
- page = BufferGetPage(buf);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result >= 0);
+ offnum = ItemPointerGetOffsetNumber(current);
+ page = BufferGetPage(buf);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result >= 0);
- if (result < 0)
- _bt_twostep(scan, &buf, BackwardScanDirection);
- }
- break;
+ if (result < 0)
+ _bt_twostep(scan, &buf, BackwardScanDirection);
+ }
+ break;
- case BTEqualStrategyNumber:
- if (result != 0)
- {
- _bt_relbuf(scan->relation, buf, BT_READ);
- so->btso_curbuf = InvalidBuffer;
- ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
- }
- break;
+ case BTEqualStrategyNumber:
+ if (result != 0)
+ {
+ _bt_relbuf(scan->relation, buf, BT_READ);
+ so->btso_curbuf = InvalidBuffer;
+ ItemPointerSetInvalid(&(scan->currentItemData));
+ return ((RetrieveIndexResult) NULL);
+ }
+ break;
- case BTGreaterEqualStrategyNumber:
- if (offGmax)
- {
- if (result < 0)
+ case BTGreaterEqualStrategyNumber:
+ if (offGmax)
{
- Assert(!P_RIGHTMOST(pop) && maxoff == P_HIKEY);
- if (!_bt_step(scan, &buf, ForwardScanDirection))
+ if (result < 0)
{
- _bt_relbuf(scan->relation, buf, BT_READ);
- so->btso_curbuf = InvalidBuffer;
- ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
+ Assert(!P_RIGHTMOST(pop) && maxoff == P_HIKEY);
+ if (!_bt_step(scan, &buf, ForwardScanDirection))
+ {
+ _bt_relbuf(scan->relation, buf, BT_READ);
+ so->btso_curbuf = InvalidBuffer;
+ ItemPointerSetInvalid(&(scan->currentItemData));
+ return ((RetrieveIndexResult) NULL);
+ }
}
- }
- else if (result > 0)
- { /* Just remember: _bt_binsrch() returns
+ else if (result > 0)
+ { /* Just remember: _bt_binsrch() returns
* the OffsetNumber of the first matching
* key on the page, or the OffsetNumber at
* which the matching key WOULD APPEAR IF
@@ -985,41 +985,41 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* page, but offnum from _bt_binsrch()
* greater maxoff - have to move right. -
* vadim 12/06/96 */
- _bt_twostep(scan, &buf, ForwardScanDirection);
+ _bt_twostep(scan, &buf, ForwardScanDirection);
+ }
}
- }
- else if (result < 0)
- {
- do
+ else if (result < 0)
{
- if (!_bt_twostep(scan, &buf, BackwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, BackwardScanDirection))
+ break;
- page = BufferGetPage(buf);
- offnum = ItemPointerGetOffsetNumber(current);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result < 0);
+ page = BufferGetPage(buf);
+ offnum = ItemPointerGetOffsetNumber(current);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result < 0);
- if (result > 0)
- _bt_twostep(scan, &buf, ForwardScanDirection);
- }
- break;
+ if (result > 0)
+ _bt_twostep(scan, &buf, ForwardScanDirection);
+ }
+ break;
- case BTGreaterStrategyNumber:
- /* offGmax helps as above */
- if (result >= 0 || offGmax)
- {
- do
+ case BTGreaterStrategyNumber:
+ /* offGmax helps as above */
+ if (result >= 0 || offGmax)
{
- if (!_bt_twostep(scan, &buf, ForwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, ForwardScanDirection))
+ break;
- offnum = ItemPointerGetOffsetNumber(current);
- page = BufferGetPage(buf);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result >= 0);
- }
- break;
+ offnum = ItemPointerGetOffsetNumber(current);
+ page = BufferGetPage(buf);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result >= 0);
+ }
+ break;
}
/* okay, current item pointer for the scan is right */
@@ -1062,16 +1062,16 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
bool
_bt_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
{
- Page page;
- BTPageOpaque opaque;
- OffsetNumber offnum,
- maxoff;
- OffsetNumber start;
- BlockNumber blkno;
- BlockNumber obknum;
- BTScanOpaque so;
- ItemPointer current;
- Relation rel;
+ Page page;
+ BTPageOpaque opaque;
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber start;
+ BlockNumber blkno;
+ BlockNumber obknum;
+ BTScanOpaque so;
+ ItemPointer current;
+ Relation rel;
rel = scan->relation;
current = &(scan->currentItemData);
@@ -1235,20 +1235,20 @@ _bt_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
* proper state and acquires a lock and pin on *bufP. If the twostep
* succeeded, we return true; otherwise, we return false.
*/
-static bool
+static bool
_bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
{
- Page page;
- BTPageOpaque opaque;
- OffsetNumber offnum,
- maxoff;
- OffsetNumber start;
- ItemPointer current;
- ItemId itemid;
- int itemsz;
- BTItem btitem;
- BTItem svitem;
- BlockNumber blkno;
+ Page page;
+ BTPageOpaque opaque;
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber start;
+ ItemPointer current;
+ ItemId itemid;
+ int itemsz;
+ BTItem btitem;
+ BTItem svitem;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(*bufP);
page = BufferGetPage(*bufP);
@@ -1333,23 +1333,23 @@ _bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
/*
* _bt_endpoint() -- Find the first or last key in the index.
*/
-static RetrieveIndexResult
+static RetrieveIndexResult
_bt_endpoint(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Page page;
- BTPageOpaque opaque;
- ItemPointer current;
- OffsetNumber offnum,
- maxoff;
- OffsetNumber start = 0;
- BlockNumber blkno;
- BTItem btitem;
- IndexTuple itup;
- BTScanOpaque so;
+ Relation rel;
+ Buffer buf;
+ Page page;
+ BTPageOpaque opaque;
+ ItemPointer current;
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber start = 0;
+ BlockNumber blkno;
+ BTItem btitem;
+ IndexTuple itup;
+ BTScanOpaque so;
RetrieveIndexResult res;
- Size keysok;
+ Size keysok;
rel = scan->relation;
current = &(scan->currentItemData);
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index 09cb43769f2..fae0fc27dab 100644
--- a/src/backend/access/nbtree/nbtsort.c
+++ b/src/backend/access/nbtree/nbtsort.c
@@ -5,7 +5,7 @@
*
*
* IDENTIFICATION
- * $Id: nbtsort.c,v 1.20 1997/09/07 04:39:02 momjian Exp $
+ * $Id: nbtsort.c,v 1.21 1997/09/08 02:20:58 momjian Exp $
*
* NOTES
*
@@ -65,14 +65,14 @@
#ifdef BTREE_BUILD_STATS
#include <tcop/tcopprot.h>
-extern int ShowExecutorStats;
+extern int ShowExecutorStats;
#endif
-static BTItem _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags);
-static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend);
-static void *_bt_pagestate(Relation index, int flags, int level, bool doupper);
-static void _bt_uppershutdown(Relation index, BTPageState * state);
+static BTItem _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags);
+static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend);
+static void *_bt_pagestate(Relation index, int flags, int level, bool doupper);
+static void _bt_uppershutdown(Relation index, BTPageState * state);
/*
* turn on debugging output.
@@ -88,9 +88,9 @@ static void _bt_uppershutdown(Relation index, BTPageState * state);
#define TAPEBLCKSZ (MAXBLCKSZ << 2)
#define TAPETEMP "pg_btsortXXXXXX"
-extern int NDirectFileRead;
-extern int NDirectFileWrite;
-extern char *mktemp(char *template);
+extern int NDirectFileRead;
+extern int NDirectFileWrite;
+extern char *mktemp(char *template);
/*
* this is what we use to shovel BTItems in and out of memory. it's
@@ -107,13 +107,13 @@ extern char *mktemp(char *template);
*/
typedef struct
{
- int bttb_magic; /* magic number */
- int bttb_fd; /* file descriptor */
- int bttb_top; /* top of free space within bttb_data */
- short bttb_ntup; /* number of tuples in this block */
- short bttb_eor; /* End-Of-Run marker */
- char bttb_data[TAPEBLCKSZ - 2 * sizeof(double)];
-} BTTapeBlock;
+ int bttb_magic; /* magic number */
+ int bttb_fd; /* file descriptor */
+ int bttb_top; /* top of free space within bttb_data */
+ short bttb_ntup; /* number of tuples in this block */
+ short bttb_eor; /* End-Of-Run marker */
+ char bttb_data[TAPEBLCKSZ - 2 * sizeof(double)];
+} BTTapeBlock;
/*
* this structure holds the bookkeeping for a simple balanced multiway
@@ -124,12 +124,12 @@ typedef struct
*/
typedef struct
{
- int bts_ntapes;
- int bts_tape;
- BTTapeBlock **bts_itape; /* input tape blocks */
- BTTapeBlock **bts_otape; /* output tape blocks */
- bool isunique;
-} BTSpool;
+ int bts_ntapes;
+ int bts_tape;
+ BTTapeBlock **bts_itape; /* input tape blocks */
+ BTTapeBlock **bts_otape; /* output tape blocks */
+ bool isunique;
+} BTSpool;
/*-------------------------------------------------------------------------
* sorting comparison routine - returns {-1,0,1} depending on whether
@@ -151,13 +151,13 @@ typedef struct
*/
typedef struct
{
- Datum *btsk_datum;
- char *btsk_nulls;
- BTItem btsk_item;
-} BTSortKey;
+ Datum *btsk_datum;
+ char *btsk_nulls;
+ BTItem btsk_item;
+} BTSortKey;
static Relation _bt_sortrel;
-static int _bt_nattr;
+static int _bt_nattr;
static BTSpool *_bt_inspool;
static void
@@ -171,12 +171,12 @@ _bt_isortcmpinit(Relation index, BTSpool * spool)
static int
_bt_isortcmp(BTSortKey * k1, BTSortKey * k2)
{
- Datum *k1_datum = k1->btsk_datum;
- Datum *k2_datum = k2->btsk_datum;
- char *k1_nulls = k1->btsk_nulls;
- char *k2_nulls = k2->btsk_nulls;
- bool equal_isnull = false;
- int i;
+ Datum *k1_datum = k1->btsk_datum;
+ Datum *k2_datum = k2->btsk_datum;
+ char *k1_nulls = k1->btsk_nulls;
+ char *k2_nulls = k2->btsk_nulls;
+ bool equal_isnull = false;
+ int i;
if (k1->btsk_item == (BTItem) NULL)
{
@@ -226,12 +226,12 @@ _bt_setsortkey(Relation index, BTItem bti, BTSortKey * sk)
if (bti != (BTItem) NULL)
{
- IndexTuple it = &(bti->bti_itup);
- TupleDesc itdesc = index->rd_att;
- Datum *dp = (Datum *) palloc(_bt_nattr * sizeof(Datum));
- char *np = (char *) palloc(_bt_nattr * sizeof(char));
- bool isnull;
- int i;
+ IndexTuple it = &(bti->bti_itup);
+ TupleDesc itdesc = index->rd_att;
+ Datum *dp = (Datum *) palloc(_bt_nattr * sizeof(Datum));
+ char *np = (char *) palloc(_bt_nattr * sizeof(char));
+ bool isnull;
+ int i;
for (i = 0; i < _bt_nattr; i++)
{
@@ -260,17 +260,17 @@ _bt_setsortkey(Relation index, BTItem bti, BTSortKey * sk)
*/
typedef struct
{
- int btpqe_tape; /* tape identifier */
- BTSortKey btpqe_item; /* pointer to BTItem in tape buffer */
-} BTPriQueueElem;
+ int btpqe_tape; /* tape identifier */
+ BTSortKey btpqe_item; /* pointer to BTItem in tape buffer */
+} BTPriQueueElem;
#define MAXELEM MAXTAPES
typedef struct
{
- int btpq_nelem;
- BTPriQueueElem btpq_queue[MAXELEM];
- Relation btpq_rel;
-} BTPriQueue;
+ int btpq_nelem;
+ BTPriQueueElem btpq_queue[MAXELEM];
+ Relation btpq_rel;
+} BTPriQueue;
/* be sure to call _bt_isortcmpinit first */
#define GREATER(a, b) \
@@ -279,8 +279,8 @@ typedef struct
static void
_bt_pqsift(BTPriQueue * q, int parent)
{
- int child;
- BTPriQueueElem e;
+ int child;
+ BTPriQueueElem e;
for (child = parent * 2 + 1;
child < q->btpq_nelem;
@@ -328,8 +328,8 @@ _bt_pqnext(BTPriQueue * q, BTPriQueueElem * e)
static void
_bt_pqadd(BTPriQueue * q, BTPriQueueElem * e)
{
- int child,
- parent;
+ int child,
+ parent;
if (q->btpq_nelem >= MAXELEM)
{
@@ -422,7 +422,7 @@ _bt_tapeclear(BTTapeBlock * tape)
static BTTapeBlock *
_bt_tapecreate(char *fname)
{
- BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
+ BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
if (tape == (BTTapeBlock *) NULL)
{
@@ -474,8 +474,8 @@ _bt_tapewrite(BTTapeBlock * tape, int eor)
static int
_bt_taperead(BTTapeBlock * tape)
{
- int fd;
- int nread;
+ int fd;
+ int nread;
if (tape->bttb_eor)
{
@@ -510,11 +510,11 @@ _bt_taperead(BTTapeBlock * tape)
* side effects:
* - sets 'pos' to the current position within the block.
*/
-static BTItem
+static BTItem
_bt_tapenext(BTTapeBlock * tape, char **pos)
{
- Size itemsz;
- BTItem bti;
+ Size itemsz;
+ BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
{
@@ -554,12 +554,12 @@ _bt_tapeadd(BTTapeBlock * tape, BTItem item, int itemsz)
* create and initialize a spool structure, including the underlying
* files.
*/
-void *
+void *
_bt_spoolinit(Relation index, int ntapes, bool isunique)
{
- BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
- int i;
- char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
+ BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
+ int i;
+ char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
if (btspool == (BTSpool *) NULL || fname == (char *) NULL)
{
@@ -600,8 +600,8 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
void
_bt_spooldestroy(void *spool)
{
- BTSpool *btspool = (BTSpool *) spool;
- int i;
+ BTSpool *btspool = (BTSpool *) spool;
+ int i;
for (i = 0; i < btspool->bts_ntapes; ++i)
{
@@ -617,7 +617,7 @@ _bt_spooldestroy(void *spool)
static void
_bt_spoolflush(BTSpool * btspool)
{
- int i;
+ int i;
for (i = 0; i < btspool->bts_ntapes; ++i)
{
@@ -637,10 +637,10 @@ _bt_spoolflush(BTSpool * btspool)
static void
_bt_spoolswap(BTSpool * btspool)
{
- File tmpfd;
- BTTapeBlock *itape;
- BTTapeBlock *otape;
- int i;
+ File tmpfd;
+ BTTapeBlock *itape;
+ BTTapeBlock *otape;
+ int i;
for (i = 0; i < btspool->bts_ntapes; ++i)
{
@@ -682,9 +682,9 @@ _bt_spoolswap(BTSpool * btspool)
void
_bt_spool(Relation index, BTItem btitem, void *spool)
{
- BTSpool *btspool = (BTSpool *) spool;
- BTTapeBlock *itape;
- Size itemsz;
+ BTSpool *btspool = (BTSpool *) spool;
+ BTTapeBlock *itape;
+ Size itemsz;
_bt_isortcmpinit(index, btspool);
@@ -699,13 +699,13 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
*/
if (btitem == (BTItem) NULL || SPCLEFT(itape) < itemsz)
{
- BTSortKey *parray = (BTSortKey *) NULL;
- BTTapeBlock *otape;
- BTItem bti;
- char *pos;
- int btisz;
- int it_ntup = itape->bttb_ntup;
- int i;
+ BTSortKey *parray = (BTSortKey *) NULL;
+ BTTapeBlock *otape;
+ BTItem bti;
+ char *pos;
+ int btisz;
+ int it_ntup = itape->bttb_ntup;
+ int i;
/*
* build an array of pointers to the BTItemDatas on the input
@@ -745,9 +745,9 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
_bt_tapeadd(otape, bti, btisz);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_SPOOL)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att,
- &isnull);
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att,
+ &isnull);
printf("_bt_spool: inserted <%x> into output tape %d\n",
d, btspool->bts_tape);
@@ -802,7 +802,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
static void
_bt_blnewpage(Relation index, Buffer * buf, Page * page, int flags)
{
- BTPageOpaque opaque;
+ BTPageOpaque opaque;
*buf = _bt_getbuf(index, P_NEW, BT_WRITE);
#if 0
@@ -824,10 +824,10 @@ _bt_blnewpage(Relation index, Buffer * buf, Page * page, int flags)
static void
_bt_slideleft(Relation index, Buffer buf, Page page)
{
- OffsetNumber off;
- OffsetNumber maxoff;
- ItemId previi;
- ItemId thisii;
+ OffsetNumber off;
+ OffsetNumber maxoff;
+ ItemId previi;
+ ItemId thisii;
if (!PageIsEmpty(page))
{
@@ -847,10 +847,10 @@ _bt_slideleft(Relation index, Buffer buf, Page page)
* allocate and initialize a new BTPageState. the returned structure
* is suitable for immediate use by _bt_buildadd.
*/
-static void *
+static void *
_bt_pagestate(Relation index, int flags, int level, bool doupper)
{
- BTPageState *state = (BTPageState *) palloc(sizeof(BTPageState));
+ BTPageState *state = (BTPageState *) palloc(sizeof(BTPageState));
memset((char *) state, 0, sizeof(BTPageState));
_bt_blnewpage(index, &(state->btps_buf), &(state->btps_page), flags);
@@ -870,12 +870,12 @@ _bt_pagestate(Relation index, int flags, int level, bool doupper)
* the page to which the item used to point, e.g., a heap page if
* 'opage' is a leaf page).
*/
-static BTItem
+static BTItem
_bt_minitem(Page opage, BlockNumber oblkno, int atend)
{
- OffsetNumber off;
- BTItem obti;
- BTItem nbti;
+ OffsetNumber off;
+ BTItem obti;
+ BTItem nbti;
off = atend ? P_HIKEY : P_FIRSTKEY;
obti = (BTItem) PageGetItem(opage, PageGetItemId(opage, off));
@@ -924,18 +924,18 @@ _bt_minitem(Page opage, BlockNumber oblkno, int atend)
*
* if all keys are unique, 'first' will always be the same as 'last'.
*/
-static BTItem
+static BTItem
_bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
{
- BTPageState *state = (BTPageState *) pstate;
- Buffer nbuf;
- Page npage;
- BTItem last_bti;
- OffsetNumber first_off;
- OffsetNumber last_off;
- OffsetNumber off;
- Size pgspc;
- Size btisz;
+ BTPageState *state = (BTPageState *) pstate;
+ Buffer nbuf;
+ Page npage;
+ BTItem last_bti;
+ OffsetNumber first_off;
+ OffsetNumber last_off;
+ OffsetNumber off;
+ Size pgspc;
+ Size btisz;
nbuf = state->btps_buf;
npage = state->btps_page;
@@ -948,12 +948,12 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
btisz = DOUBLEALIGN(btisz);
if (pgspc < btisz)
{
- Buffer obuf = nbuf;
- Page opage = npage;
- OffsetNumber o,
- n;
- ItemId ii;
- ItemId hii;
+ Buffer obuf = nbuf;
+ Page opage = npage;
+ OffsetNumber o,
+ n;
+ ItemId ii;
+ ItemId hii;
_bt_blnewpage(index, &nbuf, &npage, flags);
@@ -989,11 +989,11 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#if 0
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- BTItem tmpbti =
+ bool isnull;
+ BTItem tmpbti =
(BTItem) PageGetItem(npage, PageGetItemId(npage, n));
- Datum d = index_getattr(&(tmpbti->bti_itup), 1,
- index->rd_att, &isnull);
+ Datum d = index_getattr(&(tmpbti->bti_itup), 1,
+ index->rd_att, &isnull);
printf("_bt_buildadd: moved <%x> to offset %d at level %d\n",
d, n, state->btps_level);
@@ -1026,8 +1026,8 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
* set the page (side link) pointers.
*/
{
- BTPageOpaque oopaque = (BTPageOpaque) PageGetSpecialPointer(opage);
- BTPageOpaque nopaque = (BTPageOpaque) PageGetSpecialPointer(npage);
+ BTPageOpaque oopaque = (BTPageOpaque) PageGetSpecialPointer(opage);
+ BTPageOpaque nopaque = (BTPageOpaque) PageGetSpecialPointer(npage);
oopaque->btpo_next = BufferGetBlockNumber(nbuf);
nopaque->btpo_prev = BufferGetBlockNumber(obuf);
@@ -1047,7 +1047,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
*/
if (state->btps_doupper)
{
- BTItem nbti;
+ BTItem nbti;
if (state->btps_next == (BTPageState *) NULL)
{
@@ -1077,8 +1077,8 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#if 0
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att, &isnull);
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att, &isnull);
printf("_bt_buildadd: inserted <%x> at offset %d at level %d\n",
d, off, state->btps_level);
@@ -1109,10 +1109,10 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
static void
_bt_uppershutdown(Relation index, BTPageState * state)
{
- BTPageState *s;
- BlockNumber blkno;
- BTPageOpaque opaque;
- BTItem bti;
+ BTPageState *s;
+ BlockNumber blkno;
+ BTPageOpaque opaque;
+ BTItem bti;
for (s = state; s != (BTPageState *) NULL; s = s->btps_next)
{
@@ -1160,21 +1160,21 @@ _bt_uppershutdown(Relation index, BTPageState * state)
static void
_bt_merge(Relation index, BTSpool * btspool)
{
- BTPageState *state;
- BTPriQueue q;
- BTPriQueueElem e;
- BTSortKey btsk;
- BTItem bti;
- BTTapeBlock *itape;
- BTTapeBlock *otape;
- char *tapepos[MAXTAPES];
- int tapedone[MAXTAPES];
- int t;
- int goodtapes;
- int npass;
- int nruns;
- Size btisz;
- bool doleaf = false;
+ BTPageState *state;
+ BTPriQueue q;
+ BTPriQueueElem e;
+ BTSortKey btsk;
+ BTItem bti;
+ BTTapeBlock *itape;
+ BTTapeBlock *otape;
+ char *tapepos[MAXTAPES];
+ int tapedone[MAXTAPES];
+ int t;
+ int goodtapes;
+ int npass;
+ int nruns;
+ Size btisz;
+ bool doleaf = false;
/*
* initialize state needed for the merge into the btree leaf pages.
@@ -1279,8 +1279,8 @@ _bt_merge(Relation index, BTSpool * btspool)
_bt_buildadd(index, state, bti, BTP_LEAF);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1,
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1,
index->rd_att, &isnull);
printf("_bt_merge: [pass %d run %d] inserted <%x> from tape %d into block %d\n",
@@ -1308,8 +1308,8 @@ _bt_merge(Relation index, BTSpool * btspool)
_bt_tapeadd(otape, bti, btisz);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1,
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1,
index->rd_att, &isnull);
printf("_bt_merge: [pass %d run %d] inserted <%x> from tape %d into output tape %d\n",
@@ -1328,7 +1328,7 @@ _bt_merge(Relation index, BTSpool * btspool)
itape = btspool->bts_itape[t];
if (!tapedone[t])
{
- BTItem newbti = _bt_tapenext(itape, &tapepos[t]);
+ BTItem newbti = _bt_tapenext(itape, &tapepos[t]);
if (newbti == (BTItem) NULL)
{
@@ -1347,7 +1347,7 @@ _bt_merge(Relation index, BTSpool * btspool)
}
if (newbti != (BTItem) NULL)
{
- BTPriQueueElem nexte;
+ BTPriQueueElem nexte;
nexte.btpqe_tape = t;
_bt_setsortkey(index, newbti, &(nexte.btpqe_item));
@@ -1397,12 +1397,12 @@ _bt_merge(Relation index, BTSpool * btspool)
void
_bt_upperbuild(Relation index)
{
- Buffer rbuf;
- BlockNumber blk;
- Page rpage;
- BTPageOpaque ropaque;
- BTPageState *state;
- BTItem nbti;
+ Buffer rbuf;
+ BlockNumber blk;
+ Page rpage;
+ BTPageOpaque ropaque;
+ BTPageState *state;
+ BTItem nbti;
/*
* find the first leaf block. while we're at it, clear the BTP_ROOT
@@ -1438,9 +1438,9 @@ _bt_upperbuild(Relation index)
nbti = _bt_minitem(rpage, blk, P_RIGHTMOST(ropaque));
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(nbti->bti_itup), 1, index->rd_att,
- &isnull);
+ bool isnull;
+ Datum d = index_getattr(&(nbti->bti_itup), 1, index->rd_att,
+ &isnull);
printf("_bt_upperbuild: inserting <%x> at %d\n",
d, state->btps_level);
diff --git a/src/backend/access/nbtree/nbtstrat.c b/src/backend/access/nbtree/nbtstrat.c
index 5215d2000d8..6af9df2b65a 100644
--- a/src/backend/access/nbtree/nbtstrat.c
+++ b/src/backend/access/nbtree/nbtstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.5 1997/09/07 04:39:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.6 1997/09/08 02:20:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,7 +47,7 @@ static StrategyNumber BTNegateCommute[5] = {
BTGreaterEqualStrategyNumber
};
-static uint16 BTLessTermData[] = { /* XXX type clash */
+static uint16 BTLessTermData[] = { /* XXX type clash */
2,
BTLessStrategyNumber,
SK_NEGATE,
@@ -55,7 +55,7 @@ static uint16 BTLessTermData[] = { /* XXX type clash */
SK_NEGATE | SK_COMMUTE
};
-static uint16 BTLessEqualTermData[] = { /* XXX type clash */
+static uint16 BTLessEqualTermData[] = { /* XXX type clash */
2,
BTLessEqualStrategyNumber,
0x0,
@@ -63,7 +63,7 @@ static uint16 BTLessEqualTermData[] = { /* XXX type clash */
SK_COMMUTE
};
-static uint16 BTGreaterEqualTermData[] = { /* XXX type clash */
+static uint16 BTGreaterEqualTermData[] = { /* XXX type clash */
2,
BTGreaterEqualStrategyNumber,
0x0,
@@ -71,7 +71,7 @@ static uint16 BTGreaterEqualTermData[] = { /* XXX type clash */
SK_COMMUTE
};
-static uint16 BTGreaterTermData[] = { /* XXX type clash */
+static uint16 BTGreaterTermData[] = { /* XXX type clash */
2,
BTGreaterStrategyNumber,
SK_NEGATE,
@@ -109,7 +109,7 @@ _bt_getstrat(Relation rel,
AttrNumber attno,
RegProcedure proc)
{
- StrategyNumber strat;
+ StrategyNumber strat;
strat = RelationGetStrategy(rel, attno, &BTEvaluationData, proc);
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 096f1d2691e..0ee1ef9d321 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.12 1997/09/07 04:39:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.13 1997/09/08 02:21:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,7 @@
#include <catalog/pg_proc.h>
#include <executor/execdebug.h>
-extern int NIndexTupleProcessed;
+extern int NIndexTupleProcessed;
#ifndef HAVE_MEMMOVE
@@ -35,14 +35,14 @@ extern int NIndexTupleProcessed;
ScanKey
_bt_mkscankey(Relation rel, IndexTuple itup)
{
- ScanKey skey;
- TupleDesc itupdesc;
- int natts;
- int i;
- Datum arg;
- RegProcedure proc;
- bool null;
- bits16 flag;
+ ScanKey skey;
+ TupleDesc itupdesc;
+ int natts;
+ int i;
+ Datum arg;
+ RegProcedure proc;
+ bool null;
+ bits16 flag;
natts = rel->rd_rel->relnatts;
itupdesc = RelationGetTupleDescriptor(rel);
@@ -78,7 +78,7 @@ _bt_freeskey(ScanKey skey)
void
_bt_freestack(BTStack stack)
{
- BTStack ostack;
+ BTStack ostack;
while (stack != (BTStack) NULL)
{
@@ -99,18 +99,18 @@ _bt_freestack(BTStack stack)
void
_bt_orderkeys(Relation relation, BTScanOpaque so)
{
- ScanKey xform;
- ScanKeyData *cur;
- StrategyMap map;
- int nbytes;
- long test;
- int i,
- j;
- int init[BTMaxStrategyNumber + 1];
- ScanKey key;
- uint16 numberOfKeys = so->numberOfKeys;
- uint16 new_numberOfKeys = 0;
- AttrNumber attno = 1;
+ ScanKey xform;
+ ScanKeyData *cur;
+ StrategyMap map;
+ int nbytes;
+ long test;
+ int i,
+ j;
+ int init[BTMaxStrategyNumber + 1];
+ ScanKey key;
+ uint16 numberOfKeys = so->numberOfKeys;
+ uint16 new_numberOfKeys = 0;
+ AttrNumber attno = 1;
if (numberOfKeys < 1)
return;
@@ -169,8 +169,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
*/
if (init[BTEqualStrategyNumber - 1])
{
- ScanKeyData *eq,
- *chk;
+ ScanKeyData *eq,
+ *chk;
eq = &xform[BTEqualStrategyNumber - 1];
for (j = BTMaxStrategyNumber; --j >= 0;)
@@ -192,8 +192,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
if (init[BTLessStrategyNumber - 1]
&& init[BTLessEqualStrategyNumber - 1])
{
- ScanKeyData *lt,
- *le;
+ ScanKeyData *lt,
+ *le;
lt = &xform[BTLessStrategyNumber - 1];
le = &xform[BTLessEqualStrategyNumber - 1];
@@ -216,8 +216,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
if (init[BTGreaterStrategyNumber - 1]
&& init[BTGreaterEqualStrategyNumber - 1])
{
- ScanKeyData *gt,
- *ge;
+ ScanKeyData *gt,
+ *ge;
gt = &xform[BTGreaterStrategyNumber - 1];
ge = &xform[BTGreaterEqualStrategyNumber - 1];
@@ -288,10 +288,10 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
BTItem
_bt_formitem(IndexTuple itup)
{
- int nbytes_btitem;
- BTItem btitem;
- Size tuplen;
- extern Oid newoid();
+ int nbytes_btitem;
+ BTItem btitem;
+ Size tuplen;
+ extern Oid newoid();
/*
* see comments in btbuild
@@ -318,7 +318,7 @@ _bt_formitem(IndexTuple itup)
bool
_bt_checkqual(IndexScanDesc scan, IndexTuple itup)
{
- BTScanOpaque so;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
if (so->numberOfKeys > 0)
@@ -334,7 +334,7 @@ _bt_checkqual(IndexScanDesc scan, IndexTuple itup)
bool
_bt_checkforkeys(IndexScanDesc scan, IndexTuple itup, Size keysz)
{
- BTScanOpaque so;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
if (keysz > 0 && so->numberOfKeys >= keysz)
@@ -349,13 +349,13 @@ _bt_checkforkeys(IndexScanDesc scan, IndexTuple itup, Size keysz)
bool
_bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size * keysok)
{
- BTScanOpaque so = (BTScanOpaque) scan->opaque;
- Size keysz = so->numberOfKeys;
- TupleDesc tupdesc;
- ScanKey key;
- Datum datum;
- bool isNull;
- int test;
+ BTScanOpaque so = (BTScanOpaque) scan->opaque;
+ Size keysz = so->numberOfKeys;
+ TupleDesc tupdesc;
+ ScanKey key;
+ Datum datum;
+ bool isNull;
+ int test;
*keysok = 0;
if (keysz == 0)
diff --git a/src/backend/access/rtree/rtget.c b/src/backend/access/rtree/rtget.c
index eaf16c1ae9d..6a13b81a1f9 100644
--- a/src/backend/access/rtree/rtget.c
+++ b/src/backend/access/rtree/rtget.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.8 1997/09/07 04:39:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.9 1997/09/08 02:21:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,19 +57,19 @@ rtgettuple(IndexScanDesc s, ScanDirection dir)
return (res);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
rtfirst(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
RTreePageOpaque po;
RTreeScanOpaque so;
- RTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ RTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
b = ReadBuffer(s->relation, P_ROOT);
p = BufferGetPage(b);
@@ -140,19 +140,19 @@ rtfirst(IndexScanDesc s, ScanDirection dir)
}
}
-static RetrieveIndexResult
+static RetrieveIndexResult
rtnext(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
RTreePageOpaque po;
RTreeScanOpaque so;
- RTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ RTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
blk = ItemPointerGetBlockNumber(&(s->currentItemData));
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
@@ -241,11 +241,11 @@ rtnext(IndexScanDesc s, ScanDirection dir)
}
}
-static OffsetNumber
+static OffsetNumber
findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
{
- OffsetNumber maxoff;
- IndexTuple it;
+ OffsetNumber maxoff;
+ IndexTuple it;
RTreePageOpaque po;
RTreeScanOpaque so;
@@ -295,11 +295,11 @@ findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
return (n);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
rtscancache(IndexScanDesc s, ScanDirection dir)
{
RetrieveIndexResult res;
- ItemPointer ip;
+ ItemPointer ip;
if (!(ScanDirectionIsNoMovement(dir)
&& ItemPointerIsValid(&(s->currentItemData))))
@@ -324,14 +324,14 @@ rtscancache(IndexScanDesc s, ScanDirection dir)
* rtheapptr returns the item pointer to the tuple in the heap relation
* for which itemp is the index relation item pointer.
*/
-static ItemPointer
+static ItemPointer
rtheapptr(Relation r, ItemPointer itemp)
{
- Buffer b;
- Page p;
- IndexTuple it;
- ItemPointer ip;
- OffsetNumber n;
+ Buffer b;
+ Page p;
+ IndexTuple it;
+ ItemPointer ip;
+ OffsetNumber n;
ip = (ItemPointer) palloc(sizeof(ItemPointerData));
if (ItemPointerIsValid(itemp))
diff --git a/src/backend/access/rtree/rtproc.c b/src/backend/access/rtree/rtproc.c
index 4b7a9f2a266..5f1d4846f6d 100644
--- a/src/backend/access/rtree/rtproc.c
+++ b/src/backend/access/rtree/rtproc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.8 1997/09/07 04:39:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.9 1997/09/08 02:21:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@
BOX
* rt_box_union(BOX * a, BOX * b)
{
- BOX *n;
+ BOX *n;
if ((n = (BOX *) palloc(sizeof(*n))) == (BOX *) NULL)
elog(WARN, "Cannot allocate box for union");
@@ -38,10 +38,10 @@ BOX
return (n);
}
-BOX *
+BOX *
rt_box_inter(BOX * a, BOX * b)
{
- BOX *n;
+ BOX *n;
if ((n = (BOX *) palloc(sizeof(*n))) == (BOX *) NULL)
elog(WARN, "Cannot allocate box for union");
@@ -85,10 +85,10 @@ rt_bigbox_size(BOX * a, float *size)
rt_box_size(a, size);
}
-POLYGON *
+POLYGON *
rt_poly_union(POLYGON * a, POLYGON * b)
{
- POLYGON *p;
+ POLYGON *p;
p = (POLYGON *) PALLOCTYPE(POLYGON);
@@ -108,8 +108,8 @@ rt_poly_union(POLYGON * a, POLYGON * b)
void
rt_poly_size(POLYGON * a, float *size)
{
- double xdim,
- ydim;
+ double xdim,
+ ydim;
size = (float *) palloc(sizeof(float));
if (a == (POLYGON *) NULL ||
@@ -127,10 +127,10 @@ rt_poly_size(POLYGON * a, float *size)
return;
}
-POLYGON *
+POLYGON *
rt_poly_inter(POLYGON * a, POLYGON * b)
{
- POLYGON *p;
+ POLYGON *p;
p = (POLYGON *) PALLOCTYPE(POLYGON);
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index ae92ea20136..8b1aa533e84 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.14 1997/09/07 04:39:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.15 1997/09/08 02:21:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,20 +34,20 @@
typedef struct SPLITVEC
{
- OffsetNumber *spl_left;
- int spl_nleft;
- char *spl_ldatum;
- OffsetNumber *spl_right;
- int spl_nright;
- char *spl_rdatum;
-} SPLITVEC;
+ OffsetNumber *spl_left;
+ int spl_nleft;
+ char *spl_ldatum;
+ OffsetNumber *spl_right;
+ int spl_nright;
+ char *spl_rdatum;
+} SPLITVEC;
typedef struct RTSTATE
{
- func_ptr unionFn; /* union function */
- func_ptr sizeFn; /* size function */
- func_ptr interFn; /* intersection function */
-} RTSTATE;
+ func_ptr unionFn; /* union function */
+ func_ptr sizeFn; /* size function */
+ func_ptr interFn; /* intersection function */
+} RTSTATE;
/* non-export function prototypes */
static InsertIndexResult
@@ -62,16 +62,16 @@ dosplit(Relation r, Buffer buffer, RTSTACK * stack,
static void
rtintinsert(Relation r, RTSTACK * stk, IndexTuple ltup,
IndexTuple rtup, RTSTATE * rtstate);
-static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt);
+static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt);
static void
picksplit(Relation r, Page page, SPLITVEC * v, IndexTuple itup,
RTSTATE * rtstate);
-static void RTInitBuffer(Buffer b, uint32 f);
+static void RTInitBuffer(Buffer b, uint32 f);
static OffsetNumber
choose(Relation r, Page p, IndexTuple it,
RTSTATE * rtstate);
-static int nospace(Page p, IndexTuple it);
-static void initRtstate(RTSTATE * rtstate, Relation index);
+static int nospace(Page p, IndexTuple it);
+static void initRtstate(RTSTATE * rtstate, Relation index);
void
@@ -85,31 +85,31 @@ rtbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc scan;
- Buffer buffer;
- AttrNumber i;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc hd,
- id;
+ HeapScanDesc scan;
+ Buffer buffer;
+ AttrNumber i;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc hd,
+ id;
InsertIndexResult res;
- Datum *d;
- bool *nulls;
- int nb,
- nh,
- ni;
+ Datum *d;
+ bool *nulls;
+ int nb,
+ nh,
+ ni;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
- RTSTATE rtState;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
+ RTSTATE rtState;
initRtstate(&rtState, index);
@@ -215,8 +215,8 @@ rtbuild(Relation heap,
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -308,8 +308,8 @@ InsertIndexResult
rtinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
InsertIndexResult res;
- IndexTuple itup;
- RTSTATE rtState;
+ IndexTuple itup;
+ RTSTATE rtState;
/* generate an index tuple */
itup = index_formtuple(RelationGetTupleDescriptor(r), datum, nulls);
@@ -323,18 +323,18 @@ rtinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation h
return (res);
}
-static InsertIndexResult
+static InsertIndexResult
rtdoinsert(Relation r, IndexTuple itup, RTSTATE * rtstate)
{
- Page page;
- Buffer buffer;
- BlockNumber blk;
- IndexTuple which;
- OffsetNumber l;
- RTSTACK *stack;
+ Page page;
+ Buffer buffer;
+ BlockNumber blk;
+ IndexTuple which;
+ OffsetNumber l;
+ RTSTACK *stack;
InsertIndexResult res;
RTreePageOpaque opaque;
- char *datum;
+ char *datum;
blk = P_ROOT;
buffer = InvalidBuffer;
@@ -353,8 +353,8 @@ rtdoinsert(Relation r, IndexTuple itup, RTSTATE * rtstate)
opaque = (RTreePageOpaque) PageGetSpecialPointer(page);
if (!(opaque->flags & F_LEAF))
{
- RTSTACK *n;
- ItemId iid;
+ RTSTACK *n;
+ ItemId iid;
n = (RTSTACK *) palloc(sizeof(RTSTACK));
n->rts_parent = stack;
@@ -414,12 +414,12 @@ rttighten(Relation r,
int att_size,
RTSTATE * rtstate)
{
- char *oldud;
- char *tdatum;
- Page p;
- float old_size,
- newd_size;
- Buffer b;
+ char *oldud;
+ char *tdatum;
+ Page p;
+ float old_size,
+ newd_size;
+ Buffer b;
if (stk == (RTSTACK *) NULL)
return;
@@ -437,7 +437,7 @@ rttighten(Relation r,
if (newd_size != old_size)
{
- TupleDesc td = RelationGetTupleDescriptor(r);
+ TupleDesc td = RelationGetTupleDescriptor(r);
if (td->attrs[0]->attlen < 0)
{
@@ -480,35 +480,35 @@ rttighten(Relation r,
* his paper. The reason we chose it is that you can implement this
* with less information about the data types on which you're operating.
*/
-static InsertIndexResult
+static InsertIndexResult
dosplit(Relation r,
Buffer buffer,
RTSTACK * stack,
IndexTuple itup,
RTSTATE * rtstate)
{
- Page p;
- Buffer leftbuf,
- rightbuf;
- Page left,
- right;
- ItemId itemid;
- IndexTuple item;
- IndexTuple ltup,
- rtup;
- OffsetNumber maxoff;
- OffsetNumber i;
- OffsetNumber leftoff,
- rightoff;
- BlockNumber lbknum,
- rbknum;
- BlockNumber bufblock;
+ Page p;
+ Buffer leftbuf,
+ rightbuf;
+ Page left,
+ right;
+ ItemId itemid;
+ IndexTuple item;
+ IndexTuple ltup,
+ rtup;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ OffsetNumber leftoff,
+ rightoff;
+ BlockNumber lbknum,
+ rbknum;
+ BlockNumber bufblock;
RTreePageOpaque opaque;
- int blank;
+ int blank;
InsertIndexResult res;
- char *isnull;
- SPLITVEC v;
- TupleDesc tupDesc;
+ char *isnull;
+ SPLITVEC v;
+ TupleDesc tupDesc;
isnull = (char *) palloc(r->rd_rel->relnatts);
for (blank = 0; blank < r->rd_rel->relnatts; blank++)
@@ -638,12 +638,12 @@ rtintinsert(Relation r,
IndexTuple rtup,
RTSTATE * rtstate)
{
- IndexTuple old;
- Buffer b;
- Page p;
- char *ldatum,
- *rdatum,
- *newdatum;
+ IndexTuple old;
+ Buffer b;
+ Page p;
+ char *ldatum,
+ *rdatum,
+ *newdatum;
InsertIndexResult res;
if (stk == (RTSTACK *) NULL)
@@ -698,8 +698,8 @@ rtintinsert(Relation r,
static void
rtnewroot(Relation r, IndexTuple lt, IndexTuple rt)
{
- Buffer b;
- Page p;
+ Buffer b;
+ Page p;
b = ReadBuffer(r, P_ROOT);
RTInitBuffer(b, 0);
@@ -718,33 +718,33 @@ picksplit(Relation r,
IndexTuple itup,
RTSTATE * rtstate)
{
- OffsetNumber maxoff;
- OffsetNumber i,
- j;
- IndexTuple item_1,
- item_2;
- char *datum_alpha,
- *datum_beta;
- char *datum_l,
- *datum_r;
- char *union_d,
- *union_dl,
- *union_dr;
- char *inter_d;
- bool firsttime;
- float size_alpha,
- size_beta,
- size_union,
- size_inter;
- float size_waste,
- waste;
- float size_l,
- size_r;
- int nbytes;
- OffsetNumber seed_1 = 0,
- seed_2 = 0;
- OffsetNumber *left,
- *right;
+ OffsetNumber maxoff;
+ OffsetNumber i,
+ j;
+ IndexTuple item_1,
+ item_2;
+ char *datum_alpha,
+ *datum_beta;
+ char *datum_l,
+ *datum_r;
+ char *union_d,
+ *union_dl,
+ *union_dr;
+ char *inter_d;
+ bool firsttime;
+ float size_alpha,
+ size_beta,
+ size_union,
+ size_inter;
+ float size_waste,
+ waste;
+ float size_l,
+ size_r;
+ int nbytes;
+ OffsetNumber seed_1 = 0,
+ seed_2 = 0;
+ OffsetNumber *left,
+ *right;
maxoff = PageGetMaxOffsetNumber(page);
@@ -886,8 +886,8 @@ static void
RTInitBuffer(Buffer b, uint32 f)
{
RTreePageOpaque opaque;
- Page page;
- Size pageSize;
+ Page page;
+ Size pageSize;
pageSize = BufferGetPageSize(b);
@@ -899,18 +899,18 @@ RTInitBuffer(Buffer b, uint32 f)
opaque->flags = f;
}
-static OffsetNumber
+static OffsetNumber
choose(Relation r, Page p, IndexTuple it, RTSTATE * rtstate)
{
- OffsetNumber maxoff;
- OffsetNumber i;
- char *ud,
- *id;
- char *datum;
- float usize,
- dsize;
- OffsetNumber which;
- float which_grow;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ char *ud,
+ *id;
+ char *datum;
+ float usize,
+ dsize;
+ OffsetNumber which;
+ float which_grow;
id = ((char *) it) + sizeof(IndexTupleData);
maxoff = PageGetMaxOffsetNumber(p);
@@ -946,7 +946,7 @@ nospace(Page p, IndexTuple it)
void
freestack(RTSTACK * s)
{
- RTSTACK *p;
+ RTSTACK *p;
while (s != (RTSTACK *) NULL)
{
@@ -956,13 +956,13 @@ freestack(RTSTACK * s)
}
}
-char *
+char *
rtdelete(Relation r, ItemPointer tid)
{
- BlockNumber blkno;
- OffsetNumber offnum;
- Buffer buf;
- Page page;
+ BlockNumber blkno;
+ OffsetNumber offnum;
+ Buffer buf;
+ Page page;
/* must write-lock on delete */
RelationSetLockForWrite(r);
@@ -988,11 +988,11 @@ rtdelete(Relation r, ItemPointer tid)
static void
initRtstate(RTSTATE * rtstate, Relation index)
{
- RegProcedure union_proc,
- size_proc,
- inter_proc;
- func_ptr user_fn;
- int pronargs;
+ RegProcedure union_proc,
+ size_proc,
+ inter_proc;
+ func_ptr user_fn;
+ int pronargs;
union_proc = index_getprocid(index, 1, RT_UNION_PROC);
size_proc = index_getprocid(index, 1, RT_SIZE_PROC);
@@ -1011,18 +1011,18 @@ initRtstate(RTSTATE * rtstate, Relation index)
void
_rtdump(Relation r)
{
- Buffer buf;
- Page page;
- OffsetNumber offnum,
- maxoff;
- BlockNumber blkno;
- BlockNumber nblocks;
+ Buffer buf;
+ Page page;
+ OffsetNumber offnum,
+ maxoff;
+ BlockNumber blkno;
+ BlockNumber nblocks;
RTreePageOpaque po;
- IndexTuple itup;
- BlockNumber itblkno;
- OffsetNumber itoffno;
- char *datum;
- char *itkey;
+ IndexTuple itup;
+ BlockNumber itblkno;
+ OffsetNumber itoffno;
+ char *datum;
+ char *itkey;
nblocks = RelationGetNumberOfBlocks(r);
for (blkno = 0; blkno < nblocks; blkno++)
diff --git a/src/backend/access/rtree/rtscan.c b/src/backend/access/rtree/rtscan.c
index 26590059d6c..2a4810ccae3 100644
--- a/src/backend/access/rtree/rtscan.c
+++ b/src/backend/access/rtree/rtscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.11 1997/09/07 04:39:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.12 1997/09/08 02:21:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,8 +28,8 @@
/* routines defined and used here */
-static void rtregscan(IndexScanDesc s);
-static void rtdropscan(IndexScanDesc s);
+static void rtregscan(IndexScanDesc s);
+static void rtdropscan(IndexScanDesc s);
static void
rtadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum);
@@ -52,9 +52,9 @@ adjustiptr(IndexScanDesc s, ItemPointer iptr,
typedef struct RTScanListData
{
- IndexScanDesc rtsl_scan;
+ IndexScanDesc rtsl_scan;
struct RTScanListData *rtsl_next;
-} RTScanListData;
+} RTScanListData;
typedef RTScanListData *RTScanList;
@@ -67,7 +67,7 @@ rtbeginscan(Relation r,
uint16 nkeys,
ScanKey key)
{
- IndexScanDesc s;
+ IndexScanDesc s;
RelationSetLockForRead(r);
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
@@ -80,8 +80,8 @@ void
rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
{
RTreeScanOpaque p;
- RegProcedure internal_proc;
- int i;
+ RegProcedure internal_proc;
+ int i;
if (!IndexScanIsValid(s))
{
@@ -177,9 +177,9 @@ void
rtmarkpos(IndexScanDesc s)
{
RTreeScanOpaque p;
- RTSTACK *o,
- *n,
- *tmp;
+ RTSTACK *o,
+ *n,
+ *tmp;
s->currentMarkData = s->currentItemData;
p = (RTreeScanOpaque) s->opaque;
@@ -210,9 +210,9 @@ void
rtrestrpos(IndexScanDesc s)
{
RTreeScanOpaque p;
- RTSTACK *o,
- *n,
- *tmp;
+ RTSTACK *o,
+ *n,
+ *tmp;
s->currentItemData = s->currentMarkData;
p = (RTreeScanOpaque) s->opaque;
@@ -260,7 +260,7 @@ rtendscan(IndexScanDesc s)
static void
rtregscan(IndexScanDesc s)
{
- RTScanList l;
+ RTScanList l;
l = (RTScanList) palloc(sizeof(RTScanListData));
l->rtsl_scan = s;
@@ -271,8 +271,8 @@ rtregscan(IndexScanDesc s)
static void
rtdropscan(IndexScanDesc s)
{
- RTScanList l;
- RTScanList prev;
+ RTScanList l;
+ RTScanList prev;
prev = (RTScanList) NULL;
@@ -297,8 +297,8 @@ rtdropscan(IndexScanDesc s)
void
rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum)
{
- RTScanList l;
- Oid relid;
+ RTScanList l;
+ Oid relid;
relid = r->rd_id;
for (l = RTScans; l != (RTScanList) NULL; l = l->rtsl_next)
@@ -352,7 +352,7 @@ adjustiptr(IndexScanDesc s,
BlockNumber blkno,
OffsetNumber offnum)
{
- OffsetNumber curoff;
+ OffsetNumber curoff;
RTreeScanOpaque so;
if (ItemPointerIsValid(iptr))
@@ -364,39 +364,43 @@ adjustiptr(IndexScanDesc s,
switch (op)
{
- case RTOP_DEL:
- /* back up one if we need to */
- if (curoff >= offnum)
- {
-
- if (curoff > FirstOffsetNumber)
- {
- /* just adjust the item pointer */
- ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
- }
- else
+ case RTOP_DEL:
+ /* back up one if we need to */
+ if (curoff >= offnum)
{
- /* remember that we're before the current tuple */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags |= RTS_CURBEFORE;
+
+ if (curoff > FirstOffsetNumber)
+ {
+ /* just adjust the item pointer */
+ ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
+ }
else
- so->s_flags |= RTS_MRKBEFORE;
+ {
+
+ /*
+ * remember that we're before the current
+ * tuple
+ */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags |= RTS_CURBEFORE;
+ else
+ so->s_flags |= RTS_MRKBEFORE;
+ }
}
- }
- break;
-
- case RTOP_SPLIT:
- /* back to start of page on split */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags &= ~RTS_CURBEFORE;
- else
- so->s_flags &= ~RTS_MRKBEFORE;
- break;
-
- default:
- elog(WARN, "Bad operation in rtree scan adjust: %d", op);
+ break;
+
+ case RTOP_SPLIT:
+ /* back to start of page on split */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags &= ~RTS_CURBEFORE;
+ else
+ so->s_flags &= ~RTS_MRKBEFORE;
+ break;
+
+ default:
+ elog(WARN, "Bad operation in rtree scan adjust: %d", op);
}
}
}
diff --git a/src/backend/access/rtree/rtstrat.c b/src/backend/access/rtree/rtstrat.c
index c71059d3f09..028625d48a1 100644
--- a/src/backend/access/rtree/rtstrat.c
+++ b/src/backend/access/rtree/rtstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.7 1997/09/07 04:39:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.8 1997/09/08 02:21:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -118,7 +118,7 @@ static StrategyNumber RTNegateCommute[RTNStrategies] = {
*/
/* if you only have "contained-by", how do you determine equality? */
-static uint16 RTContainedByTermData[] = {
+static uint16 RTContainedByTermData[] = {
2, /* make two comparisons */
RTContainedByStrategyNumber,/* use "a contained-by b" */
0x0, /* without any magic */
@@ -127,7 +127,7 @@ static uint16 RTContainedByTermData[] = {
};
/* if you only have "contains", how do you determine equality? */
-static uint16 RTContainsTermData[] = {
+static uint16 RTContainsTermData[] = {
2, /* make two comparisons */
RTContainsStrategyNumber, /* use "a contains b" */
0x0, /* without any magic */
@@ -204,7 +204,7 @@ static StrategyNumber RTOperMap[RTNStrategies] = {
RTOverlapStrategyNumber
};
-static StrategyNumber
+static StrategyNumber
RelationGetRTStrategy(Relation r,
AttrNumber attnum,
RegProcedure proc)
@@ -231,8 +231,8 @@ RTMapOperator(Relation r,
AttrNumber attnum,
RegProcedure proc)
{
- StrategyNumber procstrat;
- StrategyMap strategyMap;
+ StrategyNumber procstrat;
+ StrategyMap strategyMap;
procstrat = RelationGetRTStrategy(r, attnum, proc);
strategyMap = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(r),
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 6d721fe96af..03b82872fd6 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.10 1997/09/07 04:39:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.11 1997/09/08 02:21:14 momjian Exp $
*
* NOTES
* This file contains the high level access-method interface to the
@@ -26,9 +26,9 @@
#include <storage/spin.h>
#include <commands/vacuum.h>
-static int RecoveryCheckingEnabled(void);
-static void TransRecover(Relation logRelation);
-static bool TransactionLogTest(TransactionId transactionId, XidStatus status);
+static int RecoveryCheckingEnabled(void);
+static void TransRecover(Relation logRelation);
+static bool TransactionLogTest(TransactionId transactionId, XidStatus status);
static void
TransactionLogUpdate(TransactionId transactionId,
XidStatus status);
@@ -40,18 +40,18 @@ TransactionLogUpdate(TransactionId transactionId,
* ----------------
*/
-Relation LogRelation = (Relation) NULL;
-Relation TimeRelation = (Relation) NULL;
-Relation VariableRelation = (Relation) NULL;
+Relation LogRelation = (Relation) NULL;
+Relation TimeRelation = (Relation) NULL;
+Relation VariableRelation = (Relation) NULL;
/* ----------------
* global variables holding cached transaction id's and statuses.
* ----------------
*/
-TransactionId cachedGetCommitTimeXid;
-AbsoluteTime cachedGetCommitTime;
-TransactionId cachedTestXid;
-XidStatus cachedTestXidStatus;
+TransactionId cachedGetCommitTimeXid;
+AbsoluteTime cachedGetCommitTime;
+TransactionId cachedTestXid;
+XidStatus cachedTestXidStatus;
/* ----------------
* transaction system constants
@@ -65,11 +65,11 @@ XidStatus cachedTestXidStatus;
* FirstTransactionId. -cim 3/23/90
* ----------------------------------------------------------------
*/
-TransactionId NullTransactionId = (TransactionId) 0;
+TransactionId NullTransactionId = (TransactionId) 0;
-TransactionId AmiTransactionId = (TransactionId) 512;
+TransactionId AmiTransactionId = (TransactionId) 512;
-TransactionId FirstTransactionId = (TransactionId) 514;
+TransactionId FirstTransactionId = (TransactionId) 514;
/* ----------------
* transaction recovery state variables
@@ -83,19 +83,19 @@ TransactionId FirstTransactionId = (TransactionId) 514;
* goes from zero to one. -cim 3/21/90
* ----------------
*/
-int RecoveryCheckingEnableState = 0;
+int RecoveryCheckingEnableState = 0;
/* ------------------
* spinlock for oid generation
* -----------------
*/
-extern int OidGenLockId;
+extern int OidGenLockId;
/* ----------------
* globals that must be reset at abort
* ----------------
*/
-extern bool BuildingBtree;
+extern bool BuildingBtree;
/* ----------------
@@ -134,14 +134,14 @@ SetRecoveryCheckingEnabled(bool state)
* --------------------------------
*/
-static bool /* true/false: does transaction id have
+static bool /* true/false: does transaction id have
* specified status? */
TransactionLogTest(TransactionId transactionId, /* transaction id to test */
XidStatus status) /* transaction status */
{
- BlockNumber blockNumber;
- XidStatus xidstatus; /* recorded status of xid */
- bool fail = false; /* success/failure */
+ BlockNumber blockNumber;
+ XidStatus xidstatus; /* recorded status of xid */
+ bool fail = false; /* success/failure */
/* ----------------
* during initialization consider all transactions
@@ -202,9 +202,9 @@ static void
TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
XidStatus status) /* new trans status */
{
- BlockNumber blockNumber;
- bool fail = false; /* success/failure */
- AbsoluteTime currentTime;/* time of this transaction */
+ BlockNumber blockNumber;
+ bool fail = false; /* success/failure */
+ AbsoluteTime currentTime; /* time of this transaction */
/* ----------------
* during initialization we don't record any updates.
@@ -276,9 +276,9 @@ AbsoluteTime /* commit time of transaction id */
TransactionIdGetCommitTime(TransactionId transactionId) /* transaction id to
* test */
{
- BlockNumber blockNumber;
- AbsoluteTime commitTime; /* commit time */
- bool fail = false; /* success/failure */
+ BlockNumber blockNumber;
+ AbsoluteTime commitTime; /* commit time */
+ bool fail = false; /* success/failure */
/* ----------------
* return invalid if we aren't running yet...
@@ -471,9 +471,9 @@ TransRecover(Relation logRelation)
void
InitializeTransactionLog(void)
{
- Relation logRelation;
- Relation timeRelation;
- MemoryContext oldContext;
+ Relation logRelation;
+ Relation timeRelation;
+ MemoryContext oldContext;
/* ----------------
* don't do anything during bootstrapping
diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c
index 9809190c942..acdfe93ea90 100644
--- a/src/backend/access/transam/transsup.c
+++ b/src/backend/access/transam/transsup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.10 1997/09/07 04:39:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.11 1997/09/08 02:21:18 momjian Exp $
*
* NOTES
* This file contains support functions for the high
@@ -63,7 +63,7 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
* test */
BlockNumber * blockNumberOutP)
{
- long itemsPerBlock = 0;
+ long itemsPerBlock = 0;
/* ----------------
* we calculate the block number of our transaction
@@ -108,17 +108,17 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
*/
#ifdef NOT_USED
-static XidStatus
+static XidStatus
TransBlockGetLastTransactionIdStatus(Block tblock,
TransactionId baseXid,
TransactionId * returnXidP)
{
- Index index;
- Index maxIndex;
- bits8 bit1;
- bits8 bit2;
- BitIndex offset;
- XidStatus xstatus;
+ Index index;
+ Index maxIndex;
+ bits8 bit1;
+ bits8 bit2;
+ BitIndex offset;
+ XidStatus xstatus;
/* ----------------
* sanity check
@@ -188,14 +188,14 @@ TransBlockGetLastTransactionIdStatus(Block tblock,
* --------------------------------
*/
-static XidStatus
+static XidStatus
TransBlockGetXidStatus(Block tblock,
TransactionId transactionId)
{
- Index index;
- bits8 bit1;
- bits8 bit2;
- BitIndex offset;
+ Index index;
+ bits8 bit1;
+ bits8 bit2;
+ BitIndex offset;
/* ----------------
* sanity check
@@ -245,8 +245,8 @@ TransBlockSetXidStatus(Block tblock,
TransactionId transactionId,
XidStatus xstatus)
{
- Index index;
- BitIndex offset;
+ Index index;
+ BitIndex offset;
/* ----------------
* sanity check
@@ -275,23 +275,23 @@ TransBlockSetXidStatus(Block tblock,
*/
switch (xstatus)
{
- case XID_COMMIT: /* set 10 */
- BitArraySetBit((BitArray) tblock, offset);
- BitArrayClearBit((BitArray) tblock, offset + 1);
- break;
- case XID_ABORT: /* set 01 */
- BitArrayClearBit((BitArray) tblock, offset);
- BitArraySetBit((BitArray) tblock, offset + 1);
- break;
- case XID_INPROGRESS: /* set 00 */
- BitArrayClearBit((BitArray) tblock, offset);
- BitArrayClearBit((BitArray) tblock, offset + 1);
- break;
- default:
- elog(NOTICE,
- "TransBlockSetXidStatus: invalid status: %d (ignored)",
- xstatus);
- break;
+ case XID_COMMIT: /* set 10 */
+ BitArraySetBit((BitArray) tblock, offset);
+ BitArrayClearBit((BitArray) tblock, offset + 1);
+ break;
+ case XID_ABORT: /* set 01 */
+ BitArrayClearBit((BitArray) tblock, offset);
+ BitArraySetBit((BitArray) tblock, offset + 1);
+ break;
+ case XID_INPROGRESS: /* set 00 */
+ BitArrayClearBit((BitArray) tblock, offset);
+ BitArrayClearBit((BitArray) tblock, offset + 1);
+ break;
+ default:
+ elog(NOTICE,
+ "TransBlockSetXidStatus: invalid status: %d (ignored)",
+ xstatus);
+ break;
}
}
@@ -302,12 +302,12 @@ TransBlockSetXidStatus(Block tblock,
* specified transaction id in the trans block.
* --------------------------------
*/
-static AbsoluteTime
+static AbsoluteTime
TransBlockGetCommitTime(Block tblock,
TransactionId transactionId)
{
- Index index;
- AbsoluteTime *timeArray;
+ Index index;
+ AbsoluteTime *timeArray;
/* ----------------
* sanity check
@@ -348,8 +348,8 @@ TransBlockSetCommitTime(Block tblock,
TransactionId transactionId,
AbsoluteTime commitTime)
{
- Index index;
- AbsoluteTime *timeArray;
+ Index index;
+ AbsoluteTime *timeArray;
/* ----------------
* sanity check
@@ -394,10 +394,10 @@ TransBlockNumberGetXidStatus(Relation relation,
TransactionId xid,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing xstatus */
- XidStatus xstatus; /* recorded status of xid */
- bool localfail; /* bool used if failP = NULL */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing xstatus */
+ XidStatus xstatus; /* recorded status of xid */
+ bool localfail; /* bool used if failP = NULL */
/* ----------------
* SOMEDAY place a read lock on the log relation
@@ -451,9 +451,9 @@ TransBlockNumberSetXidStatus(Relation relation,
XidStatus xstatus,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing xstatus */
- bool localfail; /* bool used if failP = NULL */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing xstatus */
+ bool localfail; /* bool used if failP = NULL */
/* ----------------
* SOMEDAY gain exclusive access to the log relation
@@ -504,10 +504,10 @@ TransBlockNumberGetCommitTime(Relation relation,
TransactionId xid,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
- AbsoluteTime xtime; /* commit time */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing commit time */
+ bool localfail; /* bool used if failP = NULL */
+ AbsoluteTime xtime; /* commit time */
/* ----------------
* SOMEDAY place a read lock on the time relation
@@ -565,9 +565,9 @@ TransBlockNumberSetCommitTime(Relation relation,
AbsoluteTime xtime,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing commit time */
+ bool localfail; /* bool used if failP = NULL */
/* ----------------
* SOMEDAY gain exclusive access to the time relation
@@ -620,11 +620,11 @@ TransGetLastRecordedTransaction(Relation relation,
* id */
bool * failP)
{
- BlockNumber blockNumber;/* block number */
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing xid status */
- BlockNumber n; /* number of blocks in the relation */
- TransactionId baseXid;
+ BlockNumber blockNumber; /* block number */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing xid status */
+ BlockNumber n; /* number of blocks in the relation */
+ TransactionId baseXid;
(*failP) = false;
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 8b4b8557eb2..fb44b210bed 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.10 1997/09/07 04:39:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.11 1997/09/08 02:21:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,18 +20,18 @@
#include <access/heapam.h>
#include <catalog/catname.h>
-static void GetNewObjectIdBlock(Oid * oid_return, int oid_block_size);
-static void VariableRelationGetNextOid(Oid * oid_return);
-static void VariableRelationGetNextXid(TransactionId * xidP);
-static void VariableRelationPutLastXid(TransactionId xid);
-static void VariableRelationPutNextOid(Oid * oidP);
-static void VariableRelationGetLastXid(TransactionId * xidP);
+static void GetNewObjectIdBlock(Oid * oid_return, int oid_block_size);
+static void VariableRelationGetNextOid(Oid * oid_return);
+static void VariableRelationGetNextXid(TransactionId * xidP);
+static void VariableRelationPutLastXid(TransactionId xid);
+static void VariableRelationPutNextOid(Oid * oidP);
+static void VariableRelationGetLastXid(TransactionId * xidP);
/* ---------------------
* spin lock for oid generation
* ---------------------
*/
-int OidGenLockId;
+int OidGenLockId;
/* ----------------------------------------------------------------
* variable relation query/update routines
@@ -45,7 +45,7 @@ int OidGenLockId;
static void
VariableRelationGetNextXid(TransactionId * xidP)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -87,7 +87,7 @@ VariableRelationGetNextXid(TransactionId * xidP)
static void
VariableRelationGetLastXid(TransactionId * xidP)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -130,9 +130,9 @@ VariableRelationGetLastXid(TransactionId * xidP)
void
VariableRelationPutNextXid(TransactionId xid)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
- int flushmode;
+ int flushmode;
/* ----------------
* We assume that a spinlock has been acquire to guarantee
@@ -176,7 +176,7 @@ VariableRelationPutNextXid(TransactionId xid)
static void
VariableRelationPutLastXid(TransactionId xid)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -219,7 +219,7 @@ VariableRelationPutLastXid(TransactionId xid)
static void
VariableRelationGetNextOid(Oid * oid_return)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -289,7 +289,7 @@ VariableRelationGetNextOid(Oid * oid_return)
static void
VariableRelationPutNextOid(Oid * oidP)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -383,13 +383,13 @@ VariableRelationPutNextOid(Oid * oidP)
#define VAR_XID_PREFETCH 32
-static int prefetched_xid_count = 0;
+static int prefetched_xid_count = 0;
static TransactionId next_prefetched_xid;
void
GetNewTransactionId(TransactionId * xid)
{
- TransactionId nextid;
+ TransactionId nextid;
/* ----------------
* during bootstrap initialization, we return the special
@@ -457,7 +457,7 @@ GetNewTransactionId(TransactionId * xid)
void
UpdateLastCommittedXid(TransactionId xid)
{
- TransactionId lastid;
+ TransactionId lastid;
/*
@@ -501,7 +501,7 @@ GetNewObjectIdBlock(Oid * oid_return, /* place to return the new object
* id */
int oid_block_size) /* number of oids desired */
{
- Oid nextoid;
+ Oid nextoid;
/* ----------------
* SOMEDAY obtain exclusive access to the variable relation page
@@ -554,8 +554,8 @@ GetNewObjectIdBlock(Oid * oid_return, /* place to return the new object
#define VAR_OID_PREFETCH 32
-static int prefetched_oid_count = 0;
-static Oid next_prefetched_oid;
+static int prefetched_oid_count = 0;
+static Oid next_prefetched_oid;
void
GetNewObjectId(Oid * oid_return)/* place to return the new object id */
@@ -568,7 +568,7 @@ GetNewObjectId(Oid * oid_return)/* place to return the new object id */
if (prefetched_oid_count == 0)
{
- int oid_block_size = VAR_OID_PREFETCH;
+ int oid_block_size = VAR_OID_PREFETCH;
/* ----------------
* during bootstrap time, we want to allocate oids
@@ -609,7 +609,7 @@ GetNewObjectId(Oid * oid_return)/* place to return the new object id */
void
CheckMaxObjectId(Oid assigned_oid)
{
- Oid pass_oid;
+ Oid pass_oid;
if (prefetched_oid_count == 0) /* make sure next/max is set, or
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index da32570d87b..b6ff2dd2963 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.14 1997/09/07 04:39:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.15 1997/09/08 02:21:22 momjian Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -151,20 +151,20 @@
#include <commands/async.h>
#include <commands/sequence.h>
-static void AbortTransaction(void);
-static void AtAbort_Cache(void);
-static void AtAbort_Locks(void);
-static void AtAbort_Memory(void);
-static void AtCommit_Cache(void);
-static void AtCommit_Locks(void);
-static void AtCommit_Memory(void);
-static void AtStart_Cache(void);
-static void AtStart_Locks(void);
-static void AtStart_Memory(void);
-static void CommitTransaction(void);
-static void RecordTransactionAbort(void);
-static void RecordTransactionCommit(void);
-static void StartTransaction(void);
+static void AbortTransaction(void);
+static void AtAbort_Cache(void);
+static void AtAbort_Locks(void);
+static void AtAbort_Memory(void);
+static void AtCommit_Cache(void);
+static void AtCommit_Locks(void);
+static void AtCommit_Memory(void);
+static void AtStart_Cache(void);
+static void AtStart_Locks(void);
+static void AtStart_Memory(void);
+static void CommitTransaction(void);
+static void RecordTransactionAbort(void);
+static void RecordTransactionCommit(void);
+static void StartTransaction(void);
/* ----------------
* global variables holding the current transaction state.
@@ -202,17 +202,17 @@ TransactionState CurrentTransactionState =
* V1 transaction system. -cim 3/18/90
* ----------------
*/
-TransactionId DisabledTransactionId = (TransactionId) - 1;
+TransactionId DisabledTransactionId = (TransactionId) - 1;
-CommandId DisabledCommandId = (CommandId) - 1;
+CommandId DisabledCommandId = (CommandId) - 1;
-AbsoluteTime DisabledStartTime = (AbsoluteTime) BIG_ABSTIME; /* 1073741823; */
+AbsoluteTime DisabledStartTime = (AbsoluteTime) BIG_ABSTIME; /* 1073741823; */
/* ----------------
* overflow flag
* ----------------
*/
-bool CommandIdCounterOverflowFlag;
+bool CommandIdCounterOverflowFlag;
/* ----------------
* catalog creation transaction bootstrapping flag.
@@ -220,7 +220,7 @@ bool CommandIdCounterOverflowFlag;
* state stuff. -cim 3/19/90
* ----------------
*/
-bool AMI_OVERRIDE = false;
+bool AMI_OVERRIDE = false;
/* ----------------------------------------------------------------
* transaction state accessors
@@ -239,7 +239,7 @@ bool AMI_OVERRIDE = false;
* only do writes as necessary.
* --------------------------------
*/
-static int TransactionFlushState = 1;
+static int TransactionFlushState = 1;
int
TransactionFlushEnabled(void)
@@ -270,18 +270,18 @@ IsTransactionState(void)
switch (s->state)
{
- case TRANS_DEFAULT:
- return false;
- case TRANS_START:
- return true;
- case TRANS_INPROGRESS:
- return true;
- case TRANS_COMMIT:
- return true;
- case TRANS_ABORT:
- return true;
- case TRANS_DISABLED:
- return false;
+ case TRANS_DEFAULT:
+ return false;
+ case TRANS_START:
+ return true;
+ case TRANS_INPROGRESS:
+ return true;
+ case TRANS_COMMIT:
+ return true;
+ case TRANS_ABORT:
+ return true;
+ case TRANS_DISABLED:
+ return false;
}
/*
@@ -317,7 +317,7 @@ IsAbortedTransactionBlockState()
* themselves.
* --------------------------------
*/
-int SavedTransactionState;
+int SavedTransactionState;
void
OverrideTransactionSystem(bool flag)
@@ -564,8 +564,8 @@ AtStart_Locks()
static void
AtStart_Memory()
{
- Portal portal;
- MemoryContext portalContext;
+ Portal portal;
+ MemoryContext portalContext;
/* ----------------
* get the blank portal and its memory context
@@ -601,8 +601,8 @@ AtStart_Memory()
static void
RecordTransactionCommit()
{
- TransactionId xid;
- int leak;
+ TransactionId xid;
+ int leak;
/* ----------------
* get the current transaction id
@@ -701,7 +701,7 @@ AtCommit_Memory()
static void
RecordTransactionAbort()
{
- TransactionId xid;
+ TransactionId xid;
/* ----------------
* get the current transaction id
@@ -994,73 +994,73 @@ StartTransactionCommand()
switch (s->blockState)
{
- /* ----------------
- * if we aren't in a transaction block, we
- * just do our usual start transaction.
- * ----------------
- */
- case TBLOCK_DEFAULT:
- StartTransaction();
- break;
-
- /* ----------------
- * We should never experience this -- if we do it
- * means the BEGIN state was not changed in the previous
- * CommitTransactionCommand(). If we get it, we print
- * a warning and change to the in-progress state.
- * ----------------
- */
- case TBLOCK_BEGIN:
- elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_BEGIN");
- s->blockState = TBLOCK_INPROGRESS;
- break;
-
- /* ----------------
- * This is the case when are somewhere in a transaction
- * block and about to start a new command. For now we
- * do nothing but someday we may do command-local resource
- * initialization.
- * ----------------
- */
- case TBLOCK_INPROGRESS:
- break;
-
- /* ----------------
- * As with BEGIN, we should never experience this --
- * if we do it means the END state was not changed in the
- * previous CommitTransactionCommand(). If we get it, we
- * print a warning, commit the transaction, start a new
- * transaction and change to the default state.
- * ----------------
- */
- case TBLOCK_END:
- elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_END");
- s->blockState = TBLOCK_DEFAULT;
- CommitTransaction();
- StartTransaction();
- break;
-
- /* ----------------
- * Here we are in the middle of a transaction block but
- * one of the commands caused an abort so we do nothing
- * but remain in the abort state. Eventually we will get
- * to the "END TRANSACTION" which will set things straight.
- * ----------------
- */
- case TBLOCK_ABORT:
- break;
-
- /* ----------------
- * This means we somehow aborted and the last call to
- * CommitTransactionCommand() didn't clear the state so
- * we remain in the ENDABORT state and mabey next time
- * we get to CommitTransactionCommand() the state will
- * get reset to default.
- * ----------------
- */
- case TBLOCK_ENDABORT:
- elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_ENDABORT");
- break;
+ /* ----------------
+ * if we aren't in a transaction block, we
+ * just do our usual start transaction.
+ * ----------------
+ */
+ case TBLOCK_DEFAULT:
+ StartTransaction();
+ break;
+
+ /* ----------------
+ * We should never experience this -- if we do it
+ * means the BEGIN state was not changed in the previous
+ * CommitTransactionCommand(). If we get it, we print
+ * a warning and change to the in-progress state.
+ * ----------------
+ */
+ case TBLOCK_BEGIN:
+ elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_BEGIN");
+ s->blockState = TBLOCK_INPROGRESS;
+ break;
+
+ /* ----------------
+ * This is the case when are somewhere in a transaction
+ * block and about to start a new command. For now we
+ * do nothing but someday we may do command-local resource
+ * initialization.
+ * ----------------
+ */
+ case TBLOCK_INPROGRESS:
+ break;
+
+ /* ----------------
+ * As with BEGIN, we should never experience this --
+ * if we do it means the END state was not changed in the
+ * previous CommitTransactionCommand(). If we get it, we
+ * print a warning, commit the transaction, start a new
+ * transaction and change to the default state.
+ * ----------------
+ */
+ case TBLOCK_END:
+ elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_END");
+ s->blockState = TBLOCK_DEFAULT;
+ CommitTransaction();
+ StartTransaction();
+ break;
+
+ /* ----------------
+ * Here we are in the middle of a transaction block but
+ * one of the commands caused an abort so we do nothing
+ * but remain in the abort state. Eventually we will get
+ * to the "END TRANSACTION" which will set things straight.
+ * ----------------
+ */
+ case TBLOCK_ABORT:
+ break;
+
+ /* ----------------
+ * This means we somehow aborted and the last call to
+ * CommitTransactionCommand() didn't clear the state so
+ * we remain in the ENDABORT state and mabey next time
+ * we get to CommitTransactionCommand() the state will
+ * get reset to default.
+ * ----------------
+ */
+ case TBLOCK_ENDABORT:
+ elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_ENDABORT");
+ break;
}
}
@@ -1075,75 +1075,75 @@ CommitTransactionCommand()
switch (s->blockState)
{
- /* ----------------
- * if we aren't in a transaction block, we
- * just do our usual transaction commit
- * ----------------
- */
- case TBLOCK_DEFAULT:
- CommitTransaction();
- break;
-
- /* ----------------
- * This is the case right after we get a "BEGIN TRANSACTION"
- * command, but the user hasn't done anything else yet, so
- * we change to the "transaction block in progress" state
- * and return.
- * ----------------
- */
- case TBLOCK_BEGIN:
- s->blockState = TBLOCK_INPROGRESS;
- break;
-
- /* ----------------
- * This is the case when we have finished executing a command
- * someplace within a transaction block. We increment the
- * command counter and return. Someday we may free resources
- * local to the command.
- *
- * That someday is today, at least for memory allocated by
- * command in the BlankPortal' HeapMemory context.
- * - vadim 03/25/97
- * ----------------
- */
- case TBLOCK_INPROGRESS:
- CommandCounterIncrement();
+ /* ----------------
+ * if we aren't in a transaction block, we
+ * just do our usual transaction commit
+ * ----------------
+ */
+ case TBLOCK_DEFAULT:
+ CommitTransaction();
+ break;
+
+ /* ----------------
+ * This is the case right after we get a "BEGIN TRANSACTION"
+ * command, but the user hasn't done anything else yet, so
+ * we change to the "transaction block in progress" state
+ * and return.
+ * ----------------
+ */
+ case TBLOCK_BEGIN:
+ s->blockState = TBLOCK_INPROGRESS;
+ break;
+
+ /* ----------------
+ * This is the case when we have finished executing a command
+ * someplace within a transaction block. We increment the
+ * command counter and return. Someday we may free resources
+ * local to the command.
+ *
+ * That someday is today, at least for memory allocated by
+ * command in the BlankPortal' HeapMemory context.
+ * - vadim 03/25/97
+ * ----------------
+ */
+ case TBLOCK_INPROGRESS:
+ CommandCounterIncrement();
#ifdef TBL_FREE_CMD_MEMORY
- EndPortalAllocMode();
- StartPortalAllocMode(DefaultAllocMode, 0);
+ EndPortalAllocMode();
+ StartPortalAllocMode(DefaultAllocMode, 0);
#endif
- break;
-
- /* ----------------
- * This is the case when we just got the "END TRANSACTION"
- * statement, so we go back to the default state and
- * commit the transaction.
- * ----------------
- */
- case TBLOCK_END:
- s->blockState = TBLOCK_DEFAULT;
- CommitTransaction();
- break;
-
- /* ----------------
- * Here we are in the middle of a transaction block but
- * one of the commands caused an abort so we do nothing
- * but remain in the abort state. Eventually we will get
- * to the "END TRANSACTION" which will set things straight.
- * ----------------
- */
- case TBLOCK_ABORT:
- break;
-
- /* ----------------
- * Here we were in an aborted transaction block which
- * just processed the "END TRANSACTION" command from the
- * user, so now we return the to default state.
- * ----------------
- */
- case TBLOCK_ENDABORT:
- s->blockState = TBLOCK_DEFAULT;
- break;
+ break;
+
+ /* ----------------
+ * This is the case when we just got the "END TRANSACTION"
+ * statement, so we go back to the default state and
+ * commit the transaction.
+ * ----------------
+ */
+ case TBLOCK_END:
+ s->blockState = TBLOCK_DEFAULT;
+ CommitTransaction();
+ break;
+
+ /* ----------------
+ * Here we are in the middle of a transaction block but
+ * one of the commands caused an abort so we do nothing
+ * but remain in the abort state. Eventually we will get
+ * to the "END TRANSACTION" which will set things straight.
+ * ----------------
+ */
+ case TBLOCK_ABORT:
+ break;
+
+ /* ----------------
+ * Here we were in an aborted transaction block which
+ * just processed the "END TRANSACTION" command from the
+ * user, so now we return the to default state.
+ * ----------------
+ */
+ case TBLOCK_ENDABORT:
+ s->blockState = TBLOCK_DEFAULT;
+ break;
}
}
@@ -1158,71 +1158,71 @@ AbortCurrentTransaction()
switch (s->blockState)
{
- /* ----------------
- * if we aren't in a transaction block, we
- * just do our usual abort transaction.
- * ----------------
- */
- case TBLOCK_DEFAULT:
- AbortTransaction();
- break;
-
- /* ----------------
- * If we are in the TBLOCK_BEGIN it means something
- * screwed up right after reading "BEGIN TRANSACTION"
- * so we enter the abort state. Eventually an "END
- * TRANSACTION" will fix things.
- * ----------------
- */
- case TBLOCK_BEGIN:
- s->blockState = TBLOCK_ABORT;
- AbortTransaction();
- break;
-
- /* ----------------
- * This is the case when are somewhere in a transaction
- * block which aborted so we abort the transaction and
- * set the ABORT state. Eventually an "END TRANSACTION"
- * will fix things and restore us to a normal state.
- * ----------------
- */
- case TBLOCK_INPROGRESS:
- s->blockState = TBLOCK_ABORT;
- AbortTransaction();
- break;
-
- /* ----------------
- * Here, the system was fouled up just after the
- * user wanted to end the transaction block so we
- * abort the transaction and put us back into the
- * default state.
- * ----------------
- */
- case TBLOCK_END:
- s->blockState = TBLOCK_DEFAULT;
- AbortTransaction();
- break;
-
- /* ----------------
- * Here, we are already in an aborted transaction
- * state and are waiting for an "END TRANSACTION" to
- * come along and lo and behold, we abort again!
- * So we just remain in the abort state.
- * ----------------
- */
- case TBLOCK_ABORT:
- break;
-
- /* ----------------
- * Here we were in an aborted transaction block which
- * just processed the "END TRANSACTION" command but somehow
- * aborted again.. since we must have done the abort
- * processing, we return to the default state.
- * ----------------
- */
- case TBLOCK_ENDABORT:
- s->blockState = TBLOCK_DEFAULT;
- break;
+ /* ----------------
+ * if we aren't in a transaction block, we
+ * just do our usual abort transaction.
+ * ----------------
+ */
+ case TBLOCK_DEFAULT:
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * If we are in the TBLOCK_BEGIN it means something
+ * screwed up right after reading "BEGIN TRANSACTION"
+ * so we enter the abort state. Eventually an "END
+ * TRANSACTION" will fix things.
+ * ----------------
+ */
+ case TBLOCK_BEGIN:
+ s->blockState = TBLOCK_ABORT;
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * This is the case when are somewhere in a transaction
+ * block which aborted so we abort the transaction and
+ * set the ABORT state. Eventually an "END TRANSACTION"
+ * will fix things and restore us to a normal state.
+ * ----------------
+ */
+ case TBLOCK_INPROGRESS:
+ s->blockState = TBLOCK_ABORT;
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * Here, the system was fouled up just after the
+ * user wanted to end the transaction block so we
+ * abort the transaction and put us back into the
+ * default state.
+ * ----------------
+ */
+ case TBLOCK_END:
+ s->blockState = TBLOCK_DEFAULT;
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * Here, we are already in an aborted transaction
+ * state and are waiting for an "END TRANSACTION" to
+ * come along and lo and behold, we abort again!
+ * So we just remain in the abort state.
+ * ----------------
+ */
+ case TBLOCK_ABORT:
+ break;
+
+ /* ----------------
+ * Here we were in an aborted transaction block which
+ * just processed the "END TRANSACTION" command but somehow
+ * aborted again.. since we must have done the abort
+ * processing, we return to the default state.
+ * ----------------
+ */
+ case TBLOCK_ENDABORT:
+ s->blockState = TBLOCK_DEFAULT;
+ break;
}
}
diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c
index 910d6ac7320..9cfc8235d43 100644
--- a/src/backend/access/transam/xid.c
+++ b/src/backend/access/transam/xid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.8 1997/09/07 04:39:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.9 1997/09/08 02:21:24 momjian Exp $
*
* OLD COMMENTS
* XXX WARNING
@@ -50,11 +50,11 @@ xidin(char *representation)
}
/* XXX char16 name for catalogs */
-char *
+char *
xidout(TransactionId transactionId)
{
/* return(TransactionIdFormString(transactionId)); */
- char *representation;
+ char *representation;
/* maximum 32 bit unsigned integer representation takes 10 chars */
representation = palloc(11);