Commit 52f77df6 authored by Bruce Momjian's avatar Bruce Momjian

Ye-old pgindent run. Same 4-space tabs.

parent db451872
...@@ -144,7 +144,7 @@ array_texteq(ArrayType *array, char *value) ...@@ -144,7 +144,7 @@ array_texteq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 25, /* text */ return array_iterator((Oid) 25, /* text */
(Oid) 67, /* texteq */ (Oid) 67, /* texteq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -153,7 +153,7 @@ array_all_texteq(ArrayType *array, char *value) ...@@ -153,7 +153,7 @@ array_all_texteq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 25, /* text */ return array_iterator((Oid) 25, /* text */
(Oid) 67, /* texteq */ (Oid) 67, /* texteq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -162,7 +162,7 @@ array_textregexeq(ArrayType *array, char *value) ...@@ -162,7 +162,7 @@ array_textregexeq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 25, /* text */ return array_iterator((Oid) 25, /* text */
(Oid) 1254, /* textregexeq */ (Oid) 1254, /* textregexeq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -171,7 +171,7 @@ array_all_textregexeq(ArrayType *array, char *value) ...@@ -171,7 +171,7 @@ array_all_textregexeq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 25, /* text */ return array_iterator((Oid) 25, /* text */
(Oid) 1254, /* textregexeq */ (Oid) 1254, /* textregexeq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -185,7 +185,7 @@ array_varchareq(ArrayType *array, char *value) ...@@ -185,7 +185,7 @@ array_varchareq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1043, /* varchar */ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1070, /* varchareq */ (Oid) 1070, /* varchareq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -194,7 +194,7 @@ array_all_varchareq(ArrayType *array, char *value) ...@@ -194,7 +194,7 @@ array_all_varchareq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1043, /* varchar */ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1070, /* varchareq */ (Oid) 1070, /* varchareq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -203,7 +203,7 @@ array_varcharregexeq(ArrayType *array, char *value) ...@@ -203,7 +203,7 @@ array_varcharregexeq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1043, /* varchar */ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1254, /* textregexeq */ (Oid) 1254, /* textregexeq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -212,7 +212,7 @@ array_all_varcharregexeq(ArrayType *array, char *value) ...@@ -212,7 +212,7 @@ array_all_varcharregexeq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1043, /* varchar */ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1254, /* textregexeq */ (Oid) 1254, /* textregexeq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -226,7 +226,7 @@ array_bpchareq(ArrayType *array, char *value) ...@@ -226,7 +226,7 @@ array_bpchareq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1042, /* bpchar */ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1048, /* bpchareq */ (Oid) 1048, /* bpchareq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -235,7 +235,7 @@ array_all_bpchareq(ArrayType *array, char *value) ...@@ -235,7 +235,7 @@ array_all_bpchareq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1042, /* bpchar */ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1048, /* bpchareq */ (Oid) 1048, /* bpchareq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -244,7 +244,7 @@ array_bpcharregexeq(ArrayType *array, char *value) ...@@ -244,7 +244,7 @@ array_bpcharregexeq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1042, /* bpchar */ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1254, /* textregexeq */ (Oid) 1254, /* textregexeq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -253,7 +253,7 @@ array_all_bpcharregexeq(ArrayType *array, char *value) ...@@ -253,7 +253,7 @@ array_all_bpcharregexeq(ArrayType *array, char *value)
{ {
return array_iterator((Oid) 1042, /* bpchar */ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1254, /* textregexeq */ (Oid) 1254, /* textregexeq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -266,7 +266,7 @@ array_int4eq(ArrayType *array, int4 value) ...@@ -266,7 +266,7 @@ array_int4eq(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 65, /* int4eq */ (Oid) 65, /* int4eq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -275,7 +275,7 @@ array_all_int4eq(ArrayType *array, int4 value) ...@@ -275,7 +275,7 @@ array_all_int4eq(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 65, /* int4eq */ (Oid) 65, /* int4eq */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -284,7 +284,7 @@ array_int4ne(ArrayType *array, int4 value) ...@@ -284,7 +284,7 @@ array_int4ne(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 144, /* int4ne */ (Oid) 144, /* int4ne */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -293,7 +293,7 @@ array_all_int4ne(ArrayType *array, int4 value) ...@@ -293,7 +293,7 @@ array_all_int4ne(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 144, /* int4ne */ (Oid) 144, /* int4ne */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -302,7 +302,7 @@ array_int4gt(ArrayType *array, int4 value) ...@@ -302,7 +302,7 @@ array_int4gt(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 147, /* int4gt */ (Oid) 147, /* int4gt */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -311,7 +311,7 @@ array_all_int4gt(ArrayType *array, int4 value) ...@@ -311,7 +311,7 @@ array_all_int4gt(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 147, /* int4gt */ (Oid) 147, /* int4gt */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -320,7 +320,7 @@ array_int4ge(ArrayType *array, int4 value) ...@@ -320,7 +320,7 @@ array_int4ge(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 150, /* int4ge */ (Oid) 150, /* int4ge */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -329,7 +329,7 @@ array_all_int4ge(ArrayType *array, int4 value) ...@@ -329,7 +329,7 @@ array_all_int4ge(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 150, /* int4ge */ (Oid) 150, /* int4ge */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -338,7 +338,7 @@ array_int4lt(ArrayType *array, int4 value) ...@@ -338,7 +338,7 @@ array_int4lt(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 66, /* int4lt */ (Oid) 66, /* int4lt */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -347,7 +347,7 @@ array_all_int4lt(ArrayType *array, int4 value) ...@@ -347,7 +347,7 @@ array_all_int4lt(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 66, /* int4lt */ (Oid) 66, /* int4lt */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -356,7 +356,7 @@ array_int4le(ArrayType *array, int4 value) ...@@ -356,7 +356,7 @@ array_int4le(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 149, /* int4le */ (Oid) 149, /* int4le */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -365,7 +365,7 @@ array_all_int4le(ArrayType *array, int4 value) ...@@ -365,7 +365,7 @@ array_all_int4le(ArrayType *array, int4 value)
{ {
return array_iterator((Oid) 23, /* int4 */ return array_iterator((Oid) 23, /* int4 */
(Oid) 149, /* int4le */ (Oid) 149, /* int4le */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -376,7 +376,7 @@ array_oideq(ArrayType *array, Oid value) ...@@ -376,7 +376,7 @@ array_oideq(ArrayType *array, Oid value)
{ {
return array_iterator((Oid) 26, /* oid */ return array_iterator((Oid) 26, /* oid */
(Oid) 184, /* oideq */ (Oid) 184, /* oideq */
0, /* logical or */ 0, /* logical or */
array, (Datum) value); array, (Datum) value);
} }
...@@ -385,7 +385,7 @@ array_all_oidne(ArrayType *array, Oid value) ...@@ -385,7 +385,7 @@ array_all_oidne(ArrayType *array, Oid value)
{ {
return array_iterator((Oid) 26, /* int4 */ return array_iterator((Oid) 26, /* int4 */
(Oid) 185, /* oidne */ (Oid) 185, /* oidne */
1, /* logical and */ 1, /* logical and */
array, (Datum) value); array, (Datum) value);
} }
...@@ -393,8 +393,8 @@ array_all_oidne(ArrayType *array, Oid value) ...@@ -393,8 +393,8 @@ array_all_oidne(ArrayType *array, Oid value)
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define ARRAY_ITERATOR_H #define ARRAY_ITERATOR_H
static int32 array_iterator(Oid elemtype, Oid proc, int and, static int32 array_iterator(Oid elemtype, Oid proc, int and,
ArrayType *array, Datum value); ArrayType *array, Datum value);
int32 array_texteq(ArrayType *array, char *value); int32 array_texteq(ArrayType *array, char *value);
int32 array_all_texteq(ArrayType *array, char *value); int32 array_all_texteq(ArrayType *array, char *value);
...@@ -32,14 +32,15 @@ int32 array_all_int4lt(ArrayType *array, int4 value); ...@@ -32,14 +32,15 @@ int32 array_all_int4lt(ArrayType *array, int4 value);
int32 array_int4le(ArrayType *array, int4 value); int32 array_int4le(ArrayType *array, int4 value);
int32 array_all_int4le(ArrayType *array, int4 value); int32 array_all_int4le(ArrayType *array, int4 value);
int32 array_oideq(ArrayType *array, Oid value); int32 array_oideq(ArrayType *array, Oid value);
int32 array_all_oidne(ArrayType *array, Oid value); int32 array_all_oidne(ArrayType *array, Oid value);
#endif #endif
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <float.h> /* faked on sunos4 */ #include <float.h> /* faked on sunos4 */
#include <math.h> #include <math.h>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#ifndef MAXINT #ifndef MAXINT
#define MAXINT INT_MAX #define MAXINT INT_MAX
#endif #endif
#else #else
#ifdef HAVE_VALUES_H #ifdef HAVE_VALUES_H
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "utils/builtins.h" #include "utils/builtins.h"
#define HEXDIG(z) (z)<10 ? ((z)+'0') : ((z)-10+'A') #define HEXDIG(z) (z)<10 ? ((z)+'0') : ((z)-10+'A')
/* Modeled on struct varlena from postgres.h, bu data type is bits8 */ /* Modeled on struct varlena from postgres.h, bu data type is bits8 */
struct varbita struct varbita
...@@ -49,25 +49,25 @@ struct varbita ...@@ -49,25 +49,25 @@ struct varbita
#define VARBITEND(PTR) ((bits8 *) (PTR + VARSIZE(PTR))) #define VARBITEND(PTR) ((bits8 *) (PTR + VARSIZE(PTR)))
/* Mask that will cover exactly one byte, i.e. BITSPERBYTE bits */ /* Mask that will cover exactly one byte, i.e. BITSPERBYTE bits */
#define BITMASK 0xFF #define BITMASK 0xFF
#define BITHIGH 0x80 #define BITHIGH 0x80
bits8 * zpbitin(char *s, int dummy, int32 atttypmod); bits8 *zpbitin(char *s, int dummy, int32 atttypmod);
char * zpbitout(bits8 *s); char *zpbitout(bits8 *s);
char * zpbitsout(bits8 *s); char *zpbitsout(bits8 *s);
bits8 * varbitin(char *s, int dummy, int32 atttypmod); bits8 *varbitin(char *s, int dummy, int32 atttypmod);
bool biteq (bits8 *arg1, bits8 *arg2); bool biteq(bits8 *arg1, bits8 *arg2);
bool bitne (bits8 *arg1, bits8 *arg2); bool bitne(bits8 *arg1, bits8 *arg2);
bool bitge (bits8 *arg1, bits8 *arg2); bool bitge(bits8 *arg1, bits8 *arg2);
bool bitgt (bits8 *arg1, bits8 *arg2); bool bitgt(bits8 *arg1, bits8 *arg2);
bool bitle (bits8 *arg1, bits8 *arg2); bool bitle(bits8 *arg1, bits8 *arg2);
bool bitlt (bits8 *arg1, bits8 *arg2); bool bitlt(bits8 *arg1, bits8 *arg2);
int bitcmp (bits8 *arg1, bits8 *arg2); int bitcmp(bits8 *arg1, bits8 *arg2);
bits8 * bitand (bits8 * arg1, bits8 * arg2); bits8 *bitand(bits8 *arg1, bits8 *arg2);
bits8 * bitor (bits8 * arg1, bits8 * arg2); bits8 *bitor(bits8 *arg1, bits8 *arg2);
bits8 * bitxor (bits8 * arg1, bits8 * arg2); bits8 *bitxor(bits8 *arg1, bits8 *arg2);
bits8 * bitnot (bits8 * arg); bits8 *bitnot(bits8 *arg);
bits8 * bitshiftright (bits8 * arg, int shft); bits8 *bitshiftright(bits8 *arg, int shft);
bits8 * bitshiftleft (bits8 * arg, int shft); bits8 *bitshiftleft(bits8 *arg, int shft);
bits8 * bitcat (bits8 *arg1, bits8 *arg2); bits8 *bitcat(bits8 *arg1, bits8 *arg2);
bits8 * bitsubstr (bits8 *arg, int32 s, int32 l); bits8 *bitsubstr(bits8 *arg, int32 s, int32 l);
...@@ -2,21 +2,23 @@ ...@@ -2,21 +2,23 @@
#include "varbit.h" #include "varbit.h"
bits8 * varbit_in (char * s); bits8 *varbit_in(char *s);
char * varbit_out (bits8 *s); char *varbit_out(bits8 *s);
bits8 * bits8 *
varbit_in (char * s) { varbit_in(char *s)
return varbitin (s, 0, -1); {
return varbitin(s, 0, -1);
} }
/*char * /*char *
varbit_out (bits8 *s) { varbit_out (bits8 *s) {
return zpbitout(s); return zpbitout(s);
} }
*/ */
char * char *
varbit_out (bits8 *s) { varbit_out(bits8 *s)
return zpbitsout(s); {
return zpbitsout(s);
} }
This diff is collapsed.
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* Decode time string 00:00:00 through 24:00:00. * Decode time string 00:00:00 through 24:00:00.
*/ */
static int static int
decode_24h_time(char *str, struct tm *tm, double *fsec) decode_24h_time(char *str, struct tm * tm, double *fsec)
{ {
char *cp; char *cp;
...@@ -51,9 +51,7 @@ decode_24h_time(char *str, struct tm *tm, double *fsec) ...@@ -51,9 +51,7 @@ decode_24h_time(char *str, struct tm *tm, double *fsec)
*fsec = 0; *fsec = 0;
} }
else if (*cp != ':') else if (*cp != ':')
{
return -1; return -1;
}
else else
{ {
str = cp + 1; str = cp + 1;
...@@ -72,10 +70,10 @@ decode_24h_time(char *str, struct tm *tm, double *fsec) ...@@ -72,10 +70,10 @@ decode_24h_time(char *str, struct tm *tm, double *fsec)
} }
/* do a sanity check */ /* do a sanity check */
if ( (tm->tm_hour < 0) || (tm->tm_hour > 24) if ((tm->tm_hour < 0) || (tm->tm_hour > 24)
|| (tm->tm_min < 0) || (tm->tm_min > 59) || (tm->tm_min < 0) || (tm->tm_min > 59)
|| (tm->tm_sec < 0) || (tm->tm_sec > 59) || (tm->tm_sec < 0) || (tm->tm_sec > 59)
|| (*fsec < 0) ) || (*fsec < 0))
return -1; return -1;
return 0; return 0;
...@@ -265,7 +263,7 @@ currentdate() ...@@ -265,7 +263,7 @@ currentdate()
int4 int4
date2mjd(DateADT val) date2mjd(DateADT val)
{ {
int result; int result;
result = val + JDATE_2000 - 2400000.5; result = val + JDATE_2000 - 2400000.5;
...@@ -276,8 +274,8 @@ date2mjd(DateADT val) ...@@ -276,8 +274,8 @@ date2mjd(DateADT val)
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -20,8 +20,8 @@ DateADT currentdate(void); ...@@ -20,8 +20,8 @@ DateADT currentdate(void);
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -38,6 +38,7 @@ extern int assertTest(int val); ...@@ -38,6 +38,7 @@ extern int assertTest(int val);
#ifdef ASSERT_CHECKING_TEST #ifdef ASSERT_CHECKING_TEST
extern int assertEnable(int val); extern int assertEnable(int val);
#endif #endif
int int
...@@ -84,7 +85,8 @@ active_listeners(text *relname) ...@@ -84,7 +85,8 @@ active_listeners(text *relname)
ScanKeyData key; ScanKeyData key;
Datum d; Datum d;
bool isnull; bool isnull;
int len, pid; int len,
pid;
int count = 0; int count = 0;
int ourpid = getpid(); int ourpid = getpid();
char listen_name[NAMEDATALEN]; char listen_name[NAMEDATALEN];
...@@ -92,8 +94,9 @@ active_listeners(text *relname) ...@@ -92,8 +94,9 @@ active_listeners(text *relname)
lRel = heap_openr(ListenerRelationName, AccessShareLock); lRel = heap_openr(ListenerRelationName, AccessShareLock);
tdesc = RelationGetDescr(lRel); tdesc = RelationGetDescr(lRel);
if (relname && (VARSIZE(relname) > VARHDRSZ)) { if (relname && (VARSIZE(relname) > VARHDRSZ))
len = MIN(VARSIZE(relname)-VARHDRSZ, NAMEDATALEN-1); {
len = MIN(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
strncpy(listen_name, VARDATA(relname), len); strncpy(listen_name, VARDATA(relname), len);
listen_name[len] = '\0'; listen_name[len] = '\0';
ScanKeyEntryInitialize(&key, 0, ScanKeyEntryInitialize(&key, 0,
...@@ -101,15 +104,16 @@ active_listeners(text *relname) ...@@ -101,15 +104,16 @@ active_listeners(text *relname)
F_NAMEEQ, F_NAMEEQ,
PointerGetDatum(listen_name)); PointerGetDatum(listen_name));
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key); sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
} else {
sRel = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey)NULL);
} }
else
sRel = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0))) while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{ {
d = heap_getattr(lTuple, Anum_pg_listener_pid, tdesc, &isnull); d = heap_getattr(lTuple, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d); pid = DatumGetInt32(d);
if ((pid == ourpid) || (kill(pid, SIGTSTP) == 0)) { if ((pid == ourpid) || (kill(pid, SIGTSTP) == 0))
{
/* elog(NOTICE, "%d ok", pid); */ /* elog(NOTICE, "%d ok", pid); */
count++; count++;
} }
...@@ -134,6 +138,7 @@ assert_test(int val) ...@@ -134,6 +138,7 @@ assert_test(int val)
{ {
return assertTest(val); return assertTest(val);
} }
#endif #endif
#endif #endif
...@@ -141,8 +146,8 @@ assert_test(int val) ...@@ -141,8 +146,8 @@ assert_test(int val)
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -10,8 +10,10 @@ int active_listeners(text *relname); ...@@ -10,8 +10,10 @@ int active_listeners(text *relname);
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
int assert_enable(int val); int assert_enable(int val);
#ifdef ASSERT_CHECKING_TEST #ifdef ASSERT_CHECKING_TEST
int assert_test(int val); int assert_test(int val);
#endif #endif
#endif #endif
...@@ -19,8 +21,8 @@ int assert_test(int val); ...@@ -19,8 +21,8 @@ int assert_test(int val);
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* DEF_PGPORT is the TCP port number on which the Postmaster listens by * DEF_PGPORT is the TCP port number on which the Postmaster listens by
* default. This can be overriden by command options, environment variables, * default. This can be overriden by command options, environment variables,
* and the postconfig hook. (set by build script) * and the postconfig hook. (set by build script)
*/ */
#define DEF_PGPORT "5432" #define DEF_PGPORT "5432"
......
This diff is collapsed.
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define ISO8859 #define ISO8859
#define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MIN(x, y) ((x) < (y) ? (x) : (y))
#define VALUE(char) ((char) - '0') #define VALUE(char) ((char) - '0')
#define DIGIT(val) ((val) + '0') #define DIGIT(val) ((val) + '0')
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7')) #define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
#ifndef ISO8859 #ifndef ISO8859
...@@ -89,9 +89,8 @@ string_output(unsigned char *data, int size) ...@@ -89,9 +89,8 @@ string_output(unsigned char *data, int size)
break; break;
case '{': case '{':
/* Escape beginning of string, to distinguish from arrays */ /* Escape beginning of string, to distinguish from arrays */
if (p == data) { if (p == data)
len++; len++;
}
break; break;
default: default:
if (NOTPRINTABLE(*p)) if (NOTPRINTABLE(*p))
...@@ -137,9 +136,8 @@ string_output(unsigned char *data, int size) ...@@ -137,9 +136,8 @@ string_output(unsigned char *data, int size)
break; break;
case '{': case '{':
/* Escape beginning of string, to distinguish from arrays */ /* Escape beginning of string, to distinguish from arrays */
if (p == data) { if (p == data)
*r++ = '\\'; *r++ = '\\';
}
*r++ = c; *r++ = c;
break; break;
default: default:
...@@ -361,14 +359,15 @@ c_charin(unsigned char *str) ...@@ -361,14 +359,15 @@ c_charin(unsigned char *str)
{ {
return (string_input(str, 1, 0, NULL)); return (string_input(str, 1, 0, NULL));
} }
#endif #endif
/* end of file */ /* end of file */
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
#ifndef STRING_IO_H #ifndef STRING_IO_H
#define STRING_IO_H #define STRING_IO_H
unsigned char* string_output(unsigned char *data, int size); unsigned char *string_output(unsigned char *data, int size);
unsigned char* string_input(unsigned char *str, int size, int hdrsize, unsigned char *string_input(unsigned char *str, int size, int hdrsize,
int *rtn_size); int *rtn_size);
unsigned char* c_charout(int32 c); unsigned char *c_charout(int32 c);
unsigned char* c_textout(struct varlena * vlena); unsigned char *c_textout(struct varlena * vlena);
unsigned char* c_varcharout(unsigned char *s); unsigned char *c_varcharout(unsigned char *s);
#if 0 #if 0
struct varlena* c_textin(unsigned char *str); struct varlena *c_textin(unsigned char *str);
int32* c_charin(unsigned char *str) int32 *
c_charin(unsigned char *str)
#endif #endif
#endif #endif
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -96,8 +96,8 @@ user_unlock_all() ...@@ -96,8 +96,8 @@ user_unlock_all()
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -13,8 +13,8 @@ int user_unlock_all(void); ...@@ -13,8 +13,8 @@ int user_unlock_all(void);
/* /*
* Local Variables: * Local Variables:
* tab-width: 4 * tab-width: 4
* c-indent-level: 4 * c-indent-level: 4
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.61 2000/01/26 05:55:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36 momjian Exp $
* *
* NOTES * NOTES
* The old interface functions have been converted to macros * The old interface functions have been converted to macros
...@@ -137,9 +137,9 @@ DataFill(char *data, ...@@ -137,9 +137,9 @@ DataFill(char *data,
*((int32 *) value[i])); *((int32 *) value[i]));
break; break;
default: default:
Assert(att[i]->attlen >= 0); Assert(att[i]->attlen >= 0);
memmove(data, DatumGetPointer(value[i]), memmove(data, DatumGetPointer(value[i]),
(size_t)(att[i]->attlen)); (size_t) (att[i]->attlen));
break; break;
} }
data = (char *) att_addlength((long) data, att[i]->attlen, value[i]); data = (char *) att_addlength((long) data, att[i]->attlen, value[i]);
...@@ -326,7 +326,7 @@ nocachegetattr(HeapTuple tuple, ...@@ -326,7 +326,7 @@ nocachegetattr(HeapTuple tuple,
Form_pg_attribute *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
int slow = 0; /* do we have to walk nulls? */ int slow = 0; /* do we have to walk nulls? */
(void)isnull; /*not used*/ (void) isnull; /* not used */
#ifdef IN_MACRO #ifdef IN_MACRO
/* This is handled in the macro */ /* This is handled in the macro */
Assert(attnum > 0); Assert(attnum > 0);
...@@ -681,7 +681,7 @@ heap_formtuple(TupleDesc tupleDescriptor, ...@@ -681,7 +681,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
len += bitmaplen; len += bitmaplen;
} }
hoff = len = MAXALIGN(len); /* be conservative here */ hoff = len = MAXALIGN(len); /* be conservative here */
len += ComputeDataSize(tupleDescriptor, value, nulls); len += ComputeDataSize(tupleDescriptor, value, nulls);
...@@ -806,11 +806,9 @@ void ...@@ -806,11 +806,9 @@ void
heap_freetuple(HeapTuple htup) heap_freetuple(HeapTuple htup)
{ {
if (htup->t_data != NULL) if (htup->t_data != NULL)
if (htup->t_datamcxt != NULL && (char *)(htup->t_data) != if (htup->t_datamcxt != NULL && (char *) (htup->t_data) !=
((char *) htup + HEAPTUPLESIZE)) ((char *) htup + HEAPTUPLESIZE))
{
elog(NOTICE, "TELL Jan Wieck: heap_freetuple() found separate t_data"); elog(NOTICE, "TELL Jan Wieck: heap_freetuple() found separate t_data");
}
pfree(htup); pfree(htup);
} }
...@@ -835,7 +833,7 @@ heap_addheader(uint32 natts, /* max domain index */ ...@@ -835,7 +833,7 @@ heap_addheader(uint32 natts, /* max domain index */
len = offsetof(HeapTupleHeaderData, t_bits); len = offsetof(HeapTupleHeaderData, t_bits);
hoff = len = MAXALIGN(len); /* be conservative */ hoff = len = MAXALIGN(len); /* be conservative */
len += structlen; len += structlen;
tuple = (HeapTuple) palloc(HEAPTUPLESIZE + len); tuple = (HeapTuple) palloc(HEAPTUPLESIZE + len);
tuple->t_datamcxt = CurrentMemoryContext; tuple->t_datamcxt = CurrentMemoryContext;
...@@ -850,8 +848,8 @@ heap_addheader(uint32 natts, /* max domain index */ ...@@ -850,8 +848,8 @@ heap_addheader(uint32 natts, /* max domain index */
td->t_infomask = 0; td->t_infomask = 0;
td->t_infomask |= HEAP_XMAX_INVALID; td->t_infomask |= HEAP_XMAX_INVALID;
if (structlen > 0) if (structlen > 0)
memmove((char *) td + hoff, structure, (size_t)structlen); memmove((char *) td + hoff, structure, (size_t) structlen);
return tuple; return tuple;
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.42 2000/01/26 05:55:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.43 2000/04/12 17:14:37 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -60,7 +60,7 @@ index_formtuple(TupleDesc tupleDescriptor, ...@@ -60,7 +60,7 @@ index_formtuple(TupleDesc tupleDescriptor,
hoff = IndexInfoFindDataOffset(infomask); hoff = IndexInfoFindDataOffset(infomask);
size = hoff + ComputeDataSize(tupleDescriptor, value, null); size = hoff + ComputeDataSize(tupleDescriptor, value, null);
size = MAXALIGN(size); /* be conservative */ size = MAXALIGN(size); /* be conservative */
tp = (char *) palloc(size); tp = (char *) palloc(size);
tuple = (IndexTuple) tp; tuple = (IndexTuple) tp;
...@@ -134,7 +134,7 @@ nocache_index_getattr(IndexTuple tup, ...@@ -134,7 +134,7 @@ nocache_index_getattr(IndexTuple tup,
int data_off; /* tuple data offset */ int data_off; /* tuple data offset */
Form_pg_attribute *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
(void)isnull; (void) isnull;
/* ---------------- /* ----------------
* sanity checks * sanity checks
* ---------------- * ----------------
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.61 2000/01/31 04:35:48 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.62 2000/04/12 17:14:37 momjian Exp $
* *
* NOTES * NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be * some of the executor utility code such as "ExecTypeFromTL" should be
...@@ -229,17 +229,19 @@ FreeTupleDesc(TupleDesc tupdesc) ...@@ -229,17 +229,19 @@ FreeTupleDesc(TupleDesc tupdesc)
bool bool
equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
{ {
int i; int i;
if (tupdesc1->natts != tupdesc2->natts) if (tupdesc1->natts != tupdesc2->natts)
return false; return false;
for (i = 0; i < tupdesc1->natts; i++) for (i = 0; i < tupdesc1->natts; i++)
{ {
Form_pg_attribute attr1 = tupdesc1->attrs[i]; Form_pg_attribute attr1 = tupdesc1->attrs[i];
Form_pg_attribute attr2 = tupdesc2->attrs[i]; Form_pg_attribute attr2 = tupdesc2->attrs[i];
/* We do not need to check every single field here, and in fact /*
* some fields such as attdisbursion probably shouldn't be compared. * We do not need to check every single field here, and in fact
* some fields such as attdisbursion probably shouldn't be
* compared.
*/ */
if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0) if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0)
return false; return false;
...@@ -254,8 +256,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) ...@@ -254,8 +256,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
} }
if (tupdesc1->constr != NULL) if (tupdesc1->constr != NULL)
{ {
TupleConstr *constr1 = tupdesc1->constr; TupleConstr *constr1 = tupdesc1->constr;
TupleConstr *constr2 = tupdesc2->constr; TupleConstr *constr2 = tupdesc2->constr;
if (constr2 == NULL) if (constr2 == NULL)
return false; return false;
...@@ -263,8 +265,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) ...@@ -263,8 +265,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
return false; return false;
for (i = 0; i < (int) constr1->num_defval; i++) for (i = 0; i < (int) constr1->num_defval; i++)
{ {
AttrDefault *defval1 = constr1->defval + i; AttrDefault *defval1 = constr1->defval + i;
AttrDefault *defval2 = constr2->defval + i; AttrDefault *defval2 = constr2->defval + i;
if (defval1->adnum != defval2->adnum) if (defval1->adnum != defval2->adnum)
return false; return false;
...@@ -275,8 +277,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) ...@@ -275,8 +277,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
return false; return false;
for (i = 0; i < (int) constr1->num_check; i++) for (i = 0; i < (int) constr1->num_check; i++)
{ {
ConstrCheck *check1 = constr1->check + i; ConstrCheck *check1 = constr1->check + i;
ConstrCheck *check2 = constr2->check + i; ConstrCheck *check2 = constr2->check + i;
if (strcmp(check1->ccname, check2->ccname) != 0) if (strcmp(check1->ccname, check2->ccname) != 0)
return false; return false;
...@@ -585,8 +587,9 @@ BuildDescForRelation(List *schema, char *relname) ...@@ -585,8 +587,9 @@ BuildDescForRelation(List *schema, char *relname)
constr->has_not_null = true; constr->has_not_null = true;
desc->attrs[attnum - 1]->attnotnull = entry->is_not_null; desc->attrs[attnum - 1]->attnotnull = entry->is_not_null;
/* Note we copy only pre-cooked default expressions. /*
* Digestion of raw ones is someone else's problem. * Note we copy only pre-cooked default expressions. Digestion of
* raw ones is someone else's problem.
*/ */
if (entry->cooked_default != NULL) if (entry->cooked_default != NULL)
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.52 2000/03/17 02:36:00 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.53 2000/04/12 17:14:39 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -52,8 +52,10 @@ void gistdelete(Relation r, ItemPointer tid); ...@@ -52,8 +52,10 @@ void gistdelete(Relation r, ItemPointer tid);
static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t); static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t);
static void gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr, static void gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
Relation r, Page pg, OffsetNumber o, int b, bool l); Relation r, Page pg, OffsetNumber o, int b, bool l);
#ifdef GISTDEBUG #ifdef GISTDEBUG
static char *int_range_out(INTRANGE *r); static char *int_range_out(INTRANGE *r);
#endif #endif
/* /*
...@@ -98,7 +100,7 @@ gistbuild(Relation heap, ...@@ -98,7 +100,7 @@ gistbuild(Relation heap,
/* no locking is needed */ /* no locking is needed */
CommandCounterIncrement(); /* so we can see the new pg_index tuple */ CommandCounterIncrement(); /* so we can see the new pg_index tuple */
initGISTstate(&giststate, index); initGISTstate(&giststate, index);
...@@ -186,7 +188,7 @@ gistbuild(Relation heap, ...@@ -186,7 +188,7 @@ gistbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
/* SetSlotContents(slot, htup); */ /* SetSlotContents(slot, htup); */
slot->val = htup; slot->val = htup;
if (! ExecQual((List *) pred, econtext, false)) if (!ExecQual((List *) pred, econtext, false))
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
...@@ -272,18 +274,18 @@ gistbuild(Relation heap, ...@@ -272,18 +274,18 @@ gistbuild(Relation heap,
/* /*
* Since we just counted the tuples in the heap, we update its stats * Since we just counted the tuples in the heap, we update its stats
* in pg_class to guarantee that the planner takes advantage of the * in pg_class to guarantee that the planner takes advantage of the
* index we just created. But, only update statistics during * index we just created. But, only update statistics during normal
* normal index definitions, not for indices on system catalogs * index definitions, not for indices on system catalogs created
* created during bootstrap processing. We must close the relations * during bootstrap processing. We must close the relations before
* before updating statistics to guarantee that the relcache entries * updating statistics to guarantee that the relcache entries are
* are flushed when we increment the command counter in UpdateStats(). * flushed when we increment the command counter in UpdateStats(). But
* But we do not release any locks on the relations; those will be * we do not release any locks on the relations; those will be held
* held until end of transaction. * until end of transaction.
*/ */
if (IsNormalProcessingMode()) if (IsNormalProcessingMode())
{ {
Oid hrelid = RelationGetRelid(heap); Oid hrelid = RelationGetRelid(heap);
Oid irelid = RelationGetRelid(index); Oid irelid = RelationGetRelid(index);
bool inplace = IsReindexProcessing(); bool inplace = IsReindexProcessing();
heap_close(heap, NoLock); heap_close(heap, NoLock);
......
...@@ -266,7 +266,7 @@ gistdropscan(IndexScanDesc s) ...@@ -266,7 +266,7 @@ gistdropscan(IndexScanDesc s)
prev = l; prev = l;
if (l == (GISTScanList) NULL) if (l == (GISTScanList) NULL)
elog(ERROR, "GiST scan list corrupted -- cannot find 0x%p", (void*)s); elog(ERROR, "GiST scan list corrupted -- cannot find 0x%p", (void *) s);
if (prev == (GISTScanList) NULL) if (prev == (GISTScanList) NULL)
GISTScans = l->gsl_next; GISTScans = l->gsl_next;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.36 2000/03/01 05:39:22 inoue Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.37 2000/04/12 17:14:43 momjian Exp $
* *
* NOTES * NOTES
* This file contains only the public interface routines. * This file contains only the public interface routines.
...@@ -149,7 +149,7 @@ hashbuild(Relation heap, ...@@ -149,7 +149,7 @@ hashbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
/* SetSlotContents(slot, htup); */ /* SetSlotContents(slot, htup); */
slot->val = htup; slot->val = htup;
if (! ExecQual((List *) pred, econtext, false)) if (!ExecQual((List *) pred, econtext, false))
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
...@@ -230,18 +230,18 @@ hashbuild(Relation heap, ...@@ -230,18 +230,18 @@ hashbuild(Relation heap,
/* /*
* Since we just counted the tuples in the heap, we update its stats * Since we just counted the tuples in the heap, we update its stats
* in pg_class to guarantee that the planner takes advantage of the * in pg_class to guarantee that the planner takes advantage of the
* index we just created. But, only update statistics during * index we just created. But, only update statistics during normal
* normal index definitions, not for indices on system catalogs * index definitions, not for indices on system catalogs created
* created during bootstrap processing. We must close the relations * during bootstrap processing. We must close the relations before
* before updating statistics to guarantee that the relcache entries * updating statistics to guarantee that the relcache entries are
* are flushed when we increment the command counter in UpdateStats(). * flushed when we increment the command counter in UpdateStats(). But
* But we do not release any locks on the relations; those will be * we do not release any locks on the relations; those will be held
* held until end of transaction. * until end of transaction.
*/ */
if (IsNormalProcessingMode()) if (IsNormalProcessingMode())
{ {
Oid hrelid = RelationGetRelid(heap); Oid hrelid = RelationGetRelid(heap);
Oid irelid = RelationGetRelid(index); Oid irelid = RelationGetRelid(index);
bool inplace = IsReindexProcessing(); bool inplace = IsReindexProcessing();
heap_close(heap, NoLock); heap_close(heap, NoLock);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.24 2000/02/21 03:36:46 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.25 2000/04/12 17:14:44 momjian Exp $
* *
* NOTES * NOTES
* These functions are stored in pg_amproc. For each operator class * These functions are stored in pg_amproc. For each operator class
...@@ -146,14 +146,14 @@ hashoidvector(Oid *key) ...@@ -146,14 +146,14 @@ hashoidvector(Oid *key)
int i; int i;
uint32 result = 0; uint32 result = 0;
for (i = INDEX_MAX_KEYS; --i >= 0; ) for (i = INDEX_MAX_KEYS; --i >= 0;)
result = (result << 1) ^ (~(uint32) key[i]); result = (result << 1) ^ (~(uint32) key[i]);
return result; return result;
} }
/* /*
* Note: hashint2vector currently can't be used as a user hash table * Note: hashint2vector currently can't be used as a user hash table
* hash function, because it has no pg_proc entry. We only need it * hash function, because it has no pg_proc entry. We only need it
* for catcache indexing. * for catcache indexing.
*/ */
uint32 uint32
...@@ -162,7 +162,7 @@ hashint2vector(int16 *key) ...@@ -162,7 +162,7 @@ hashint2vector(int16 *key)
int i; int i;
uint32 result = 0; uint32 result = 0;
for (i = INDEX_MAX_KEYS; --i >= 0; ) for (i = INDEX_MAX_KEYS; --i >= 0;)
result = (result << 1) ^ (~(uint32) key[i]); result = (result << 1) ^ (~(uint32) key[i]);
return result; return result;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.22 2000/01/26 05:55:55 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.23 2000/04/12 17:14:44 momjian Exp $
* *
* NOTES * NOTES
* Because we can be doing an index scan on a relation while we * Because we can be doing an index scan on a relation while we
...@@ -75,7 +75,7 @@ _hash_dropscan(IndexScanDesc scan) ...@@ -75,7 +75,7 @@ _hash_dropscan(IndexScanDesc scan)
last = chk; last = chk;
if (chk == (HashScanList) NULL) if (chk == (HashScanList) NULL)
elog(ERROR, "hash scan list trashed; can't find 0x%p", (void*)scan); elog(ERROR, "hash scan list trashed; can't find 0x%p", (void *) scan);
if (last == (HashScanList) NULL) if (last == (HashScanList) NULL)
HashScans = chk->hashsl_next; HashScans = chk->hashsl_next;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.23 2000/03/17 02:36:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.24 2000/04/12 17:14:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -351,7 +351,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf) ...@@ -351,7 +351,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
opaque = (HashPageOpaque) PageGetSpecialPointer(page); opaque = (HashPageOpaque) PageGetSpecialPointer(page);
Assert(opaque->hasho_bucket == bucket); Assert(opaque->hasho_bucket == bucket);
while (PageIsEmpty(page) && while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno)) BlockNumberIsValid(opaque->hasho_nextblkno))
_hash_readnext(rel, &buf, &page, &opaque); _hash_readnext(rel, &buf, &page, &opaque);
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
offnum = FirstOffsetNumber; offnum = FirstOffsetNumber;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.66 2000/02/09 03:49:47 inoue Exp $ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.67 2000/04/12 17:14:45 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* heap_fetch - retrive tuple with tid * heap_fetch - retrive tuple with tid
* heap_insert - insert tuple into a relation * heap_insert - insert tuple into a relation
* heap_delete - delete a tuple from a relation * heap_delete - delete a tuple from a relation
* heap_update - replace a tuple in a relation with another tuple * heap_update - replace a tuple in a relation with another tuple
* heap_markpos - mark scan position * heap_markpos - mark scan position
* heap_restrpos - restore position to marked location * heap_restrpos - restore position to marked location
* *
...@@ -120,9 +120,9 @@ initscan(HeapScanDesc scan, ...@@ -120,9 +120,9 @@ initscan(HeapScanDesc scan,
* ---------------- * ----------------
*/ */
scan->rs_ntup.t_datamcxt = scan->rs_ctup.t_datamcxt = scan->rs_ntup.t_datamcxt = scan->rs_ctup.t_datamcxt =
scan->rs_ptup.t_datamcxt = NULL; scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ntup.t_data = scan->rs_ctup.t_data = scan->rs_ntup.t_data = scan->rs_ctup.t_data =
scan->rs_ptup.t_data = NULL; scan->rs_ptup.t_data = NULL;
scan->rs_nbuf = scan->rs_cbuf = scan->rs_pbuf = InvalidBuffer; scan->rs_nbuf = scan->rs_cbuf = scan->rs_pbuf = InvalidBuffer;
} }
else if (atend) else if (atend)
...@@ -188,8 +188,9 @@ unpinscan(HeapScanDesc scan) ...@@ -188,8 +188,9 @@ unpinscan(HeapScanDesc scan)
if (BufferIsValid(scan->rs_nbuf)) if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf); ReleaseBuffer(scan->rs_nbuf);
/* we don't bother to clear rs_pbuf etc --- caller must /*
* reinitialize them if scan descriptor is not being deleted. * we don't bother to clear rs_pbuf etc --- caller must reinitialize
* them if scan descriptor is not being deleted.
*/ */
} }
...@@ -544,7 +545,7 @@ heap_open(Oid relationId, LOCKMODE lockmode) ...@@ -544,7 +545,7 @@ heap_open(Oid relationId, LOCKMODE lockmode)
if (lockmode == NoLock) if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */ return r; /* caller must check RelationIsValid! */
if (! RelationIsValid(r)) if (!RelationIsValid(r))
elog(ERROR, "Relation %u does not exist", relationId); elog(ERROR, "Relation %u does not exist", relationId);
LockRelation(r, lockmode); LockRelation(r, lockmode);
...@@ -586,7 +587,7 @@ heap_openr(const char *relationName, LOCKMODE lockmode) ...@@ -586,7 +587,7 @@ heap_openr(const char *relationName, LOCKMODE lockmode)
if (lockmode == NoLock) if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */ return r; /* caller must check RelationIsValid! */
if (! RelationIsValid(r)) if (!RelationIsValid(r))
elog(ERROR, "Relation '%s' does not exist", relationName); elog(ERROR, "Relation '%s' does not exist", relationName);
LockRelation(r, lockmode); LockRelation(r, lockmode);
...@@ -646,7 +647,7 @@ heap_beginscan(Relation relation, ...@@ -646,7 +647,7 @@ heap_beginscan(Relation relation,
* sanity checks * sanity checks
* ---------------- * ----------------
*/ */
if (! RelationIsValid(relation)) if (!RelationIsValid(relation))
elog(ERROR, "heap_beginscan: !RelationIsValid(relation)"); elog(ERROR, "heap_beginscan: !RelationIsValid(relation)");
/* ---------------- /* ----------------
...@@ -659,7 +660,7 @@ heap_beginscan(Relation relation, ...@@ -659,7 +660,7 @@ heap_beginscan(Relation relation,
* Acquire AccessShareLock for the duration of the scan * Acquire AccessShareLock for the duration of the scan
* *
* Note: we could get an SI inval message here and consequently have * Note: we could get an SI inval message here and consequently have
* to rebuild the relcache entry. The refcount increment above * to rebuild the relcache entry. The refcount increment above
* ensures that we will rebuild it and not just flush it... * ensures that we will rebuild it and not just flush it...
* ---------------- * ----------------
*/ */
...@@ -681,6 +682,7 @@ heap_beginscan(Relation relation, ...@@ -681,6 +682,7 @@ heap_beginscan(Relation relation,
scan->rs_nkeys = (short) nkeys; scan->rs_nkeys = (short) nkeys;
if (nkeys) if (nkeys)
/* /*
* we do this here instead of in initscan() because heap_rescan * we do this here instead of in initscan() because heap_rescan
* also calls initscan() and we don't want to allocate memory * also calls initscan() and we don't want to allocate memory
...@@ -847,9 +849,7 @@ heap_getnext(HeapScanDesc scandesc, int backw) ...@@ -847,9 +849,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
if (scan->rs_ptup.t_data == scan->rs_ctup.t_data && if (scan->rs_ptup.t_data == scan->rs_ctup.t_data &&
BufferIsInvalid(scan->rs_pbuf)) BufferIsInvalid(scan->rs_pbuf))
{
return NULL; return NULL;
}
/* /*
* Copy the "current" tuple/buffer to "next". Pin/unpin the * Copy the "current" tuple/buffer to "next". Pin/unpin the
...@@ -1095,8 +1095,10 @@ heap_fetch(Relation relation, ...@@ -1095,8 +1095,10 @@ heap_fetch(Relation relation,
} }
else else
{ {
/* All checks passed, so return the tuple as valid.
* Caller is now responsible for releasing the buffer. /*
* All checks passed, so return the tuple as valid. Caller is now
* responsible for releasing the buffer.
*/ */
*userbuf = buffer; *userbuf = buffer;
} }
...@@ -1109,17 +1111,18 @@ heap_fetch(Relation relation, ...@@ -1109,17 +1111,18 @@ heap_fetch(Relation relation,
*/ */
ItemPointer ItemPointer
heap_get_latest_tid(Relation relation, heap_get_latest_tid(Relation relation,
Snapshot snapshot, Snapshot snapshot,
ItemPointer tid) ItemPointer tid)
{ {
ItemId lp = NULL; ItemId lp = NULL;
Buffer buffer; Buffer buffer;
PageHeader dp; PageHeader dp;
OffsetNumber offnum; OffsetNumber offnum;
HeapTupleData tp; HeapTupleData tp;
HeapTupleHeader t_data; HeapTupleHeader t_data;
ItemPointerData ctid; ItemPointerData ctid;
bool invalidBlock,linkend; bool invalidBlock,
linkend;
/* ---------------- /* ----------------
* get the buffer from the relation descriptor * get the buffer from the relation descriptor
...@@ -1149,11 +1152,11 @@ heap_get_latest_tid(Relation relation, ...@@ -1149,11 +1152,11 @@ heap_get_latest_tid(Relation relation,
invalidBlock = false; invalidBlock = false;
} }
if (invalidBlock) if (invalidBlock)
{ {
LockBuffer(buffer, BUFFER_LOCK_UNLOCK); LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer); ReleaseBuffer(buffer);
return NULL; return NULL;
} }
/* ---------------- /* ----------------
* more sanity checks * more sanity checks
...@@ -1175,7 +1178,7 @@ heap_get_latest_tid(Relation relation, ...@@ -1175,7 +1178,7 @@ heap_get_latest_tid(Relation relation,
snapshot, 0, (ScanKey) NULL); snapshot, 0, (ScanKey) NULL);
linkend = true; linkend = true;
if ((t_data->t_infomask & HEAP_XMAX_COMMITTED) && if ((t_data->t_infomask & HEAP_XMAX_COMMITTED) &&
!ItemPointerEquals(tid, &ctid)) !ItemPointerEquals(tid, &ctid))
linkend = false; linkend = false;
...@@ -1186,7 +1189,7 @@ heap_get_latest_tid(Relation relation, ...@@ -1186,7 +1189,7 @@ heap_get_latest_tid(Relation relation,
{ {
if (linkend) if (linkend)
return NULL; return NULL;
return heap_get_latest_tid(relation, snapshot, &ctid); return heap_get_latest_tid(relation, snapshot, &ctid);
} }
return tid; return tid;
...@@ -1300,10 +1303,11 @@ l1: ...@@ -1300,10 +1303,11 @@ l1:
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
if (TransactionIdDidAbort(xwait)) if (TransactionIdDidAbort(xwait))
goto l1; goto l1;
/*
* xwait is committed but if xwait had just marked /*
* the tuple for update then some other xaction could * xwait is committed but if xwait had just marked the tuple for
* update this tuple before we got to this point. * update then some other xaction could update this tuple before
* we got to this point.
*/ */
if (tp.t_data->t_xmax != xwait) if (tp.t_data->t_xmax != xwait)
goto l1; goto l1;
...@@ -1345,11 +1349,11 @@ l1: ...@@ -1345,11 +1349,11 @@ l1:
} }
/* /*
* heap_update - replace a tuple * heap_update - replace a tuple
*/ */
int int
heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
ItemPointer ctid) ItemPointer ctid)
{ {
ItemId lp; ItemId lp;
HeapTupleData oldtup; HeapTupleData oldtup;
...@@ -1396,10 +1400,11 @@ l2: ...@@ -1396,10 +1400,11 @@ l2:
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
if (TransactionIdDidAbort(xwait)) if (TransactionIdDidAbort(xwait))
goto l2; goto l2;
/*
* xwait is committed but if xwait had just marked /*
* the tuple for update then some other xaction could * xwait is committed but if xwait had just marked the tuple for
* update this tuple before we got to this point. * update then some other xaction could update this tuple before
* we got to this point.
*/ */
if (oldtup.t_data->t_xmax != xwait) if (oldtup.t_data->t_xmax != xwait)
goto l2; goto l2;
...@@ -1521,10 +1526,11 @@ l3: ...@@ -1521,10 +1526,11 @@ l3:
LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE);
if (TransactionIdDidAbort(xwait)) if (TransactionIdDidAbort(xwait))
goto l3; goto l3;
/*
* xwait is committed but if xwait had just marked /*
* the tuple for update then some other xaction could * xwait is committed but if xwait had just marked the tuple for
* update this tuple before we got to this point. * update then some other xaction could update this tuple before
* we got to this point.
*/ */
if (tuple->t_data->t_xmax != xwait) if (tuple->t_data->t_xmax != xwait)
goto l3; goto l3;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Id: hio.c,v 1.30 2000/03/17 02:36:02 tgl Exp $ * $Id: hio.c,v 1.31 2000/04/12 17:14:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -51,7 +51,7 @@ RelationPutHeapTuple(Relation relation, ...@@ -51,7 +51,7 @@ RelationPutHeapTuple(Relation relation,
IncrHeapAccessStat(global_RelationPutHeapTuple); IncrHeapAccessStat(global_RelationPutHeapTuple);
pageHeader = (Page) BufferGetPage(buffer); pageHeader = (Page) BufferGetPage(buffer);
len = MAXALIGN(tuple->t_len); /* be conservative */ len = MAXALIGN(tuple->t_len); /* be conservative */
Assert(len <= PageGetFreeSpace(pageHeader)); Assert(len <= PageGetFreeSpace(pageHeader));
offnum = PageAddItem((Page) pageHeader, (Item) tuple->t_data, offnum = PageAddItem((Page) pageHeader, (Item) tuple->t_data,
...@@ -108,11 +108,11 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple) ...@@ -108,11 +108,11 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
ItemId itemId; ItemId itemId;
Item item; Item item;
len = MAXALIGN(tuple->t_len); /* be conservative */ len = MAXALIGN(tuple->t_len); /* be conservative */
/* /*
* If we're gonna fail for oversize tuple, do it right away... * If we're gonna fail for oversize tuple, do it right away... this
* this code should go away eventually. * code should go away eventually.
*/ */
if (len > MaxTupleSize) if (len > MaxTupleSize)
elog(ERROR, "Tuple is too big: size %u, max size %ld", elog(ERROR, "Tuple is too big: size %u, max size %ld",
...@@ -136,8 +136,8 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple) ...@@ -136,8 +136,8 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
lastblock = RelationGetNumberOfBlocks(relation); lastblock = RelationGetNumberOfBlocks(relation);
/* /*
* Get the last existing page --- may need to create the first one * Get the last existing page --- may need to create the first one if
* if this is a virgin relation. * this is a virgin relation.
*/ */
if (lastblock == 0) if (lastblock == 0)
{ {
...@@ -168,12 +168,14 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple) ...@@ -168,12 +168,14 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
if (len > PageGetFreeSpace(pageHeader)) if (len > PageGetFreeSpace(pageHeader))
{ {
/* /*
* BUG: by elog'ing here, we leave the new buffer locked and not * BUG: by elog'ing here, we leave the new buffer locked and
* marked dirty, which may result in an invalid page header * not marked dirty, which may result in an invalid page
* being left on disk. But we should not get here given the * header being left on disk. But we should not get here
* test at the top of the routine, and the whole deal should * given the test at the top of the routine, and the whole
* go away when we implement tuple splitting anyway... * deal should go away when we implement tuple splitting
* anyway...
*/ */
elog(ERROR, "Tuple is too big: size %u", len); elog(ERROR, "Tuple is too big: size %u", len);
} }
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* *
* tuptoaster.c * tuptoaster.c
* Support routines for external and compressed storage of * Support routines for external and compressed storage of
* variable size attributes. * variable size attributes.
* *
* Copyright (c) 2000, PostgreSQL Global Development Group * Copyright (c) 2000, PostgreSQL Global Development Group
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.2 2000/01/20 21:50:59 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.3 2000/04/12 17:14:45 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -30,17 +30,17 @@ ...@@ -30,17 +30,17 @@
#ifdef TUPLE_TOASTER_ACTIVE #ifdef TUPLE_TOASTER_ACTIVE
void void
heap_tuple_toast_attrs (Relation rel, HeapTuple newtup, HeapTuple oldtup) heap_tuple_toast_attrs(Relation rel, HeapTuple newtup, HeapTuple oldtup)
{ {
return; return;
} }
varattrib * varattrib *
heap_tuple_untoast_attr (varattrib *attr) heap_tuple_untoast_attr(varattrib * attr)
{ {
elog(ERROR, "heap_tuple_untoast_attr() called"); elog(ERROR, "heap_tuple_untoast_attr() called");
} }
#endif /* TUPLE_TOASTER_ACTIVE */ #endif /* TUPLE_TOASTER_ACTIVE */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.24 2000/03/14 23:52:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.25 2000/04/12 17:14:47 momjian Exp $
* *
* NOTES * NOTES
* many of the old access method routines have been turned into * many of the old access method routines have been turned into
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
* *
* At the end of a scan, the AM's endscan routine undoes the locking, * At the end of a scan, the AM's endscan routine undoes the locking,
* but does *not* call IndexScanEnd --- the higher-level index_endscan * but does *not* call IndexScanEnd --- the higher-level index_endscan
* routine does that. (We can't do it in the AM because index_endscan * routine does that. (We can't do it in the AM because index_endscan
* still needs to touch the IndexScanDesc after calling the AM.) * still needs to touch the IndexScanDesc after calling the AM.)
* *
* Because of this, the AM does not have a choice whether to call * Because of this, the AM does not have a choice whether to call
...@@ -114,7 +114,10 @@ RelationGetIndexScan(Relation relation, ...@@ -114,7 +114,10 @@ RelationGetIndexScan(Relation relation,
ItemPointerSetInvalid(&scan->currentMarkData); ItemPointerSetInvalid(&scan->currentMarkData);
ItemPointerSetInvalid(&scan->nextMarkData); ItemPointerSetInvalid(&scan->nextMarkData);
/* mark cached function lookup data invalid; it will be set on first use */ /*
* mark cached function lookup data invalid; it will be set on first
* use
*/
scan->fn_getnext.fn_oid = InvalidOid; scan->fn_getnext.fn_oid = InvalidOid;
if (numberOfKeys > 0) if (numberOfKeys > 0)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.41 2000/03/14 23:52:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.42 2000/04/12 17:14:47 momjian Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* index_open - open an index relation by relationId * index_open - open an index relation by relationId
...@@ -115,10 +115,10 @@ ...@@ -115,10 +115,10 @@
* index_open - open an index relation by relationId * index_open - open an index relation by relationId
* *
* presently the relcache routines do all the work we need * presently the relcache routines do all the work we need
* to open/close index relations. However, callers of index_open * to open/close index relations. However, callers of index_open
* expect it to succeed, so we need to check for a failure return. * expect it to succeed, so we need to check for a failure return.
* *
* Note: we acquire no lock on the index. An AccessShareLock is * Note: we acquire no lock on the index. An AccessShareLock is
* acquired by index_beginscan (and released by index_endscan). * acquired by index_beginscan (and released by index_endscan).
* ---------------- * ----------------
*/ */
...@@ -129,7 +129,7 @@ index_open(Oid relationId) ...@@ -129,7 +129,7 @@ index_open(Oid relationId)
r = RelationIdGetRelation(relationId); r = RelationIdGetRelation(relationId);
if (! RelationIsValid(r)) if (!RelationIsValid(r))
elog(ERROR, "Index %u does not exist", relationId); elog(ERROR, "Index %u does not exist", relationId);
if (r->rd_rel->relkind != RELKIND_INDEX) if (r->rd_rel->relkind != RELKIND_INDEX)
...@@ -151,7 +151,7 @@ index_openr(char *relationName) ...@@ -151,7 +151,7 @@ index_openr(char *relationName)
r = RelationNameGetRelation(relationName); r = RelationNameGetRelation(relationName);
if (! RelationIsValid(r)) if (!RelationIsValid(r))
elog(ERROR, "Index '%s' does not exist", relationName); elog(ERROR, "Index '%s' does not exist", relationName);
if (r->rd_rel->relkind != RELKIND_INDEX) if (r->rd_rel->relkind != RELKIND_INDEX)
...@@ -238,7 +238,7 @@ index_beginscan(Relation relation, ...@@ -238,7 +238,7 @@ index_beginscan(Relation relation,
* Acquire AccessShareLock for the duration of the scan * Acquire AccessShareLock for the duration of the scan
* *
* Note: we could get an SI inval message here and consequently have * Note: we could get an SI inval message here and consequently have
* to rebuild the relcache entry. The refcount increment above * to rebuild the relcache entry. The refcount increment above
* ensures that we will rebuild it and not just flush it... * ensures that we will rebuild it and not just flush it...
* ---------------- * ----------------
*/ */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.41 2000/02/18 09:29:16 inoue Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.42 2000/04/12 17:14:47 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -477,7 +477,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation, ...@@ -477,7 +477,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
{ {
HeapTuple tuple; HeapTuple tuple;
HeapScanDesc scan = NULL; HeapScanDesc scan = NULL;
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized(); bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
if (cachesearch) if (cachesearch)
{ {
...@@ -547,7 +547,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ...@@ -547,7 +547,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
AttrNumber attributeNumber; AttrNumber attributeNumber;
int attributeIndex; int attributeIndex;
Oid operatorClassObjectId[INDEX_MAX_KEYS]; Oid operatorClassObjectId[INDEX_MAX_KEYS];
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized(); bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
if (cachesearch) if (cachesearch)
{ {
...@@ -674,7 +674,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ...@@ -674,7 +674,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
aform = (Form_pg_amop) GETSTRUCT(tuple); aform = (Form_pg_amop) GETSTRUCT(tuple);
OperatorRelationFillScanKeyEntry(operatorRelation, OperatorRelationFillScanKeyEntry(operatorRelation,
aform->amopopr, aform->amopopr,
StrategyMapGetScanKeyEntry(map, aform->amopstrategy)); StrategyMapGetScanKeyEntry(map, aform->amopstrategy));
} }
heap_endscan(scan); heap_endscan(scan);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.33 2000/02/10 19:51:38 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.34 2000/04/12 17:14:49 momjian Exp $
* *
* NOTES * NOTES
* These functions are stored in pg_amproc. For each operator class * These functions are stored in pg_amproc. For each operator class
...@@ -35,12 +35,12 @@ btint2cmp(int16 a, int16 b) ...@@ -35,12 +35,12 @@ btint2cmp(int16 a, int16 b)
int32 int32
btint4cmp(int32 a, int32 b) btint4cmp(int32 a, int32 b)
{ {
if (a > b) if (a > b)
return 1; return 1;
else if (a == b) else if (a == b)
return 0; return 0;
else else
return -1; return -1;
} }
int32 int32
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.56 2000/03/17 02:36:03 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.57 2000/04/12 17:14:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf, BTStack stack, int keysz, ScanKey scankey, BTItem btitem, BTItem afteritem); static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf, BTStack stack, int keysz, ScanKey scankey, BTItem btitem, BTItem afteritem);
static Buffer _bt_split(Relation rel, Size keysz, ScanKey scankey, static Buffer _bt_split(Relation rel, Size keysz, ScanKey scankey,
Buffer buf, OffsetNumber firstright); Buffer buf, OffsetNumber firstright);
static OffsetNumber _bt_findsplitloc(Relation rel, Size keysz, ScanKey scankey, static OffsetNumber _bt_findsplitloc(Relation rel, Size keysz, ScanKey scankey,
Page page, OffsetNumber start, Page page, OffsetNumber start,
OffsetNumber maxoff, Size llimit); 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 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 bool _bt_goesonpg(Relation rel, Buffer buf, Size keysz, ScanKey scankey, BTItem afteritem);
...@@ -267,21 +267,20 @@ _bt_insertonpg(Relation rel, ...@@ -267,21 +267,20 @@ _bt_insertonpg(Relation rel,
itemsz = IndexTupleDSize(btitem->bti_itup) itemsz = IndexTupleDSize(btitem->bti_itup)
+ (sizeof(BTItemData) - sizeof(IndexTupleData)); + (sizeof(BTItemData) - sizeof(IndexTupleData));
itemsz = MAXALIGN(itemsz); /* be safe, PageAddItem will do itemsz = MAXALIGN(itemsz); /* be safe, PageAddItem will do this but
* this but we need to be * we need to be consistent */
* consistent */
/* /*
* Check whether the item can fit on a btree page at all. * Check whether the item can fit on a btree page at all. (Eventually,
* (Eventually, we ought to try to apply TOAST methods if not.) * we ought to try to apply TOAST methods if not.) We actually need to
* We actually need to be able to fit three items on every page, * be able to fit three items on every page, so restrict any one item
* so restrict any one item to 1/3 the per-page available space. * to 1/3 the per-page available space. Note that at this point,
* Note that at this point, itemsz doesn't include the ItemId. * itemsz doesn't include the ItemId.
*/ */
if (itemsz > (PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData)) if (itemsz > (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
elog(ERROR, "btree: index item size %u exceeds maximum %lu", elog(ERROR, "btree: index item size %u exceeds maximum %lu",
itemsz, itemsz,
(PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData)); (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
/* /*
* If we have to insert item on the leftmost page which is the first * If we have to insert item on the leftmost page which is the first
...@@ -415,8 +414,8 @@ _bt_insertonpg(Relation rel, ...@@ -415,8 +414,8 @@ _bt_insertonpg(Relation rel,
bool is_root = lpageop->btpo_flags & BTP_ROOT; bool is_root = lpageop->btpo_flags & BTP_ROOT;
/* /*
* Instead of splitting leaf page in the chain of duplicates * Instead of splitting leaf page in the chain of duplicates by
* by new duplicate, insert it into some right page. * new duplicate, insert it into some right page.
*/ */
if ((lpageop->btpo_flags & BTP_CHAIN) && if ((lpageop->btpo_flags & BTP_CHAIN) &&
(lpageop->btpo_flags & BTP_LEAF) && keys_equal) (lpageop->btpo_flags & BTP_LEAF) && keys_equal)
...@@ -424,8 +423,9 @@ _bt_insertonpg(Relation rel, ...@@ -424,8 +423,9 @@ _bt_insertonpg(Relation rel,
rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE); rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE);
rpage = BufferGetPage(rbuf); rpage = BufferGetPage(rbuf);
rpageop = (BTPageOpaque) PageGetSpecialPointer(rpage); rpageop = (BTPageOpaque) PageGetSpecialPointer(rpage);
/*
* some checks /*
* some checks
*/ */
if (!P_RIGHTMOST(rpageop)) /* non-rightmost page */ if (!P_RIGHTMOST(rpageop)) /* non-rightmost page */
{ /* If we have the same hikey here then { /* If we have the same hikey here then
...@@ -442,6 +442,7 @@ _bt_insertonpg(Relation rel, ...@@ -442,6 +442,7 @@ _bt_insertonpg(Relation rel,
BTGreaterStrategyNumber)) BTGreaterStrategyNumber))
elog(FATAL, "btree: hikey is out of order"); elog(FATAL, "btree: hikey is out of order");
else if (rpageop->btpo_flags & BTP_CHAIN) else if (rpageop->btpo_flags & BTP_CHAIN)
/* /*
* If hikey > scankey then it's last page in chain and * If hikey > scankey then it's last page in chain and
* BTP_CHAIN must be OFF * BTP_CHAIN must be OFF
...@@ -450,9 +451,7 @@ _bt_insertonpg(Relation rel, ...@@ -450,9 +451,7 @@ _bt_insertonpg(Relation rel,
} }
else else
/* rightmost page */ /* rightmost page */
{
Assert(!(rpageop->btpo_flags & BTP_CHAIN)); Assert(!(rpageop->btpo_flags & BTP_CHAIN));
}
_bt_relbuf(rel, buf, BT_WRITE); _bt_relbuf(rel, buf, BT_WRITE);
return (_bt_insertonpg(rel, rbuf, stack, keysz, return (_bt_insertonpg(rel, rbuf, stack, keysz,
scankey, btitem, afteritem)); scankey, btitem, afteritem));
...@@ -708,7 +707,7 @@ l_spl: ; ...@@ -708,7 +707,7 @@ l_spl: ;
*/ */
if (!parent_chained && if (!parent_chained &&
MAXALIGN(IndexTupleDSize(lowLeftItem->bti_itup)) == MAXALIGN(IndexTupleDSize(lowLeftItem->bti_itup)) ==
MAXALIGN(IndexTupleDSize(stack->bts_btitem->bti_itup))) MAXALIGN(IndexTupleDSize(stack->bts_btitem->bti_itup)))
{ {
_bt_updateitem(rel, keysz, pbuf, _bt_updateitem(rel, keysz, pbuf,
stack->bts_btitem, lowLeftItem); stack->bts_btitem, lowLeftItem);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.35 2000/01/26 05:55:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.36 2000/04/12 17:14:49 momjian Exp $
* *
* NOTES * NOTES
* Postgres btree pages look like ordinary relation pages. The opaque * Postgres btree pages look like ordinary relation pages. The opaque
...@@ -257,7 +257,7 @@ _bt_getroot(Relation rel, int access) ...@@ -257,7 +257,7 @@ _bt_getroot(Relation rel, int access)
else else
{ {
rootblkno = metad->btm_root; rootblkno = metad->btm_root;
_bt_relbuf(rel, metabuf, BT_READ); /* done with the meta page */ _bt_relbuf(rel, metabuf, BT_READ); /* done with the meta page */
rootbuf = _bt_getbuf(rel, rootblkno, access); rootbuf = _bt_getbuf(rel, rootblkno, access);
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.53 2000/02/18 09:29:54 inoue Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.54 2000/04/12 17:14:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -77,7 +77,7 @@ btbuild(Relation heap, ...@@ -77,7 +77,7 @@ btbuild(Relation heap,
#endif #endif
Node *pred, Node *pred,
*oldPred; *oldPred;
BTSpool *spool = NULL; BTSpool *spool = NULL;
bool isunique; bool isunique;
bool usefast; bool usefast;
...@@ -185,7 +185,7 @@ btbuild(Relation heap, ...@@ -185,7 +185,7 @@ btbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
/* SetSlotContents(slot, htup); */ /* SetSlotContents(slot, htup); */
slot->val = htup; slot->val = htup;
if (! ExecQual((List *) pred, econtext, false)) if (!ExecQual((List *) pred, econtext, false))
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
...@@ -276,9 +276,9 @@ btbuild(Relation heap, ...@@ -276,9 +276,9 @@ btbuild(Relation heap,
} }
/* /*
* if we are doing bottom-up btree build, finish the build by * if we are doing bottom-up btree build, finish the build by (1)
* (1) completing the sort of the spool file, (2) inserting the * completing the sort of the spool file, (2) inserting the sorted
* sorted tuples into btree pages and (3) building the upper levels. * tuples into btree pages and (3) building the upper levels.
*/ */
if (usefast) if (usefast)
{ {
...@@ -298,26 +298,27 @@ btbuild(Relation heap, ...@@ -298,26 +298,27 @@ btbuild(Relation heap,
/* /*
* Since we just counted the tuples in the heap, we update its stats * Since we just counted the tuples in the heap, we update its stats
* in pg_class to guarantee that the planner takes advantage of the * in pg_class to guarantee that the planner takes advantage of the
* index we just created. But, only update statistics during * index we just created. But, only update statistics during normal
* normal index definitions, not for indices on system catalogs * index definitions, not for indices on system catalogs created
* created during bootstrap processing. We must close the relations * during bootstrap processing. We must close the relations before
* before updating statistics to guarantee that the relcache entries * updating statistics to guarantee that the relcache entries are
* are flushed when we increment the command counter in UpdateStats(). * flushed when we increment the command counter in UpdateStats(). But
* But we do not release any locks on the relations; those will be * we do not release any locks on the relations; those will be held
* held until end of transaction. * until end of transaction.
*/ */
if (IsNormalProcessingMode()) if (IsNormalProcessingMode())
{ {
Oid hrelid = RelationGetRelid(heap); Oid hrelid = RelationGetRelid(heap);
Oid irelid = RelationGetRelid(index); Oid irelid = RelationGetRelid(index);
bool inplace = IsReindexProcessing(); bool inplace = IsReindexProcessing();
heap_close(heap, NoLock); heap_close(heap, NoLock);
index_close(index); index_close(index);
/* /*
UpdateStats(hrelid, nhtups, true); * UpdateStats(hrelid, nhtups, true); UpdateStats(irelid, nitups,
UpdateStats(irelid, nitups, false); * false);
*/ */
UpdateStats(hrelid, nhtups, inplace); UpdateStats(hrelid, nhtups, inplace);
UpdateStats(irelid, nitups, inplace); UpdateStats(irelid, nitups, inplace);
if (oldPred != NULL) if (oldPred != NULL)
...@@ -623,7 +624,7 @@ _bt_restscan(IndexScanDesc scan) ...@@ -623,7 +624,7 @@ _bt_restscan(IndexScanDesc scan)
BTItem item; BTItem item;
BlockNumber blkno; BlockNumber blkno;
LockBuffer(buf, BT_READ); /* lock buffer first! */ LockBuffer(buf, BT_READ); /* lock buffer first! */
page = BufferGetPage(buf); page = BufferGetPage(buf);
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.30 2000/01/26 05:55:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.31 2000/04/12 17:14:49 momjian Exp $
* *
* *
* NOTES * NOTES
...@@ -52,13 +52,16 @@ static void _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offn ...@@ -52,13 +52,16 @@ static void _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offn
void void
AtEOXact_nbtree(void) AtEOXact_nbtree(void)
{ {
/* Note: these actions should only be necessary during xact abort;
* but they can't hurt during a commit. /*
* Note: these actions should only be necessary during xact abort; but
* they can't hurt during a commit.
*/ */
/* Reset the active-scans list to empty. /*
* We do not need to free the list elements, because they're all * Reset the active-scans list to empty. We do not need to free the
* palloc()'d, so they'll go away at end of transaction anyway. * list elements, because they're all palloc()'d, so they'll go away
* at end of transaction anyway.
*/ */
BTScans = NULL; BTScans = NULL;
...@@ -96,7 +99,7 @@ _bt_dropscan(IndexScanDesc scan) ...@@ -96,7 +99,7 @@ _bt_dropscan(IndexScanDesc scan)
last = chk; last = chk;
if (chk == (BTScanList) NULL) if (chk == (BTScanList) NULL)
elog(ERROR, "btree scan list trashed; can't find 0x%p", (void*)scan); elog(ERROR, "btree scan list trashed; can't find 0x%p", (void *) scan);
if (last == (BTScanList) NULL) if (last == (BTScanList) NULL)
BTScans = chk->btsl_next; BTScans = chk->btsl_next;
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* We use tuplesort.c to sort the given index tuples into order. * We use tuplesort.c to sort the given index tuples into order.
* Then we scan the index tuples in order and build the btree pages * Then we scan the index tuples in order and build the btree pages
* for each level. When we have only one page on a level, it must be the * for each level. When we have only one page on a level, it must be the
* root -- it can be attached to the btree metapage and we are done. * root -- it can be attached to the btree metapage and we are done.
* *
* this code is moderately slow (~10% slower) compared to the regular * this code is moderately slow (~10% slower) compared to the regular
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.51 2000/02/18 06:32:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.52 2000/04/12 17:14:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -70,12 +70,12 @@ struct BTSpool ...@@ -70,12 +70,12 @@ struct BTSpool
static void _bt_load(Relation index, BTSpool *btspool); static void _bt_load(Relation index, BTSpool *btspool);
static BTItem _bt_buildadd(Relation index, Size keysz, ScanKey scankey, static BTItem _bt_buildadd(Relation index, Size keysz, ScanKey scankey,
BTPageState *state, BTItem bti, int flags); BTPageState *state, BTItem bti, int flags);
static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend); static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend);
static BTPageState *_bt_pagestate(Relation index, int flags, static BTPageState *_bt_pagestate(Relation index, int flags,
int level, bool doupper); int level, bool doupper);
static void _bt_uppershutdown(Relation index, Size keysz, ScanKey scankey, static void _bt_uppershutdown(Relation index, Size keysz, ScanKey scankey,
BTPageState *state); BTPageState *state);
/* /*
...@@ -86,7 +86,7 @@ static void _bt_uppershutdown(Relation index, Size keysz, ScanKey scankey, ...@@ -86,7 +86,7 @@ static void _bt_uppershutdown(Relation index, Size keysz, ScanKey scankey,
/* /*
* create and initialize a spool structure * create and initialize a spool structure
*/ */
BTSpool * BTSpool *
_bt_spoolinit(Relation index, bool isunique) _bt_spoolinit(Relation index, bool isunique)
{ {
BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool)); BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
...@@ -99,9 +99,9 @@ _bt_spoolinit(Relation index, bool isunique) ...@@ -99,9 +99,9 @@ _bt_spoolinit(Relation index, bool isunique)
btspool->sortstate = tuplesort_begin_index(index, isunique, false); btspool->sortstate = tuplesort_begin_index(index, isunique, false);
/* /*
* Currently, tuplesort provides sort functions on IndexTuples. * Currently, tuplesort provides sort functions on IndexTuples. If we
* If we kept anything in a BTItem other than a regular IndexTuple, * kept anything in a BTItem other than a regular IndexTuple, we'd
* we'd need to modify tuplesort to understand BTItems as such. * need to modify tuplesort to understand BTItems as such.
*/ */
Assert(sizeof(BTItemData) == sizeof(IndexTupleData)); Assert(sizeof(BTItemData) == sizeof(IndexTupleData));
...@@ -306,20 +306,20 @@ _bt_buildadd(Relation index, Size keysz, ScanKey scankey, ...@@ -306,20 +306,20 @@ _bt_buildadd(Relation index, Size keysz, ScanKey scankey,
btisz = MAXALIGN(btisz); btisz = MAXALIGN(btisz);
/* /*
* Check whether the item can fit on a btree page at all. * Check whether the item can fit on a btree page at all. (Eventually,
* (Eventually, we ought to try to apply TOAST methods if not.) * we ought to try to apply TOAST methods if not.) We actually need to
* We actually need to be able to fit three items on every page, * be able to fit three items on every page, so restrict any one item
* so restrict any one item to 1/3 the per-page available space. * to 1/3 the per-page available space. Note that at this point, btisz
* Note that at this point, btisz doesn't include the ItemId. * doesn't include the ItemId.
* *
* NOTE: similar code appears in _bt_insertonpg() to defend against * NOTE: similar code appears in _bt_insertonpg() to defend against
* oversize items being inserted into an already-existing index. * oversize items being inserted into an already-existing index. But
* But during creation of an index, we don't go through there. * during creation of an index, we don't go through there.
*/ */
if (btisz > (PageGetPageSize(npage)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData)) if (btisz > (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
elog(ERROR, "btree: index item size %d exceeds maximum %ld", elog(ERROR, "btree: index item size %d exceeds maximum %ld",
btisz, btisz,
(PageGetPageSize(npage)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData)); (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
if (pgspc < btisz) if (pgspc < btisz)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.35 2000/02/18 06:32:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.36 2000/04/12 17:14:50 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -141,7 +141,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so) ...@@ -141,7 +141,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
uint16 numberOfKeys = so->numberOfKeys; uint16 numberOfKeys = so->numberOfKeys;
uint16 new_numberOfKeys = 0; uint16 new_numberOfKeys = 0;
AttrNumber attno = 1; AttrNumber attno = 1;
bool equalStrategyEnd, underEqualStrategy; bool equalStrategyEnd,
underEqualStrategy;
if (numberOfKeys < 1) if (numberOfKeys < 1)
return; return;
...@@ -194,6 +195,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so) ...@@ -194,6 +195,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1); elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1);
underEqualStrategy = (!equalStrategyEnd); underEqualStrategy = (!equalStrategyEnd);
/* /*
* If = has been specified, no other key will be used. In case * If = has been specified, no other key will be used. In case
* of key < 2 && key == 1 and so on we have to set qual_ok to * of key < 2 && key == 1 and so on we have to set qual_ok to
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment