Renaming cleanup, no pgindent yet.

This commit is contained in:
Bruce Momjian 1998-09-01 03:29:17 +00:00
parent 2aa080fc93
commit af74855a60
329 changed files with 4380 additions and 4388 deletions

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.39 1998/08/19 02:00:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.40 1998/09/01 03:20:41 momjian Exp $
* *
* NOTES * NOTES
* The old interface functions have been converted to macros * The old interface functions have been converted to macros
@ -55,13 +55,13 @@ long heap_sysoffset[] = {
*/ */
Size Size
ComputeDataSize(TupleDesc tupleDesc, ComputeDataSize(TupleDesc tupleDesc,
Datum value[], Datum *value,
char nulls[]) char *nulls)
{ {
uint32 data_length; uint32 data_length;
int i; int i;
int numberOfAttributes = tupleDesc->natts; int numberOfAttributes = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
for (data_length = 0, i = 0; i < numberOfAttributes; i++) for (data_length = 0, i = 0; i < numberOfAttributes; i++)
{ {
@ -118,8 +118,8 @@ ComputeDataSize(TupleDesc tupleDesc,
void void
DataFill(char *data, DataFill(char *data,
TupleDesc tupleDesc, TupleDesc tupleDesc,
Datum value[], Datum *value,
char nulls[], char *nulls,
uint16 *infomask, uint16 *infomask,
bits8 *bit) bits8 *bit)
{ {
@ -128,7 +128,7 @@ DataFill(char *data,
uint32 data_length; uint32 data_length;
int i; int i;
int numberOfAttributes = tupleDesc->natts; int numberOfAttributes = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
if (bit != NULL) if (bit != NULL)
{ {
@ -227,13 +227,13 @@ int
heap_attisnull(HeapTuple tup, int attnum) heap_attisnull(HeapTuple tup, int attnum)
{ {
if (attnum > (int) tup->t_natts) if (attnum > (int) tup->t_natts)
return (1); return 1;
if (HeapTupleNoNulls(tup)) if (HeapTupleNoNulls(tup))
return (0); return 0;
if (attnum > 0) if (attnum > 0)
return (att_isnull(attnum - 1, tup->t_bits)); return att_isnull(attnum - 1, tup->t_bits);
else else
switch (attnum) switch (attnum)
{ {
@ -252,7 +252,7 @@ heap_attisnull(HeapTuple tup, int attnum)
elog(ERROR, "heap_attisnull: undefined negative attnum"); elog(ERROR, "heap_attisnull: undefined negative attnum");
} }
return (0); return 0;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -343,21 +343,21 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
switch (attnum) switch (attnum)
{ {
case SelfItemPointerAttributeNumber: case SelfItemPointerAttributeNumber:
return ((Datum) &tup->t_ctid); return (Datum) &tup->t_ctid;
case ObjectIdAttributeNumber: case ObjectIdAttributeNumber:
return ((Datum) (long) tup->t_oid); return (Datum) (long) tup->t_oid;
case MinTransactionIdAttributeNumber: case MinTransactionIdAttributeNumber:
return ((Datum) (long) tup->t_xmin); return (Datum) (long) tup->t_xmin;
case MinCommandIdAttributeNumber: case MinCommandIdAttributeNumber:
return ((Datum) (long) tup->t_cmin); return (Datum) (long) tup->t_cmin;
case MaxTransactionIdAttributeNumber: case MaxTransactionIdAttributeNumber:
return ((Datum) (long) tup->t_xmax); return (Datum) (long) tup->t_xmax;
case MaxCommandIdAttributeNumber: case MaxCommandIdAttributeNumber:
return ((Datum) (long) tup->t_cmax); return (Datum) (long) tup->t_cmax;
default: default:
elog(ERROR, "heap_getsysattr: undefined attnum %d", attnum); elog(ERROR, "heap_getsysattr: undefined attnum %d", attnum);
} }
return ((Datum) NULL); return (Datum) NULL;
} }
/* ---------------- /* ----------------
@ -388,7 +388,7 @@ nocachegetattr(HeapTuple tup,
char *tp; /* ptr to att in tuple */ char *tp; /* ptr to att in tuple */
bits8 *bp = tup->t_bits; /* ptr to att in tuple */ bits8 *bp = tup->t_bits; /* ptr to att in tuple */
int slow; /* do we have to walk nulls? */ int slow; /* do we have to walk nulls? */
AttributeTupleForm *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
#if IN_MACRO #if IN_MACRO
@ -426,7 +426,7 @@ nocachegetattr(HeapTuple tup,
/* /*
* first attribute is always at position zero * first attribute is always at position zero
*/ */
return ((Datum) fetchatt(&(att[0]), (char *) tup + tup->t_hoff)); return (Datum) fetchatt(&(att[0]), (char *) tup + tup->t_hoff);
} }
#endif #endif
@ -505,7 +505,7 @@ nocachegetattr(HeapTuple tup,
tp + att[attnum]->attcacheoff); tp + att[attnum]->attcacheoff);
} }
else if (attnum == 0) else if (attnum == 0)
return ((Datum) fetchatt(&(att[0]), (char *) tp)); return (Datum) fetchatt(&(att[0]), (char *) tp);
else if (!HeapTupleAllFixed(tup)) else if (!HeapTupleAllFixed(tup))
{ {
int j = 0; int j = 0;
@ -734,11 +734,11 @@ heap_copytuple(HeapTuple tuple)
HeapTuple newTuple; HeapTuple newTuple;
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
return (NULL); return NULL;
newTuple = (HeapTuple) palloc(tuple->t_len); newTuple = (HeapTuple) palloc(tuple->t_len);
memmove((char *) newTuple, (char *) tuple, (int) tuple->t_len); memmove((char *) newTuple, (char *) tuple, (int) tuple->t_len);
return (newTuple); return newTuple;
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -751,8 +751,8 @@ heap_copytuple(HeapTuple tuple)
void void
heap_deformtuple(HeapTuple tuple, heap_deformtuple(HeapTuple tuple,
TupleDesc tdesc, TupleDesc tdesc,
Datum values[], Datum *values,
char nulls[]) char *nulls)
{ {
int i; int i;
int natts; int natts;
@ -780,7 +780,7 @@ heap_deformtuple(HeapTuple tuple,
/* ---------------- /* ----------------
* heap_formtuple * heap_formtuple
* *
* constructs a tuple from the given value[] and null[] arrays * constructs a tuple from the given *value and *null arrays
* *
* old comments * old comments
* Handles alignment by aligning 2 byte attributes on short boundries * Handles alignment by aligning 2 byte attributes on short boundries
@ -789,7 +789,7 @@ heap_deformtuple(HeapTuple tuple,
* not properly align fixed length arrays of 1 or 2 byte types (yet). * not properly align fixed length arrays of 1 or 2 byte types (yet).
* *
* Null attributes are indicated by a 'n' in the appropriate byte * Null attributes are indicated by a 'n' in the appropriate byte
* of the null[]. Non-null attributes are indicated by a ' ' (space). * of the *null. Non-null attributes are indicated by a ' ' (space).
* *
* Fix me. (Figure that must keep context if debug--allow give oid.) * Fix me. (Figure that must keep context if debug--allow give oid.)
* Assumes in order. * Assumes in order.
@ -797,8 +797,8 @@ heap_deformtuple(HeapTuple tuple,
*/ */
HeapTuple HeapTuple
heap_formtuple(TupleDesc tupleDescriptor, heap_formtuple(TupleDesc tupleDescriptor,
Datum value[], Datum *value,
char nulls[]) char *nulls)
{ {
char *tp; /* tuple pointer */ char *tp; /* tuple pointer */
HeapTuple tuple; /* return tuple */ HeapTuple tuple; /* return tuple */
@ -849,7 +849,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
tuple->t_infomask |= HEAP_XMAX_INVALID; tuple->t_infomask |= HEAP_XMAX_INVALID;
return (tuple); return tuple;
} }
/* ---------------- /* ----------------
@ -862,9 +862,9 @@ heap_formtuple(TupleDesc tupleDescriptor,
HeapTuple HeapTuple
heap_modifytuple(HeapTuple tuple, heap_modifytuple(HeapTuple tuple,
Relation relation, Relation relation,
Datum replValue[], Datum *replValue,
char replNull[], char *replNull,
char repl[]) char *repl)
{ {
int attoff; int attoff;
int numberOfAttributes; int numberOfAttributes;
@ -884,10 +884,10 @@ heap_modifytuple(HeapTuple tuple,
Assert(PointerIsValid(replNull)); Assert(PointerIsValid(replNull));
Assert(PointerIsValid(repl)); Assert(PointerIsValid(repl));
numberOfAttributes = RelationGetRelationTupleForm(relation)->relnatts; numberOfAttributes = RelationGetForm(relation)->relnatts;
/* ---------------- /* ----------------
* allocate and fill value[] and nulls[] arrays from either * allocate and fill *value and *nulls arrays from either
* the tuple or the repl information, as appropriate. * the tuple or the repl information, as appropriate.
* ---------------- * ----------------
*/ */
@ -904,7 +904,7 @@ heap_modifytuple(HeapTuple tuple,
value[attoff] = value[attoff] =
heap_getattr(tuple, heap_getattr(tuple,
AttrOffsetGetAttrNumber(attoff), AttrOffsetGetAttrNumber(attoff),
RelationGetTupleDescriptor(relation), RelationGetDescr(relation),
&isNull); &isNull);
nulls[attoff] = (isNull) ? 'n' : ' '; nulls[attoff] = (isNull) ? 'n' : ' ';
@ -919,10 +919,10 @@ heap_modifytuple(HeapTuple tuple,
} }
/* ---------------- /* ----------------
* create a new tuple from the values[] and nulls[] arrays * create a new tuple from the *values and *nulls arrays
* ---------------- * ----------------
*/ */
newTuple = heap_formtuple(RelationGetTupleDescriptor(relation), newTuple = heap_formtuple(RelationGetDescr(relation),
value, value,
nulls); nulls);
@ -972,5 +972,5 @@ heap_addheader(uint32 natts, /* max domain index */
memmove(tp, structure, structlen); memmove(tp, structure, structlen);
return (tup); return tup;
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.30 1998/08/27 05:06:54 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.31 1998/09/01 03:20:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -38,8 +38,8 @@
*/ */
IndexTuple IndexTuple
index_formtuple(TupleDesc tupleDescriptor, index_formtuple(TupleDesc tupleDescriptor,
Datum value[], Datum *value,
char null[]) char *null)
{ {
char *tp; /* tuple pointer */ char *tp; /* tuple pointer */
IndexTuple tuple; /* return tuple */ IndexTuple tuple; /* return tuple */
@ -107,7 +107,7 @@ index_formtuple(TupleDesc tupleDescriptor,
* ---------------- * ----------------
*/ */
tuple->t_info = infomask; tuple->t_info = infomask;
return (tuple); return tuple;
} }
/* ---------------- /* ----------------
@ -139,7 +139,7 @@ nocache_index_getattr(IndexTuple tup,
char *bp = NULL; /* ptr to att in tuple */ char *bp = NULL; /* ptr to att in tuple */
int slow; /* do we have to walk nulls? */ int slow; /* do we have to walk nulls? */
int data_off; /* tuple data offset */ int data_off; /* tuple data offset */
AttributeTupleForm *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
/* ---------------- /* ----------------
* sanity checks * sanity checks
@ -256,7 +256,7 @@ nocache_index_getattr(IndexTuple tup,
tp + att[attnum]->attcacheoff); tp + att[attnum]->attcacheoff);
} }
else if (attnum == 0) else if (attnum == 0)
return ((Datum) fetchatt(&(att[0]), (char *) tp)); return (Datum) fetchatt(&(att[0]), (char *) tp);
else if (!IndexTupleAllFixed(tup)) else if (!IndexTupleAllFixed(tup))
{ {
int j = 0; int j = 0;
@ -461,7 +461,7 @@ FormRetrieveIndexResult(ItemPointer indexItemPointer,
result->index_iptr = *indexItemPointer; result->index_iptr = *indexItemPointer;
result->heap_iptr = *heapItemPointer; result->heap_iptr = *heapItemPointer;
return (result); return result;
} }
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.19 1998/06/15 19:27:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.20 1998/09/01 03:20:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -57,11 +57,11 @@ index_keytest(IndexTuple tuple,
if (isNull) if (isNull)
{ {
/* XXX eventually should check if SK_ISNULL */ /* XXX eventually should check if SK_ISNULL */
return (false); return false;
} }
if (key[0].sk_flags & SK_ISNULL) if (key[0].sk_flags & SK_ISNULL)
return (false); return false;
if (key[0].sk_flags & SK_COMMUTE) if (key[0].sk_flags & SK_COMMUTE)
{ {
@ -77,11 +77,11 @@ index_keytest(IndexTuple tuple,
} }
if (!test == !(key[0].sk_flags & SK_NEGATE)) if (!test == !(key[0].sk_flags & SK_NEGATE))
return (false); return false;
scanKeySize -= 1; scanKeySize -= 1;
key++; key++;
} }
return (true); return true;
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.33 1998/08/30 19:30:38 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.34 1998/09/01 03:20:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -46,10 +46,10 @@ typtoout(Oid type)
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typeTuple)) if (HeapTupleIsValid(typeTuple))
return ((Oid) ((TypeTupleForm) GETSTRUCT(typeTuple))->typoutput); return (Oid) ((Form_pg_type) GETSTRUCT(typeTuple))->typoutput;
elog(ERROR, "typtoout: Cache lookup of type %d failed", type); elog(ERROR, "typtoout: Cache lookup of type %d failed", type);
return (InvalidOid); return InvalidOid;
} }
Oid Oid
@ -62,10 +62,10 @@ gettypelem(Oid type)
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typeTuple)) if (HeapTupleIsValid(typeTuple))
return ((Oid) ((TypeTupleForm) GETSTRUCT(typeTuple))->typelem); return (Oid) ((Form_pg_type) GETSTRUCT(typeTuple))->typelem;
elog(ERROR, "typtoout: Cache lookup of type %d failed", type); elog(ERROR, "typtoout: Cache lookup of type %d failed", type);
return (InvalidOid); return InvalidOid;
} }
/* ---------------- /* ----------------
@ -157,7 +157,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
*/ */
static void static void
printatt(unsigned attributeId, printatt(unsigned attributeId,
AttributeTupleForm attributeP, Form_pg_attribute attributeP,
char *value) char *value)
{ {
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n", printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
@ -181,7 +181,7 @@ showatts(char *name, TupleDesc tupleDesc)
{ {
int i; int i;
int natts = tupleDesc->natts; int natts = tupleDesc->natts;
AttributeTupleForm *attinfo = tupleDesc->attrs; Form_pg_attribute *attinfo = tupleDesc->attrs;
puts(name); puts(name);
for (i = 0; i < natts; ++i) for (i = 0; i < natts; ++i)

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.42 1998/08/19 02:00:56 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.43 1998/09/01 03:20:46 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
@ -57,25 +57,25 @@ CreateTemplateTupleDesc(int natts)
* is filled with NULL pointers. * is filled with NULL pointers.
* ---------------- * ----------------
*/ */
size = natts * sizeof(AttributeTupleForm); size = natts * sizeof(Form_pg_attribute);
desc = (TupleDesc) palloc(sizeof(struct tupleDesc)); desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->attrs = (AttributeTupleForm *) palloc(size); desc->attrs = (Form_pg_attribute *) palloc(size);
desc->constr = NULL; desc->constr = NULL;
MemSet(desc->attrs, 0, size); MemSet(desc->attrs, 0, size);
desc->natts = natts; desc->natts = natts;
return (desc); return desc;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* CreateTupleDesc * CreateTupleDesc
* *
* This function allocates a new TupleDesc from AttributeTupleForm array * This function allocates a new TupleDesc from Form_pg_attribute array
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
TupleDesc TupleDesc
CreateTupleDesc(int natts, AttributeTupleForm *attrs) CreateTupleDesc(int natts, Form_pg_attribute *attrs)
{ {
TupleDesc desc; TupleDesc desc;
@ -90,7 +90,7 @@ CreateTupleDesc(int natts, AttributeTupleForm *attrs)
desc->natts = natts; desc->natts = natts;
desc->constr = NULL; desc->constr = NULL;
return (desc); return desc;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -111,12 +111,12 @@ CreateTupleDescCopy(TupleDesc tupdesc)
desc = (TupleDesc) palloc(sizeof(struct tupleDesc)); desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts; desc->natts = tupdesc->natts;
size = desc->natts * sizeof(AttributeTupleForm); size = desc->natts * sizeof(Form_pg_attribute);
desc->attrs = (AttributeTupleForm *) palloc(size); desc->attrs = (Form_pg_attribute *) palloc(size);
for (i = 0; i < desc->natts; i++) for (i = 0; i < desc->natts; i++)
{ {
desc->attrs[i] = desc->attrs[i] =
(AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove(desc->attrs[i], memmove(desc->attrs[i],
tupdesc->attrs[i], tupdesc->attrs[i],
ATTRIBUTE_TUPLE_SIZE); ATTRIBUTE_TUPLE_SIZE);
@ -146,12 +146,12 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
desc = (TupleDesc) palloc(sizeof(struct tupleDesc)); desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts; desc->natts = tupdesc->natts;
size = desc->natts * sizeof(AttributeTupleForm); size = desc->natts * sizeof(Form_pg_attribute);
desc->attrs = (AttributeTupleForm *) palloc(size); desc->attrs = (Form_pg_attribute *) palloc(size);
for (i = 0; i < desc->natts; i++) for (i = 0; i < desc->natts; i++)
{ {
desc->attrs[i] = desc->attrs[i] =
(AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove(desc->attrs[i], memmove(desc->attrs[i],
tupdesc->attrs[i], tupdesc->attrs[i],
ATTRIBUTE_TUPLE_SIZE); ATTRIBUTE_TUPLE_SIZE);
@ -260,8 +260,8 @@ TupleDescInitEntry(TupleDesc desc,
bool attisset) bool attisset)
{ {
HeapTuple tuple; HeapTuple tuple;
TypeTupleForm typeForm; Form_pg_type typeForm;
AttributeTupleForm att; Form_pg_attribute att;
/* ---------------- /* ----------------
* sanity checks * sanity checks
@ -284,7 +284,7 @@ TupleDescInitEntry(TupleDesc desc,
* ---------------- * ----------------
*/ */
att = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); att = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
desc->attrs[attributeNumber - 1] = att; desc->attrs[attributeNumber - 1] = att;
/* ---------------- /* ----------------
@ -349,7 +349,7 @@ TupleDescInitEntry(TupleDesc desc,
* information from the type tuple we found.. * information from the type tuple we found..
* ---------------- * ----------------
*/ */
typeForm = (TypeTupleForm) GETSTRUCT(tuple); typeForm = (Form_pg_type) GETSTRUCT(tuple);
att->atttypid = tuple->t_oid; att->atttypid = tuple->t_oid;
att->attalign = typeForm->typalign; att->attalign = typeForm->typalign;
@ -412,7 +412,7 @@ TupleDescMakeSelfReference(TupleDesc desc,
AttrNumber attnum, AttrNumber attnum,
char *relname) char *relname)
{ {
AttributeTupleForm att; Form_pg_attribute att;
Type t = typeidType(OIDOID); Type t = typeidType(OIDOID);
att = desc->attrs[attnum - 1]; att = desc->attrs[attnum - 1];

View File

@ -141,8 +141,8 @@ gistbuild(Relation heap,
} }
/* init the tuple descriptors and get set for a heap scan */ /* init the tuple descriptors and get set for a heap scan */
hd = RelationGetTupleDescriptor(heap); hd = RelationGetDescr(heap);
id = RelationGetTupleDescriptor(index); id = RelationGetDescr(index);
d = (Datum *) palloc(natts * sizeof(*d)); d = (Datum *) palloc(natts * sizeof(*d));
nulls = (bool *) palloc(natts * sizeof(*nulls)); nulls = (bool *) palloc(natts * sizeof(*nulls));
@ -350,7 +350,7 @@ gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
compvec[i] = FALSE; compvec[i] = FALSE;
datum[i] = (Datum) tmpentry.pred; datum[i] = (Datum) tmpentry.pred;
} }
itup = index_formtuple(RelationGetTupleDescriptor(r), datum, nulls); itup = index_formtuple(RelationGetDescr(r), datum, nulls);
itup->t_tid = *ht_ctid; itup->t_tid = *ht_ctid;
RelationSetLockForWrite(r); RelationSetLockForWrite(r);
@ -362,7 +362,7 @@ gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
pfree(compvec); pfree(compvec);
/* XXX two-phase locking -- don't unlock the relation until EOT */ /* XXX two-phase locking -- don't unlock the relation until EOT */
return (res); return res;
} }
/* /*
@ -431,7 +431,7 @@ gistdoinsert(Relation r,
res = gistSplit(r, buffer, stack, itup, giststate); res = gistSplit(r, buffer, stack, itup, giststate);
gistfreestack(stack); gistfreestack(stack);
WriteBuffer(buffer); /* don't forget to release buffer! */ WriteBuffer(buffer); /* don't forget to release buffer! */
return (res); return res;
} }
if (PageIsEmpty(page)) if (PageIsEmpty(page))
@ -458,7 +458,7 @@ gistdoinsert(Relation r,
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData)); res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), blk, l); ItemPointerSet(&(res->pointerData), blk, l);
return (res); return res;
} }
@ -512,7 +512,7 @@ gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
*retstack = stack; *retstack = stack;
*leafbuf = buffer; *leafbuf = buffer;
return (blk); return blk;
} }
@ -568,7 +568,7 @@ gistAdjustKeys(Relation r,
(*fmgr_faddr(&giststate->equalFn)) (ev0p->pred, datum, &result); (*fmgr_faddr(&giststate->equalFn)) (ev0p->pred, datum, &result);
if (!result) if (!result)
{ {
TupleDesc td = RelationGetTupleDescriptor(r); TupleDesc td = RelationGetDescr(r);
/* compress datum for storage on page */ /* compress datum for storage on page */
gistcentryinit(giststate, &centry, datum, ev0p->rel, ev0p->page, gistcentryinit(giststate, &centry, datum, ev0p->rel, ev0p->page,
@ -869,7 +869,7 @@ gistSplit(Relation r,
pfree(ltup); pfree(ltup);
pfree(rtup); pfree(rtup);
return (res); return res;
} }
/* /*
@ -962,7 +962,7 @@ gistentryinsert(Relation r, GISTSTACK *stk, IndexTuple tup,
res = gistSplit(r, b, stk->gs_parent, tup, giststate); res = gistSplit(r, b, stk->gs_parent, tup, giststate);
WriteBuffer(b); /* don't forget to release buffer! - WriteBuffer(b); /* don't forget to release buffer! -
* 01/31/94 */ * 01/31/94 */
return (res); return res;
} }
else else
{ {
@ -978,7 +978,7 @@ gistentryinsert(Relation r, GISTSTACK *stk, IndexTuple tup,
pfree(tmpentry.pred); pfree(tmpentry.pred);
if (tup != newtup) if (tup != newtup)
pfree(newtup); pfree(newtup);
return (res); return res;
} }
} }
@ -1079,13 +1079,13 @@ gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
if (identry.pred != id) if (identry.pred != id)
pfree(identry.pred); pfree(identry.pred);
return (which); return which;
} }
static int static int
gistnospace(Page p, IndexTuple it) gistnospace(Page p, IndexTuple it)
{ {
return (PageGetFreeSpace(p) < IndexTupleSize(it)); return PageGetFreeSpace(p) < IndexTupleSize(it);
} }
void void
@ -1144,7 +1144,7 @@ initGISTstate(GISTSTATE *giststate, Relation index)
picksplit_proc, picksplit_proc,
equal_proc; equal_proc;
HeapTuple htup; HeapTuple htup;
IndexTupleForm itupform; Form_pg_index itupform;
consistent_proc = index_getprocid(index, 1, GIST_CONSISTENT_PROC); consistent_proc = index_getprocid(index, 1, GIST_CONSISTENT_PROC);
union_proc = index_getprocid(index, 1, GIST_UNION_PROC); union_proc = index_getprocid(index, 1, GIST_UNION_PROC);
@ -1165,7 +1165,7 @@ initGISTstate(GISTSTATE *giststate, Relation index)
htup = SearchSysCacheTuple(INDEXRELID, htup = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(index)), ObjectIdGetDatum(RelationGetRelid(index)),
0, 0, 0); 0, 0, 0);
itupform = (IndexTupleForm) GETSTRUCT(htup); itupform = (Form_pg_index) GETSTRUCT(htup);
if (!HeapTupleIsValid(htup)) if (!HeapTupleIsValid(htup))
elog(ERROR, "initGISTstate: index %d not found", elog(ERROR, "initGISTstate: index %d not found",
RelationGetRelid(index)); RelationGetRelid(index));
@ -1183,7 +1183,7 @@ initGISTstate(GISTSTATE *giststate, Relation index)
itupform->indexrelid, FirstOffsetNumber); itupform->indexrelid, FirstOffsetNumber);
return; return;
} }
giststate->keytypbyval = (((AttributeTupleForm) htup)->attbyval); giststate->keytypbyval = (((Form_pg_attribute) htup)->attbyval);
} }
else else
giststate->keytypbyval = FALSE; giststate->keytypbyval = FALSE;
@ -1210,7 +1210,7 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
/* or in new size */ /* or in new size */
t->t_info |= MAXALIGN(entry.bytes + sizeof(IndexTupleData)); t->t_info |= MAXALIGN(entry.bytes + sizeof(IndexTupleData));
return (t); return t;
} }
else else
{ {
@ -1228,7 +1228,7 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
isnull); isnull);
newtup->t_tid = t->t_tid; newtup->t_tid = t->t_tid;
pfree(isnull); pfree(isnull);
return (newtup); return newtup;
} }
} }
@ -1345,7 +1345,7 @@ text_range_out(TXTRANGE *r)
*upper; *upper;
if (r == NULL) if (r == NULL)
return (NULL); return NULL;
result = (char *) palloc(NAMEDATALEN + VARSIZE(TRLOWER(r)) + VARSIZE(TRUPPER(r)) result = (char *) palloc(NAMEDATALEN + VARSIZE(TRLOWER(r)) + VARSIZE(TRUPPER(r))
- 2 * VARHDRSZ); - 2 * VARHDRSZ);
@ -1359,7 +1359,7 @@ text_range_out(TXTRANGE *r)
sprintf(result, "[%s,%s): %d", lower, upper, r->flag); sprintf(result, "[%s,%s): %d", lower, upper, r->flag);
pfree(lower); pfree(lower);
pfree(upper); pfree(upper);
return (result); return result;
} }
#endif #endif
@ -1370,11 +1370,11 @@ int_range_out(INTRANGE *r)
char *result; char *result;
if (r == NULL) if (r == NULL)
return (NULL); return NULL;
result = (char *) palloc(80); result = (char *) palloc(80);
sprintf(result, "[%d,%d): %d", r->lower, r->upper, r->flag); sprintf(result, "[%d,%d): %d", r->lower, r->upper, r->flag);
return (result); return result;
} }
#endif /* defined GISTDEBUG */ #endif /* defined GISTDEBUG */

View File

@ -48,14 +48,14 @@ gistgettuple(IndexScanDesc s, ScanDirection dir)
/* if we have it cached in the scan desc, just return the value */ /* if we have it cached in the scan desc, just return the value */
if ((res = gistscancache(s, dir)) != (RetrieveIndexResult) NULL) if ((res = gistscancache(s, dir)) != (RetrieveIndexResult) NULL)
return (res); return res;
/* not cached, so we'll have to do some work */ /* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData))) if (ItemPointerIsValid(&(s->currentItemData)))
res = gistnext(s, dir); res = gistnext(s, dir);
else else
res = gistfirst(s, dir); res = gistfirst(s, dir);
return (res); return res;
} }
static RetrieveIndexResult static RetrieveIndexResult
@ -90,7 +90,7 @@ gistfirst(IndexScanDesc s, ScanDirection dir)
ReleaseBuffer(b); ReleaseBuffer(b);
if (so->s_stack == (GISTSTACK *) NULL) if (so->s_stack == (GISTSTACK *) NULL)
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
stk = so->s_stack; stk = so->s_stack;
b = ReadBuffer(s->relation, stk->gs_blk); b = ReadBuffer(s->relation, stk->gs_blk);
@ -116,7 +116,7 @@ gistfirst(IndexScanDesc s, ScanDirection dir)
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid)); res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b); ReleaseBuffer(b);
return (res); return res;
} }
else else
{ {
@ -174,7 +174,7 @@ gistnext(IndexScanDesc s, ScanDirection dir)
ReleaseBuffer(b); ReleaseBuffer(b);
if (so->s_stack == (GISTSTACK *) NULL) if (so->s_stack == (GISTSTACK *) NULL)
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
stk = so->s_stack; stk = so->s_stack;
b = ReadBuffer(s->relation, stk->gs_blk); b = ReadBuffer(s->relation, stk->gs_blk);
@ -200,7 +200,7 @@ gistnext(IndexScanDesc s, ScanDirection dir)
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid)); res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b); ReleaseBuffer(b);
return (res); return res;
} }
else else
{ {
@ -258,7 +258,7 @@ gistindex_keytest(IndexTuple tuple,
if (isNull) if (isNull)
{ {
/* XXX eventually should check if SK_ISNULL */ /* XXX eventually should check if SK_ISNULL */
return (false); return false;
} }
if (key[0].sk_flags & SK_COMMUTE) if (key[0].sk_flags & SK_COMMUTE)
@ -276,13 +276,13 @@ gistindex_keytest(IndexTuple tuple,
} }
if (!test == !(key[0].sk_flags & SK_NEGATE)) if (!test == !(key[0].sk_flags & SK_NEGATE))
return (false); return false;
scanKeySize -= 1; scanKeySize -= 1;
key++; key++;
} }
return (true); return true;
} }
@ -315,7 +315,7 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
{ {
it = (char *) PageGetItem(p, PageGetItemId(p, n)); it = (char *) PageGetItem(p, PageGetItemId(p, n));
if (gistindex_keytest((IndexTuple) it, if (gistindex_keytest((IndexTuple) it,
RelationGetTupleDescriptor(s->relation), RelationGetDescr(s->relation),
s->numberOfKeys, s->keyData, giststate, s->numberOfKeys, s->keyData, giststate,
s->relation, p, n)) s->relation, p, n))
break; break;
@ -326,7 +326,7 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
n = OffsetNumberNext(n); n = OffsetNumberNext(n);
} }
return (n); return n;
} }
static RetrieveIndexResult static RetrieveIndexResult
@ -339,7 +339,7 @@ gistscancache(IndexScanDesc s, ScanDirection dir)
&& ItemPointerIsValid(&(s->currentItemData)))) && ItemPointerIsValid(&(s->currentItemData))))
{ {
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
ip = gistheapptr(s->relation, &(s->currentItemData)); ip = gistheapptr(s->relation, &(s->currentItemData));
@ -351,7 +351,7 @@ gistscancache(IndexScanDesc s, ScanDirection dir)
pfree(ip); pfree(ip);
return (res); return res;
} }
/* /*
@ -381,5 +381,5 @@ gistheapptr(Relation r, ItemPointer itemp)
else else
ItemPointerSetInvalid(ip); ItemPointerSetInvalid(ip);
return (ip); return ip;
} }

View File

@ -72,7 +72,7 @@ gistbeginscan(Relation r,
s = RelationGetIndexScan(r, fromEnd, nkeys, key); s = RelationGetIndexScan(r, fromEnd, nkeys, key);
gistregscan(s); gistregscan(s);
return (s); return s;
} }
void void

View File

@ -99,7 +99,7 @@ RelationGetGISTStrategy(Relation r,
AttrNumber attnum, AttrNumber attnum,
RegProcedure proc) RegProcedure proc)
{ {
return (RelationGetStrategy(r, attnum, &GISTEvaluationData, proc)); return RelationGetStrategy(r, attnum, &GISTEvaluationData, proc);
} }
#ifdef NOT_USED #ifdef NOT_USED

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.20 1998/08/19 02:01:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.21 1998/09/01 03:20:53 momjian Exp $
* *
* NOTES * NOTES
* This file contains only the public interface routines. * This file contains only the public interface routines.
@ -88,8 +88,8 @@ hashbuild(Relation heap,
_hash_metapinit(index); _hash_metapinit(index);
/* get tuple descriptors for heap and index relations */ /* get tuple descriptors for heap and index relations */
htupdesc = RelationGetTupleDescriptor(heap); htupdesc = RelationGetDescr(heap);
itupdesc = RelationGetTupleDescriptor(index); itupdesc = RelationGetDescr(index);
/* get space for data items that'll appear in the index tuple */ /* get space for data items that'll appear in the index tuple */
attdata = (Datum *) palloc(natts * sizeof(Datum)); attdata = (Datum *) palloc(natts * sizeof(Datum));
@ -284,11 +284,11 @@ hashinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relatio
/* generate an index tuple */ /* generate an index tuple */
itup = index_formtuple(RelationGetTupleDescriptor(rel), datum, nulls); itup = index_formtuple(RelationGetDescr(rel), datum, nulls);
itup->t_tid = *ht_ctid; itup->t_tid = *ht_ctid;
if (itup->t_info & INDEX_NULL_MASK) if (itup->t_info & INDEX_NULL_MASK)
return ((InsertIndexResult) NULL); return (InsertIndexResult) NULL;
hitem = _hash_formitem(itup); hitem = _hash_formitem(itup);
@ -297,7 +297,7 @@ hashinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relatio
pfree(hitem); pfree(hitem);
pfree(itup); pfree(itup);
return (res); return res;
} }
@ -320,7 +320,7 @@ hashgettuple(IndexScanDesc scan, ScanDirection dir)
else else
res = _hash_first(scan, dir); res = _hash_first(scan, dir);
return ((char *) res); return (char *) res;
} }
@ -345,7 +345,7 @@ hashbeginscan(Relation rel,
/* register scan in case we change pages it's using */ /* register scan in case we change pages it's using */
_hash_regscan(scan); _hash_regscan(scan);
return ((char *) scan); return (char *) scan;
} }
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.10 1998/08/19 02:01:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.11 1998/09/01 03:20:54 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
@ -23,13 +23,13 @@
uint32 uint32
hashint2(int16 key) hashint2(int16 key)
{ {
return ((uint32) ~key); return (uint32) ~key;
} }
uint32 uint32
hashint4(uint32 key) hashint4(uint32 key)
{ {
return (~key); return ~key;
} }
/* Hash function from Chris Torek. */ /* Hash function from Chris Torek. */
@ -76,7 +76,7 @@ hashfloat4(float32 keyp)
} while (--loop); } while (--loop);
} }
} }
return (h); return h;
} }
@ -123,18 +123,18 @@ hashfloat8(float64 keyp)
} while (--loop); } while (--loop);
} }
} }
return (h); return h;
} }
uint32 uint32
hashoid(Oid key) hashoid(Oid key)
{ {
return ((uint32) ~key); return (uint32) ~key;
} }
uint32 uint32
hashoid8(Oid key[]) hashoid8(Oid *key)
{ {
int i; int i;
uint32 result = 0; uint32 result = 0;
@ -160,7 +160,7 @@ hashchar(char key)
h = h * PRIME1 ^ (key - ' '); h = h * PRIME1 ^ (key - ' ');
h %= PRIME2; h %= PRIME2;
return (h); return h;
} }
@ -180,7 +180,7 @@ hashname(NameData *n)
h = h * PRIME1 ^ (*key++ - ' '); h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2; h %= PRIME2;
return (h); return h;
} }
@ -240,5 +240,5 @@ hashtext(struct varlena * key)
} while (--loop); } while (--loop);
} }
} }
return (n); return n;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.13 1998/06/15 19:27:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.14 1998/09/01 03:20:56 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -85,7 +85,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
/* be tidy */ /* be tidy */
_hash_freeskey(itup_scankey); _hash_freeskey(itup_scankey);
return (res); return res;
} }
/* /*
@ -206,7 +206,7 @@ _hash_insertonpg(Relation rel,
> metap->hashm_ffactor) > metap->hashm_ffactor)
_hash_expandtable(rel, metabuf); _hash_expandtable(rel, metabuf);
_hash_relbuf(rel, metabuf, HASH_READ); _hash_relbuf(rel, metabuf, HASH_READ);
return (res); return res;
} }
/* /*
@ -236,5 +236,5 @@ _hash_pgaddtup(Relation rel,
/* write the buffer, but hold our lock */ /* write the buffer, but hold our lock */
_hash_wrtnorelbuf(rel, buf); _hash_wrtnorelbuf(rel, buf);
return (itup_off); return itup_off;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.16 1998/06/15 19:27:49 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.17 1998/09/01 03:20:57 momjian Exp $
* *
* NOTES * NOTES
* Overflow pages look like ordinary relation pages. * Overflow pages look like ordinary relation pages.
@ -84,7 +84,7 @@ _hash_addovflpage(Relation rel, Buffer *metabufp, Buffer buf)
/* logically chain overflow page to previous page */ /* logically chain overflow page to previous page */
pageopaque->hasho_nextblkno = ovflblkno; pageopaque->hasho_nextblkno = ovflblkno;
_hash_wrtnorelbuf(rel, buf); _hash_wrtnorelbuf(rel, buf);
return (ovflbuf); return ovflbuf;
} }
/* /*
@ -227,7 +227,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
/* Calculate address of the new overflow page */ /* Calculate address of the new overflow page */
oaddr = OADDR_OF(splitnum, offset); oaddr = OADDR_OF(splitnum, offset);
_hash_chgbufaccess(rel, metabufp, HASH_WRITE, HASH_READ); _hash_chgbufaccess(rel, metabufp, HASH_WRITE, HASH_READ);
return (oaddr); return oaddr;
found: found:
bit = bit + _hash_firstfreebit(freep[j]); bit = bit + _hash_firstfreebit(freep[j]);
@ -254,7 +254,7 @@ found:
/* initialize this page */ /* initialize this page */
oaddr = OADDR_OF(i, offset); oaddr = OADDR_OF(i, offset);
_hash_chgbufaccess(rel, metabufp, HASH_WRITE, HASH_READ); _hash_chgbufaccess(rel, metabufp, HASH_WRITE, HASH_READ);
return (oaddr); return oaddr;
} }
/* /*
@ -275,10 +275,10 @@ _hash_firstfreebit(uint32 map)
for (i = 0; i < BITS_PER_MAP; i++) for (i = 0; i < BITS_PER_MAP; i++)
{ {
if (!(mask & map)) if (!(mask & map))
return (i); return i;
mask = mask << 1; mask = mask << 1;
} }
return (i); return i;
} }
/* /*
@ -387,9 +387,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
* return that buffer with a write lock. * return that buffer with a write lock.
*/ */
if (BlockNumberIsValid(nextblkno)) if (BlockNumberIsValid(nextblkno))
return (_hash_getbuf(rel, nextblkno, HASH_WRITE)); return _hash_getbuf(rel, nextblkno, HASH_WRITE);
else else
return (InvalidBuffer); return InvalidBuffer;
} }
@ -455,7 +455,7 @@ _hash_initbitmap(Relation rel,
/* write out the new bitmap page (releasing its locks) */ /* write out the new bitmap page (releasing its locks) */
_hash_wrtbuf(rel, buf); _hash_wrtbuf(rel, buf);
return (0); return 0;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.16 1998/06/15 19:27:49 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.17 1998/09/01 03:20:58 momjian Exp $
* *
* NOTES * NOTES
* Postgres hash pages look like ordinary relation pages. The opaque * Postgres hash pages look like ordinary relation pages. The opaque
@ -204,7 +204,7 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
buf = ReadBuffer(rel, blkno); buf = ReadBuffer(rel, blkno);
/* ref count and lock type are correct */ /* ref count and lock type are correct */
return (buf); return buf;
} }
/* /*
@ -288,7 +288,7 @@ _hash_chgbufaccess(Relation rel,
break; break;
} }
*bufp = _hash_getbuf(rel, blkno, to_access); *bufp = _hash_getbuf(rel, blkno, to_access);
return (BufferGetPage(*bufp)); return BufferGetPage(*bufp);
} }
/* /*
@ -604,7 +604,7 @@ _hash_splitpage(Relation rel,
/* hash on the tuple */ /* hash on the tuple */
hitem = (HashItem) PageGetItem(opage, PageGetItemId(opage, ooffnum)); hitem = (HashItem) PageGetItem(opage, PageGetItemId(opage, ooffnum));
itup = &(hitem->hash_itup); itup = &(hitem->hash_itup);
itupdesc = RelationGetTupleDescriptor(rel); itupdesc = RelationGetDescr(rel);
datum = index_getattr(itup, 1, itupdesc, &null); datum = index_getattr(itup, 1, itupdesc, &null);
bucket = _hash_call(rel, metap, datum); bucket = _hash_call(rel, metap, datum);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.15 1998/08/19 02:01:04 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.16 1998/09/01 03:20:59 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
@ -153,13 +153,13 @@ _hash_scantouched(IndexScanDesc scan,
if (ItemPointerIsValid(current) if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno && ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno) && ItemPointerGetOffsetNumber(current) >= offno)
return (true); return true;
current = &(scan->currentMarkData); current = &(scan->currentMarkData);
if (ItemPointerIsValid(current) if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno && ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno) && ItemPointerGetOffsetNumber(current) >= offno)
return (true); return true;
return (false); return false;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.15 1998/06/15 19:27:50 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.16 1998/09/01 03:21:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -107,7 +107,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
* next tuple, we come back with a lock on that buffer. * next tuple, we come back with a lock on that buffer.
*/ */
if (!_hash_step(scan, &buf, dir, metabuf)) if (!_hash_step(scan, &buf, dir, metabuf))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
/* if we're here, _hash_step found a valid tuple */ /* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData); current = &(scan->currentItemData);
@ -118,7 +118,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
itup = &hitem->hash_itup; itup = &hitem->hash_itup;
res = FormRetrieveIndexResult(current, &(itup->t_tid)); res = FormRetrieveIndexResult(current, &(itup->t_tid));
return (res); return res;
} }
static void static void
@ -236,7 +236,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
{ {
_hash_relbuf(rel, buf, HASH_READ); _hash_relbuf(rel, buf, HASH_READ);
_hash_relbuf(rel, metabuf, HASH_READ); _hash_relbuf(rel, metabuf, HASH_READ);
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
} }
} }
@ -247,7 +247,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
} }
if (!_hash_step(scan, &buf, dir, metabuf)) if (!_hash_step(scan, &buf, dir, metabuf))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
/* if we're here, _hash_step found a valid tuple */ /* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData); current = &(scan->currentItemData);
@ -258,7 +258,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
itup = &hitem->hash_itup; itup = &hitem->hash_itup;
res = FormRetrieveIndexResult(current, &(itup->t_tid)); res = FormRetrieveIndexResult(current, &(itup->t_tid));
return (res); return res;
} }
/* /*
@ -432,7 +432,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
_hash_relbuf(rel, metabuf, HASH_READ); _hash_relbuf(rel, metabuf, HASH_READ);
*bufP = so->hashso_curbuf = InvalidBuffer; *bufP = so->hashso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
return (false); return false;
} }
/* get ready to check this tuple */ /* get ready to check this tuple */
@ -445,5 +445,5 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
blkno = BufferGetBlockNumber(buf); blkno = BufferGetBlockNumber(buf);
*bufP = so->hashso_curbuf = buf; *bufP = so->hashso_curbuf = buf;
ItemPointerSet(current, blkno, offnum); ItemPointerSet(current, blkno, offnum);
return (true); return true;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.11 1997/09/08 02:20:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.12 1998/09/01 03:21:02 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -63,7 +63,7 @@ _hash_getstrat(Relation rel,
Assert(StrategyNumberIsValid(strat)); Assert(StrategyNumberIsValid(strat));
return (strat); return strat;
} }
#endif #endif

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.13 1998/01/07 21:01:16 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.14 1998/09/01 03:21:03 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -37,7 +37,7 @@ _hash_mkscankey(Relation rel, IndexTuple itup, HashMetaPage metap)
bool null; bool null;
natts = rel->rd_rel->relnatts; natts = rel->rd_rel->relnatts;
itupdesc = RelationGetTupleDescriptor(rel); itupdesc = RelationGetDescr(rel);
skey = (ScanKey) palloc(natts * sizeof(ScanKeyData)); skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
@ -49,7 +49,7 @@ _hash_mkscankey(Relation rel, IndexTuple itup, HashMetaPage metap)
0x0, (AttrNumber) (i + 1), proc, arg); 0x0, (AttrNumber) (i + 1), proc, arg);
} }
return (skey); return skey;
} }
void void
@ -64,10 +64,10 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
{ {
if (scan->numberOfKeys > 0) if (scan->numberOfKeys > 0)
return (index_keytest(itup, return (index_keytest(itup,
RelationGetTupleDescriptor(scan->relation), RelationGetDescr(scan->relation),
scan->numberOfKeys, scan->keyData)); scan->numberOfKeys, scan->keyData));
else else
return (true); return true;
} }
HashItem HashItem
@ -89,7 +89,7 @@ _hash_formitem(IndexTuple itup)
hitem = (HashItem) palloc(nbytes_hitem); hitem = (HashItem) palloc(nbytes_hitem);
memmove((char *) &(hitem->hash_itup), (char *) itup, tuplen); memmove((char *) &(hitem->hash_itup), (char *) itup, tuplen);
return (hitem); return hitem;
} }
Bucket Bucket
@ -104,7 +104,7 @@ _hash_call(Relation rel, HashMetaPage metap, Datum key)
bucket = n & metap->hashm_highmask; bucket = n & metap->hashm_highmask;
if (bucket > metap->hashm_maxbucket) if (bucket > metap->hashm_maxbucket)
bucket = bucket & metap->hashm_lowmask; bucket = bucket & metap->hashm_lowmask;
return (bucket); return bucket;
} }
/* /*
@ -119,7 +119,7 @@ _hash_log2(uint32 num)
limit = 1; limit = 1;
for (i = 0; limit < num; limit = limit << 1, i++) for (i = 0; limit < num; limit = limit << 1, i++)
; ;
return (i); return i;
} }
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.33 1998/08/20 22:07:30 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.34 1998/09/01 03:21:05 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
@ -194,7 +194,7 @@ unpinscan(HeapScanDesc scan)
static int static int
nextpage(int page, int dir) nextpage(int page, int dir)
{ {
return ((dir < 0) ? page - 1 : page + 1); return (dir < 0) ? page - 1 : page + 1;
} }
/* ---------------- /* ----------------
@ -268,7 +268,7 @@ heapgettup(Relation relation,
* ---------------- * ----------------
*/ */
if (!(pages = relation->rd_nblocks)) if (!(pages = relation->rd_nblocks))
return (NULL); return NULL;
/* ---------------- /* ----------------
* calculate next starting lineoff, given scan direction * calculate next starting lineoff, given scan direction
@ -284,7 +284,7 @@ heapgettup(Relation relation,
if (ItemPointerIsValid(tid) == false) if (ItemPointerIsValid(tid) == false)
{ {
*buf= InvalidBuffer; *buf= InvalidBuffer;
return (NULL); return NULL;
} }
*buf = RelationGetBufferWithBuffer(relation, *buf = RelationGetBufferWithBuffer(relation,
ItemPointerGetBlockNumber(tid), ItemPointerGetBlockNumber(tid),
@ -300,7 +300,7 @@ heapgettup(Relation relation,
lpp = PageGetItemId(dp, lineoff); lpp = PageGetItemId(dp, lineoff);
rtup = (HeapTuple) PageGetItem((Page) dp, lpp); rtup = (HeapTuple) PageGetItem((Page) dp, lpp);
return (rtup); return rtup;
} }
else if (dir < 0) else if (dir < 0)
@ -322,7 +322,7 @@ heapgettup(Relation relation,
if (page < 0) if (page < 0)
{ {
*buf = InvalidBuffer; *buf = InvalidBuffer;
return (NULL); return NULL;
} }
*buf = RelationGetBufferWithBuffer(relation, page, *buf); *buf = RelationGetBufferWithBuffer(relation, page, *buf);
@ -366,7 +366,7 @@ heapgettup(Relation relation,
if (page >= pages) if (page >= pages)
{ {
*buf = InvalidBuffer; *buf = InvalidBuffer;
return (NULL); return NULL;
} }
/* page and lineoff now reference the physically next tid */ /* page and lineoff now reference the physically next tid */
@ -420,7 +420,7 @@ heapgettup(Relation relation,
*/ */
ItemPointerSetBlockNumber(iptr, page); ItemPointerSetBlockNumber(iptr, page);
} }
return (rtup); return rtup;
} }
/* ---------------- /* ----------------
@ -455,7 +455,7 @@ heapgettup(Relation relation,
if (BufferIsValid(*buf)) if (BufferIsValid(*buf))
ReleaseBuffer(*buf); ReleaseBuffer(*buf);
*buf = InvalidBuffer; *buf = InvalidBuffer;
return (NULL); return NULL;
} }
*buf = ReleaseAndReadBuffer(*buf, relation, page); *buf = ReleaseAndReadBuffer(*buf, relation, page);
@ -526,7 +526,7 @@ heap_open(Oid relationId)
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX) if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data); elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
return (r); return r;
} }
/* ---------------- /* ----------------
@ -553,7 +553,7 @@ heap_openr(char *relationName)
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX) if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data); elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
return (r); return r;
} }
/* ---------------- /* ----------------
@ -646,7 +646,7 @@ heap_beginscan(Relation relation,
scan->rs_snapshot = snapshot; scan->rs_snapshot = snapshot;
scan->rs_nkeys = (short) nkeys; scan->rs_nkeys = (short) nkeys;
return (scan); return scan;
} }
/* ---------------- /* ----------------
@ -806,7 +806,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
{ {
if (BufferIsValid(scan->rs_nbuf)) if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf); ReleaseBuffer(scan->rs_nbuf);
return (NULL); return NULL;
} }
/* /*
@ -871,7 +871,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
ReleaseBuffer(scan->rs_nbuf); ReleaseBuffer(scan->rs_nbuf);
scan->rs_ntup = NULL; scan->rs_ntup = NULL;
scan->rs_nbuf = InvalidBuffer; scan->rs_nbuf = InvalidBuffer;
return (NULL); return NULL;
} }
if (BufferIsValid(scan->rs_pbuf)) if (BufferIsValid(scan->rs_pbuf))
@ -892,7 +892,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
if (BufferIsValid(scan->rs_pbuf)) if (BufferIsValid(scan->rs_pbuf))
ReleaseBuffer(scan->rs_pbuf); ReleaseBuffer(scan->rs_pbuf);
HEAPDEBUG_3; /* heap_getnext returns NULL at end */ HEAPDEBUG_3; /* heap_getnext returns NULL at end */
return (NULL); return NULL;
} }
/* /*
@ -959,7 +959,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
scan->rs_ptup = NULL; scan->rs_ptup = NULL;
scan->rs_pbuf = InvalidBuffer; scan->rs_pbuf = InvalidBuffer;
HEAPDEBUG_6; /* heap_getnext returning EOS */ HEAPDEBUG_6; /* heap_getnext returning EOS */
return (NULL); return NULL;
} }
if (BufferIsValid(scan->rs_nbuf)) if (BufferIsValid(scan->rs_nbuf))
@ -1064,7 +1064,7 @@ heap_fetch(Relation relation,
if (tuple == NULL) if (tuple == NULL)
{ {
ReleaseBuffer(buffer); ReleaseBuffer(buffer);
return (NULL); return NULL;
} }
/* ---------------- /* ----------------
@ -1076,7 +1076,7 @@ heap_fetch(Relation relation,
*userbuf = buffer; /* user is required to ReleaseBuffer() this */ *userbuf = buffer; /* user is required to ReleaseBuffer() this */
return (tuple); return tuple;
} }
/* ---------------- /* ----------------
@ -1150,7 +1150,7 @@ heap_insert(Relation relation, HeapTuple tup)
SetRefreshWhenInvalidate((bool) !ImmediateInvalidation); SetRefreshWhenInvalidate((bool) !ImmediateInvalidation);
} }
return (tup->t_oid); return tup->t_oid;
} }
/* ---------------- /* ----------------
@ -1213,7 +1213,7 @@ heap_delete(Relation relation, ItemPointer tid)
if (IsSystemRelationName(RelationGetRelationName(relation)->data)) if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation); RelationUnsetLockForWrite(relation);
ReleaseBuffer(buf); ReleaseBuffer(buf);
return (1); return 1;
} }
/* ---------------- /* ----------------
* check that we're deleteing a valid item * check that we're deleteing a valid item
@ -1256,7 +1256,7 @@ heap_delete(Relation relation, ItemPointer tid)
if (IsSystemRelationName(RelationGetRelationName(relation)->data)) if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation); RelationUnsetLockForWrite(relation);
return (0); return 0;
} }
/* ---------------- /* ----------------
@ -1339,7 +1339,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple replace_tuple)
if (IsSystemRelationName(RelationGetRelationName(relation)->data)) if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation); RelationUnsetLockForWrite(relation);
ReleaseBuffer(buffer); ReleaseBuffer(buffer);
return (1); return 1;
} }
/* ---------------- /* ----------------
@ -1411,7 +1411,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple replace_tuple)
if (IsSystemRelationName(RelationGetRelationName(relation)->data)) if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation); RelationUnsetLockForWrite(relation);
return (0); return 0;
} }
/* ---------------- /* ----------------

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.13 1998/08/19 02:01:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.14 1998/09/01 03:21:07 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
@ -123,7 +123,7 @@ RelationGetIndexScan(Relation relation,
index_rescan(scan, scanFromEnd, key); index_rescan(scan, scanFromEnd, key);
return (scan); return scan;
} }
#ifdef NOT_USED #ifdef NOT_USED

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.23 1998/08/19 02:01:10 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.24 1998/09/01 03:21:09 momjian Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* index_open - open an index relation by relationId * index_open - open an index relation by relationId
@ -207,7 +207,7 @@ index_insert(Relation relation,
* ---------------- * ----------------
*/ */
return (specificResult); return specificResult;
} }
/* ---------------- /* ----------------
@ -366,14 +366,14 @@ index_getprocid(Relation irel,
Assert(loc != NULL); Assert(loc != NULL);
return (loc[(natts * (procnum - 1)) + (attnum - 1)]); return loc[(natts * (procnum - 1)) + (attnum - 1)];
} }
Datum Datum
GetIndexValue(HeapTuple tuple, GetIndexValue(HeapTuple tuple,
TupleDesc hTupDesc, TupleDesc hTupDesc,
int attOff, int attOff,
AttrNumber attrNums[], AttrNumber *attrNums,
FuncIndexInfo *fInfo, FuncIndexInfo *fInfo,
bool *attNull) bool *attNull)
{ {

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.26 1998/08/19 02:01:11 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.27 1998/09/01 03:21:10 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -74,7 +74,7 @@ StrategyMapGetScanKeyEntry(StrategyMap map,
{ {
Assert(StrategyMapIsValid(map)); Assert(StrategyMapIsValid(map));
Assert(StrategyNumberIsValid(strategyNumber)); Assert(StrategyNumberIsValid(strategyNumber));
return (&map->entry[strategyNumber - 1]); return &map->entry[strategyNumber - 1];
} }
/* /*
@ -515,7 +515,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
} }
entry->sk_flags = 0; entry->sk_flags = 0;
entry->sk_procedure = ((OperatorTupleForm) GETSTRUCT(tuple))->oprcode; entry->sk_procedure = ((Form_pg_operator) GETSTRUCT(tuple))->oprcode;
fmgr_info(entry->sk_procedure, &entry->sk_func); fmgr_info(entry->sk_procedure, &entry->sk_func);
entry->sk_nargs = entry->sk_func.fn_nargs; entry->sk_nargs = entry->sk_func.fn_nargs;
@ -578,13 +578,13 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
/* /*
* XXX note that the following assumes the INDEX tuple is well formed * XXX note that the following assumes the INDEX tuple is well formed
* and that the key[] and class[] are 0 terminated. * and that the *key and *class are 0 terminated.
*/ */
for (attributeIndex = 0; attributeIndex < maxAttributeNumber; attributeIndex++) for (attributeIndex = 0; attributeIndex < maxAttributeNumber; attributeIndex++)
{ {
IndexTupleForm iform; Form_pg_index iform;
iform = (IndexTupleForm) GETSTRUCT(tuple); iform = (Form_pg_index) GETSTRUCT(tuple);
if (!OidIsValid(iform->indkey[attributeIndex])) if (!OidIsValid(iform->indkey[attributeIndex]))
{ {

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.17 1998/08/19 02:01:13 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.18 1998/09/01 03:21:12 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
@ -85,7 +85,7 @@ btoidcmp(Oid a, Oid b)
} }
int32 int32
btoid8cmp(Oid a[], Oid b[]) btoid8cmp(Oid *a, Oid *b)
{ {
int i; int i;
for (i=0; i < 8; i++) for (i=0; i < 8; i++)

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.28 1998/08/19 02:01:15 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.29 1998/09/01 03:21:13 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -104,7 +104,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
Buffer nbuf; Buffer nbuf;
BlockNumber blkno; BlockNumber blkno;
itupdesc = RelationGetTupleDescriptor(rel); itupdesc = RelationGetDescr(rel);
nbuf = InvalidBuffer; nbuf = InvalidBuffer;
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@ -182,7 +182,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
_bt_freestack(stack); _bt_freestack(stack);
_bt_freeskey(itup_scankey); _bt_freeskey(itup_scankey);
return (res); return res;
} }
/* /*
@ -301,7 +301,7 @@ _bt_insertonpg(Relation rel,
keysz, scankey, stack->bts_btitem, keysz, scankey, stack->bts_btitem,
NULL); NULL);
ItemPointerSet(&(res->pointerData), itup_blkno, itup_off); ItemPointerSet(&(res->pointerData), itup_blkno, itup_off);
return (res); return res;
} }
} }
else else
@ -780,7 +780,7 @@ _bt_insertonpg(Relation rel,
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData)); res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), itup_blkno, itup_off); ItemPointerSet(&(res->pointerData), itup_blkno, itup_off);
return (res); return res;
} }
/* /*
@ -961,7 +961,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
} }
/* split's done */ /* split's done */
return (rbuf); return rbuf;
} }
/* /*
@ -1045,7 +1045,7 @@ _bt_findsplitloc(Relation rel,
if (saferight == maxoff && (maxoff - start) > 1) if (saferight == maxoff && (maxoff - start) > 1)
saferight = start + (maxoff - start) / 2; saferight = start + (maxoff - start) / 2;
return (saferight); return saferight;
} }
/* /*
@ -1193,7 +1193,7 @@ _bt_pgaddtup(Relation rel,
/* write the buffer, but hold our lock */ /* write the buffer, but hold our lock */
_bt_wrtnorelbuf(rel, buf); _bt_wrtnorelbuf(rel, buf);
return (itup_off); return itup_off;
} }
/* /*
@ -1227,7 +1227,7 @@ _bt_goesonpg(Relation rel,
/* no right neighbor? */ /* no right neighbor? */
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (P_RIGHTMOST(opaque)) if (P_RIGHTMOST(opaque))
return (true); return true;
/* /*
* this is a non-rightmost page, so it must have a high key item. * this is a non-rightmost page, so it must have a high key item.
@ -1237,7 +1237,7 @@ _bt_goesonpg(Relation rel,
*/ */
hikey = PageGetItemId(page, P_HIKEY); hikey = PageGetItemId(page, P_HIKEY);
if (_bt_skeycmp(rel, keysz, scankey, page, hikey, BTLessStrategyNumber)) if (_bt_skeycmp(rel, keysz, scankey, page, hikey, BTLessStrategyNumber))
return (true); return true;
/* /*
* If the scan key is > the high key, then it for sure doesn't belong * If the scan key is > the high key, then it for sure doesn't belong
@ -1245,7 +1245,7 @@ _bt_goesonpg(Relation rel,
*/ */
if (_bt_skeycmp(rel, keysz, scankey, page, hikey, BTGreaterStrategyNumber)) if (_bt_skeycmp(rel, keysz, scankey, page, hikey, BTGreaterStrategyNumber))
return (false); return false;
/* /*
* If we have no adjacency information, and the item is equal to the * If we have no adjacency information, and the item is equal to the
@ -1258,14 +1258,14 @@ _bt_goesonpg(Relation rel,
if (afteritem == (BTItem) NULL) if (afteritem == (BTItem) NULL)
{ {
if (opaque->btpo_flags & BTP_LEAF) if (opaque->btpo_flags & BTP_LEAF)
return (false); return false;
if (opaque->btpo_flags & BTP_CHAIN) if (opaque->btpo_flags & BTP_CHAIN)
return (true); return true;
if (_bt_skeycmp(rel, keysz, scankey, page, if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, P_FIRSTKEY), PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber)) BTEqualStrategyNumber))
return (true); return true;
return (false); return false;
} }
/* damn, have to work for it. i hate that. */ /* damn, have to work for it. i hate that. */
@ -1293,7 +1293,7 @@ _bt_goesonpg(Relation rel,
} }
} }
return (found); return found;
} }
/* /*
@ -1330,7 +1330,7 @@ _bt_itemcmp(Relation rel,
strat = BTGreaterStrategyNumber; strat = BTGreaterStrategyNumber;
} }
tupDes = RelationGetTupleDescriptor(rel); tupDes = RelationGetDescr(rel);
indexTuple1 = &(item1->bti_itup); indexTuple1 = &(item1->bti_itup);
indexTuple2 = &(item2->bti_itup); indexTuple2 = &(item2->bti_itup);
@ -1357,13 +1357,13 @@ _bt_itemcmp(Relation rel,
if (compare) /* true for one of ">, <, =" */ if (compare) /* true for one of ">, <, =" */
{ {
if (strat != BTEqualStrategyNumber) if (strat != BTEqualStrategyNumber)
return (true); return true;
} }
else else
/* false for one of ">, <, =" */ /* false for one of ">, <, =" */
{ {
if (strat == BTEqualStrategyNumber) if (strat == BTEqualStrategyNumber)
return (false); return false;
/* /*
* if original strat was "<=, >=" OR "<, >" but some * if original strat was "<=, >=" OR "<, >" but some
@ -1379,10 +1379,10 @@ _bt_itemcmp(Relation rel,
if (compare) /* item1' and item2' attributes are equal */ if (compare) /* item1' and item2' attributes are equal */
continue; /* - try to compare next attributes */ continue; /* - try to compare next attributes */
} }
return (false); return false;
} }
} }
return (true); return true;
} }
/* /*
@ -1475,15 +1475,15 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
/* NULLs are not equal */ /* NULLs are not equal */
if (entry->sk_flags & SK_ISNULL || null) if (entry->sk_flags & SK_ISNULL || null)
return (false); return false;
result = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum); result = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
if (result != 0) if (result != 0)
return (false); return false;
} }
/* by here, the keys are equal */ /* by here, the keys are equal */
return (true); return true;
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -1621,7 +1621,7 @@ _bt_shift(Relation rel, Buffer buf, BTStack stack, int keysz,
ItemPointerSet(&(res->pointerData), nbknum, P_HIKEY); ItemPointerSet(&(res->pointerData), nbknum, P_HIKEY);
return (res); return res;
} }
#endif #endif

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.15 1998/01/07 21:01:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.16 1998/09/01 03:21:14 momjian Exp $
* *
* NOTES * NOTES
* Postgres btree pages look like ordinary relation pages. The opaque * Postgres btree pages look like ordinary relation pages. The opaque
@ -274,7 +274,7 @@ _bt_getroot(Relation rel, int access)
*/ */
_bt_relbuf(rel, metabuf, BT_WRITE); _bt_relbuf(rel, metabuf, BT_WRITE);
return (_bt_getroot(rel, access)); return _bt_getroot(rel, access);
} }
} }
else else
@ -298,7 +298,7 @@ _bt_getroot(Relation rel, int access)
/* it happened, try again */ /* it happened, try again */
_bt_relbuf(rel, rootbuf, access); _bt_relbuf(rel, rootbuf, access);
return (_bt_getroot(rel, access)); return _bt_getroot(rel, access);
} }
/* /*
@ -307,7 +307,7 @@ _bt_getroot(Relation rel, int access)
* Return the root block. * Return the root block.
*/ */
return (rootbuf); return rootbuf;
} }
/* /*
@ -350,7 +350,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
} }
/* ref count and lock type are correct */ /* ref count and lock type are correct */
return (buf); return buf;
} }
/* /*
@ -505,7 +505,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
item_save = (BTItem) palloc(item_nbytes); item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes); memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save; stack->bts_btitem = item_save;
return (buf); return buf;
} }
/* if the item has just moved right on this page, we're done */ /* if the item has just moved right on this page, we're done */
@ -525,7 +525,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
item_save = (BTItem) palloc(item_nbytes); item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes); memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save; stack->bts_btitem = item_save;
return (buf); return buf;
} }
} }
} }
@ -562,7 +562,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
item_save = (BTItem) palloc(item_nbytes); item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes); memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save; stack->bts_btitem = item_save;
return (buf); return buf;
} }
} }
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.30 1998/08/25 21:33:56 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.31 1998/09/01 03:21:16 momjian Exp $
* *
* NOTES * NOTES
* This file contains only the public interface routines. * This file contains only the public interface routines.
@ -119,8 +119,8 @@ btbuild(Relation heap,
_bt_metapinit(index); _bt_metapinit(index);
/* get tuple descriptors for heap and index relations */ /* get tuple descriptors for heap and index relations */
htupdesc = RelationGetTupleDescriptor(heap); htupdesc = RelationGetDescr(heap);
itupdesc = RelationGetTupleDescriptor(index); itupdesc = RelationGetDescr(index);
/* get space for data items that'll appear in the index tuple */ /* get space for data items that'll appear in the index tuple */
attdata = (Datum *) palloc(natts * sizeof(Datum)); attdata = (Datum *) palloc(natts * sizeof(Datum));
@ -355,13 +355,14 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
InsertIndexResult res; InsertIndexResult res;
/* generate an index tuple */ /* generate an index tuple */
itup = index_formtuple(RelationGetTupleDescriptor(rel), datum, nulls); itup = index_formtuple(RelationGetDescr(rel), datum, nulls);
itup->t_tid = *ht_ctid; itup->t_tid = *ht_ctid;
/* /*
* See comments in btbuild. * See comments in btbuild.
* *
* if (itup->t_info & INDEX_NULL_MASK) return ((InsertIndexResult) NULL); * if (itup->t_info & INDEX_NULL_MASK)
return (InsertIndexResult) NULL;
*/ */
btitem = _bt_formitem(itup); btitem = _bt_formitem(itup);
@ -377,7 +378,7 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
_bt_adjscans(rel, &(res->pointerData), BT_INSERT); _bt_adjscans(rel, &(res->pointerData), BT_INSERT);
#endif #endif
return (res); return res;
} }
/* /*
@ -417,7 +418,7 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
if (res) if (res)
((BTScanOpaque)scan->opaque)->curHeapIptr = res->heap_iptr; ((BTScanOpaque)scan->opaque)->curHeapIptr = res->heap_iptr;
return ((char *) res); return (char *) res;
} }
/* /*
@ -434,7 +435,7 @@ btbeginscan(Relation rel, bool fromEnd, uint16 keysz, ScanKey scankey)
/* register scan in case we change pages it's using */ /* register scan in case we change pages it's using */
_bt_regscan(scan); _bt_regscan(scan);
return ((char *) scan); return (char *) scan;
} }
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.16 1998/08/19 02:01:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.17 1998/09/01 03:21:17 momjian Exp $
* *
* *
* NOTES * NOTES
@ -231,13 +231,13 @@ _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
if (ItemPointerIsValid(current) if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno && ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno) && ItemPointerGetOffsetNumber(current) >= offno)
return (true); return true;
current = &(scan->currentMarkData); current = &(scan->currentMarkData);
if (ItemPointerIsValid(current) if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno && ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno) && ItemPointerGetOffsetNumber(current) >= offno)
return (true); return true;
return (false); return false;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.36 1998/06/15 19:27:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.37 1998/09/01 03:21:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -52,7 +52,7 @@ BTStack
_bt_search(Relation rel, int keysz, ScanKey scankey, Buffer *bufP) _bt_search(Relation rel, int keysz, ScanKey scankey, Buffer *bufP)
{ {
*bufP = _bt_getroot(rel, BT_READ); *bufP = _bt_getroot(rel, BT_READ);
return (_bt_searchr(rel, keysz, scankey, bufP, (BTStack) NULL)); return _bt_searchr(rel, keysz, scankey, bufP, (BTStack) NULL);
} }
/* /*
@ -81,7 +81,7 @@ _bt_searchr(Relation rel,
page = BufferGetPage(*bufP); page = BufferGetPage(*bufP);
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (opaque->btpo_flags & BTP_LEAF) if (opaque->btpo_flags & BTP_LEAF)
return (stack_in); return stack_in;
/* /*
* Find the appropriate item on the internal page, and get the child * Find the appropriate item on the internal page, and get the child
@ -127,7 +127,7 @@ _bt_searchr(Relation rel,
*bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ); *bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ);
/* okay, all set to move down a level */ /* okay, all set to move down a level */
return (_bt_searchr(rel, keysz, scankey, bufP, stack)); return _bt_searchr(rel, keysz, scankey, bufP, stack);
} }
/* /*
@ -166,7 +166,7 @@ _bt_moveright(Relation rel,
/* if we're on a rightmost page, we don't need to move right */ /* if we're on a rightmost page, we don't need to move right */
if (P_RIGHTMOST(opaque)) if (P_RIGHTMOST(opaque))
return (buf); return buf;
/* by convention, item 0 on non-rightmost pages is the high key */ /* by convention, item 0 on non-rightmost pages is the high key */
hikey = PageGetItemId(page, P_HIKEY); hikey = PageGetItemId(page, P_HIKEY);
@ -252,7 +252,7 @@ _bt_moveright(Relation rel,
&& _bt_skeycmp(rel, keysz, scankey, page, hikey, && _bt_skeycmp(rel, keysz, scankey, page, hikey,
BTGreaterEqualStrategyNumber)); BTGreaterEqualStrategyNumber));
} }
return (buf); return buf;
} }
/* /*
@ -300,7 +300,7 @@ _bt_skeycmp(Relation rel,
item = (BTItem) PageGetItem(page, itemid); item = (BTItem) PageGetItem(page, itemid);
indexTuple = &(item->bti_itup); indexTuple = &(item->bti_itup);
tupDes = RelationGetTupleDescriptor(rel); tupDes = RelationGetDescr(rel);
/* see if the comparison is true for all of the key attributes */ /* see if the comparison is true for all of the key attributes */
for (i = 1; i <= keysz; i++) for (i = 1; i <= keysz; i++)
@ -338,13 +338,13 @@ _bt_skeycmp(Relation rel,
if (compare) /* true for one of ">, <, =" */ if (compare) /* true for one of ">, <, =" */
{ {
if (strat != BTEqualStrategyNumber) if (strat != BTEqualStrategyNumber)
return (true); return true;
} }
else else
/* false for one of ">, <, =" */ /* false for one of ">, <, =" */
{ {
if (strat == BTEqualStrategyNumber) if (strat == BTEqualStrategyNumber)
return (false); return false;
/* /*
* if original strat was "<=, >=" OR "<, >" but some * if original strat was "<=, >=" OR "<, >" but some
@ -360,11 +360,11 @@ _bt_skeycmp(Relation rel,
if (compare) /* key' and item' attributes are equal */ if (compare) /* key' and item' attributes are equal */
continue; /* - try to compare next attributes */ continue; /* - try to compare next attributes */
} }
return (false); return false;
} }
} }
return (true); return true;
} }
/* /*
@ -397,7 +397,7 @@ _bt_binsrch(Relation rel,
int natts = rel->rd_rel->relnatts; int natts = rel->rd_rel->relnatts;
int result; int result;
itupdesc = RelationGetTupleDescriptor(rel); itupdesc = RelationGetDescr(rel);
page = BufferGetPage(buf); page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@ -416,17 +416,17 @@ _bt_binsrch(Relation rel,
*/ */
if (PageIsEmpty(page)) if (PageIsEmpty(page))
return (low); return low;
if ((!P_RIGHTMOST(opaque) && high <= low)) if ((!P_RIGHTMOST(opaque) && high <= low))
{ {
if (high < low || if (high < low ||
(srchtype == BT_DESCENT && !(opaque->btpo_flags & BTP_LEAF))) (srchtype == BT_DESCENT && !(opaque->btpo_flags & BTP_LEAF)))
return (low); return low;
/* It's insertion and high == low == 2 */ /* It's insertion and high == low == 2 */
result = _bt_compare(rel, itupdesc, page, keysz, scankey, low); result = _bt_compare(rel, itupdesc, page, keysz, scankey, low);
if (result > 0) if (result > 0)
return (OffsetNumberNext(low)); return OffsetNumberNext(low);
return (low); return low;
} }
while ((high - low) > 1) while ((high - low) > 1)
@ -454,11 +454,11 @@ _bt_binsrch(Relation rel,
* code (natts == keysz). - vadim 04/15/97 * code (natts == keysz). - vadim 04/15/97
*/ */
if (natts == keysz || opaque->btpo_flags & BTP_LEAF) if (natts == keysz || opaque->btpo_flags & BTP_LEAF)
return (mid); return mid;
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (mid == low) if (mid == low)
return (mid); return mid;
return (OffsetNumberPrev(mid)); return OffsetNumberPrev(mid);
} }
} }
@ -490,33 +490,33 @@ _bt_binsrch(Relation rel,
* comments above for multi-column indices. * comments above for multi-column indices.
*/ */
if (natts == keysz) if (natts == keysz)
return (mid); return mid;
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (mid == low) if (mid == low)
return (mid); return mid;
return (OffsetNumberPrev(mid)); return OffsetNumberPrev(mid);
} }
else if (result > 0) else if (result > 0)
return (high); return high;
else else
return (low); return low;
} }
else else
/* we want the first key >= the scan key */ /* we want the first key >= the scan key */
{ {
result = _bt_compare(rel, itupdesc, page, keysz, scankey, low); result = _bt_compare(rel, itupdesc, page, keysz, scankey, low);
if (result <= 0) if (result <= 0)
return (low); return low;
else else
{ {
if (low == high) if (low == high)
return (OffsetNumberNext(low)); return OffsetNumberNext(low);
result = _bt_compare(rel, itupdesc, page, keysz, scankey, high); result = _bt_compare(rel, itupdesc, page, keysz, scankey, high);
if (result <= 0) if (result <= 0)
return (high); return high;
else else
return (OffsetNumberNext(high)); return OffsetNumberNext(high);
} }
} }
} }
@ -543,7 +543,7 @@ _bt_firsteq(Relation rel,
keysz, scankey, OffsetNumberPrev(offnum)) == 0) keysz, scankey, OffsetNumberPrev(offnum)) == 0)
offnum = OffsetNumberPrev(offnum); offnum = OffsetNumberPrev(offnum);
return (offnum); return offnum;
} }
/* /*
@ -630,8 +630,8 @@ _bt_compare(Relation rel,
if (_bt_skeycmp(rel, keysz, scankey, page, itemid, if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber)) BTEqualStrategyNumber))
return (0); return 0;
return (1); return 1;
#endif #endif
} }
@ -675,11 +675,11 @@ _bt_compare(Relation rel,
/* if the keys are unequal, return the difference */ /* if the keys are unequal, return the difference */
if (result != 0) if (result != 0)
return (result); return result;
} }
/* by here, the keys are equal */ /* by here, the keys are equal */
return (0); return 0;
} }
/* /*
@ -726,7 +726,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
{ {
/* step one tuple in the appropriate direction */ /* step one tuple in the appropriate direction */
if (!_bt_step(scan, &buf, dir)) if (!_bt_step(scan, &buf, dir))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
/* by here, current is the tuple we want to return */ /* by here, current is the tuple we want to return */
offnum = ItemPointerGetOffsetNumber(current); offnum = ItemPointerGetOffsetNumber(current);
@ -741,7 +741,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
/* remember which buffer we have pinned and locked */ /* remember which buffer we have pinned and locked */
so->btso_curbuf = buf; so->btso_curbuf = buf;
return (res); return res;
} }
} while (keysok >= so->numberOfFirstKeys); } while (keysok >= so->numberOfFirstKeys);
@ -750,7 +750,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ); _bt_relbuf(rel, buf, BT_READ);
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
/* /*
@ -812,13 +812,13 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
scan->scanFromEnd = true; scan->scanFromEnd = true;
if (so->qual_ok == 0) if (so->qual_ok == 0)
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
/* if we just need to walk down one edge of the tree, do that */ /* if we just need to walk down one edge of the tree, do that */
if (scan->scanFromEnd) if (scan->scanFromEnd)
return (_bt_endpoint(scan, dir)); return _bt_endpoint(scan, dir);
itupdesc = RelationGetTupleDescriptor(rel); itupdesc = RelationGetDescr(rel);
current = &(scan->currentItemData); current = &(scan->currentItemData);
/* /*
@ -831,7 +831,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
if (so->keyData[0].sk_flags & SK_ISNULL) if (so->keyData[0].sk_flags & SK_ISNULL)
{ {
elog(ERROR, "_bt_first: btree doesn't support is(not)null, yet"); elog(ERROR, "_bt_first: btree doesn't support is(not)null, yet");
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
proc = index_getprocid(rel, 1, BTORDER_PROC); proc = index_getprocid(rel, 1, BTORDER_PROC);
ScanKeyEntryInitialize(&skdata, so->keyData[0].sk_flags, 1, proc, ScanKeyEntryInitialize(&skdata, so->keyData[0].sk_flags, 1, proc,
@ -855,7 +855,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ); _bt_relbuf(rel, buf, BT_READ);
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
pop = (BTPageOpaque) PageGetSpecialPointer(page); pop = (BTPageOpaque) PageGetSpecialPointer(page);
@ -881,7 +881,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ); _bt_relbuf(rel, buf, BT_READ);
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
pop = (BTPageOpaque) PageGetSpecialPointer(page); pop = (BTPageOpaque) PageGetSpecialPointer(page);
@ -955,7 +955,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(scan->relation, buf, BT_READ); _bt_relbuf(scan->relation, buf, BT_READ);
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(&(scan->currentItemData)); ItemPointerSetInvalid(&(scan->currentItemData));
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
break; break;
@ -970,7 +970,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(scan->relation, buf, BT_READ); _bt_relbuf(scan->relation, buf, BT_READ);
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(&(scan->currentItemData)); ItemPointerSetInvalid(&(scan->currentItemData));
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
} }
else if (result > 0) else if (result > 0)
@ -1035,7 +1035,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
else if (keysok >= so->numberOfFirstKeys) else if (keysok >= so->numberOfFirstKeys)
{ {
so->btso_curbuf = buf; so->btso_curbuf = buf;
return (_bt_next(scan, dir)); return _bt_next(scan, dir);
} }
else else
{ {
@ -1045,7 +1045,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
res = (RetrieveIndexResult) NULL; res = (RetrieveIndexResult) NULL;
} }
return (res); return res;
} }
/* /*
@ -1093,7 +1093,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
_bt_relbuf(rel, *bufP, BT_READ); _bt_relbuf(rel, *bufP, BT_READ);
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
*bufP = so->btso_curbuf = InvalidBuffer; *bufP = so->btso_curbuf = InvalidBuffer;
return (false); return false;
} }
else else
{ {
@ -1118,7 +1118,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{ {
*bufP = so->btso_curbuf = InvalidBuffer; *bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
return (false); return false;
} }
} }
} }
@ -1144,7 +1144,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
_bt_relbuf(rel, *bufP, BT_READ); _bt_relbuf(rel, *bufP, BT_READ);
*bufP = so->btso_curbuf = InvalidBuffer; *bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
return (false); return false;
} }
else else
{ {
@ -1192,7 +1192,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{ {
*bufP = so->btso_curbuf = InvalidBuffer; *bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
return (false); return false;
} }
} }
} }
@ -1204,7 +1204,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
so->btso_curbuf = *bufP; so->btso_curbuf = *bufP;
ItemPointerSet(current, blkno, offnum); ItemPointerSet(current, blkno, offnum);
return (true); return true;
} }
/* /*
@ -1252,19 +1252,19 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (ScanDirectionIsForward(dir) && offnum < maxoff) if (ScanDirectionIsForward(dir) && offnum < maxoff)
{ /* XXX PageIsEmpty? */ { /* XXX PageIsEmpty? */
ItemPointerSet(current, blkno, OffsetNumberNext(offnum)); ItemPointerSet(current, blkno, OffsetNumberNext(offnum));
return (true); return true;
} }
else if (ScanDirectionIsBackward(dir) && offnum > start) else if (ScanDirectionIsBackward(dir) && offnum > start)
{ {
ItemPointerSet(current, blkno, OffsetNumberPrev(offnum)); ItemPointerSet(current, blkno, OffsetNumberPrev(offnum));
return (true); return true;
} }
/* if we've hit end of scan we don't have to do any work */ /* if we've hit end of scan we don't have to do any work */
if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque)) if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
return (false); return false;
else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque)) else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque))
return (false); return false;
/* /*
* Okay, it's off the page; let _bt_step() do the hard work, and we'll * Okay, it's off the page; let _bt_step() do the hard work, and we'll
@ -1283,7 +1283,7 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (_bt_step(scan, bufP, dir)) if (_bt_step(scan, bufP, dir))
{ {
pfree(svitem); pfree(svitem);
return (true); return true;
} }
/* try to find our place again */ /* try to find our place again */
@ -1299,7 +1299,7 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{ {
pfree(svitem); pfree(svitem);
ItemPointerSet(current, blkno, offnum); ItemPointerSet(current, blkno, offnum);
return (false); return false;
} }
} }
@ -1312,7 +1312,7 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
elog(ERROR, "btree synchronization error: concurrent update botched scan"); elog(ERROR, "btree synchronization error: concurrent update botched scan");
return (false); return false;
} }
/* /*
@ -1406,7 +1406,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
{ {
ItemPointerSet(current, blkno, maxoff); ItemPointerSet(current, blkno, maxoff);
if (!_bt_step(scan, &buf, BackwardScanDirection)) if (!_bt_step(scan, &buf, BackwardScanDirection))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current); start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf); page = BufferGetPage(buf);
@ -1424,13 +1424,13 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(rel, buf, BT_READ); _bt_relbuf(rel, buf, BT_READ);
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
if (start > maxoff) /* start == 2 && maxoff == 1 */ if (start > maxoff) /* start == 2 && maxoff == 1 */
{ {
ItemPointerSet(current, blkno, maxoff); ItemPointerSet(current, blkno, maxoff);
if (!_bt_step(scan, &buf, ForwardScanDirection)) if (!_bt_step(scan, &buf, ForwardScanDirection))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current); start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf); page = BufferGetPage(buf);
@ -1452,7 +1452,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
{ {
ItemPointerSet(current, blkno, FirstOffsetNumber); ItemPointerSet(current, blkno, FirstOffsetNumber);
if (!_bt_step(scan, &buf, ForwardScanDirection)) if (!_bt_step(scan, &buf, ForwardScanDirection))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current); start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf); page = BufferGetPage(buf);
@ -1466,12 +1466,12 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(rel, buf, BT_READ); _bt_relbuf(rel, buf, BT_READ);
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer; so->btso_curbuf = InvalidBuffer;
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
/* Go back ! */ /* Go back ! */
ItemPointerSet(current, blkno, FirstOffsetNumber); ItemPointerSet(current, blkno, FirstOffsetNumber);
if (!_bt_step(scan, &buf, BackwardScanDirection)) if (!_bt_step(scan, &buf, BackwardScanDirection))
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current); start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf); page = BufferGetPage(buf);
@ -1500,7 +1500,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
else if (keysok >= so->numberOfFirstKeys) else if (keysok >= so->numberOfFirstKeys)
{ {
so->btso_curbuf = buf; so->btso_curbuf = buf;
return (_bt_next(scan, dir)); return _bt_next(scan, dir);
} }
else else
{ {
@ -1510,5 +1510,5 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
res = (RetrieveIndexResult) NULL; res = (RetrieveIndexResult) NULL;
} }
return (res); return res;
} }

View File

@ -5,7 +5,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Id: nbtsort.c,v 1.31 1998/08/25 21:33:57 scrappy Exp $ * $Id: nbtsort.c,v 1.32 1998/09/01 03:21:19 momjian Exp $
* *
* NOTES * NOTES
* *
@ -180,11 +180,11 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
if (k1->btsk_item == (BTItem) NULL) if (k1->btsk_item == (BTItem) NULL)
{ {
if (k2->btsk_item == (BTItem) NULL) if (k2->btsk_item == (BTItem) NULL)
return (0); /* 1 = 2 */ return 0; /* 1 = 2 */
return (1); /* 1 > 2 */ return 1; /* 1 > 2 */
} }
else if (k2->btsk_item == (BTItem) NULL) else if (k2->btsk_item == (BTItem) NULL)
return (-1); /* 1 < 2 */ return -1; /* 1 < 2 */
for (i = 0; i < _bt_nattr; i++) for (i = 0; i < _bt_nattr; i++)
{ {
@ -195,17 +195,17 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
equal_isnull = true; equal_isnull = true;
continue; continue;
} }
return (1); /* NULL ">" NOT_NULL */ return 1; /* NULL ">" NOT_NULL */
} }
else if (k2_nulls[i] != ' ') /* k2 attr is NULL */ else if (k2_nulls[i] != ' ') /* k2 attr is NULL */
return (-1); /* NOT_NULL "<" NULL */ return -1; /* NOT_NULL "<" NULL */
if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber, if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k1_datum[i], k2_datum[i])) k1_datum[i], k2_datum[i]))
return (1); /* 1 > 2 */ return 1; /* 1 > 2 */
else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber, else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k2_datum[i], k1_datum[i])) k2_datum[i], k1_datum[i]))
return (-1); /* 1 < 2 */ return -1; /* 1 < 2 */
} }
if (_bt_inspool->isunique && !equal_isnull) if (_bt_inspool->isunique && !equal_isnull)
@ -213,7 +213,7 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
_bt_spooldestroy((void *) _bt_inspool); _bt_spooldestroy((void *) _bt_inspool);
elog(ERROR, "Cannot create unique index. Table contains non-unique values"); elog(ERROR, "Cannot create unique index. Table contains non-unique values");
} }
return (0); /* 1 = 2 */ return 0; /* 1 = 2 */
} }
static void static void
@ -307,17 +307,17 @@ _bt_pqnext(BTPriQueue *q, BTPriQueueElem *e)
{ {
if (q->btpq_nelem < 1) if (q->btpq_nelem < 1)
{ /* already empty */ { /* already empty */
return (-1); return -1;
} }
*e = q->btpq_queue[0]; /* struct = */ *e = q->btpq_queue[0]; /* struct = */
if (--q->btpq_nelem < 1) if (--q->btpq_nelem < 1)
{ /* now empty, don't sift */ { /* now empty, don't sift */
return (0); return 0;
} }
q->btpq_queue[0] = q->btpq_queue[q->btpq_nelem]; /* struct = */ q->btpq_queue[0] = q->btpq_queue[q->btpq_nelem]; /* struct = */
_bt_pqsift(q, 0); _bt_pqsift(q, 0);
return (0); return 0;
} }
static void static void
@ -426,7 +426,7 @@ _bt_tapecreate(char *fname)
/* initialize the buffer */ /* initialize the buffer */
_bt_tapereset(tape); _bt_tapereset(tape);
return (tape); return tape;
} }
/* /*
@ -468,7 +468,7 @@ _bt_taperead(BTTapeBlock *tape)
if (tape->bttb_eor) if (tape->bttb_eor)
{ {
return (0); /* we are already at End-Of-Run */ return 0; /* we are already at End-Of-Run */
} }
/* /*
@ -482,11 +482,11 @@ _bt_taperead(BTTapeBlock *tape)
if (nread != TAPEBLCKSZ) if (nread != TAPEBLCKSZ)
{ {
Assert(nread == 0); /* we are at EOF */ Assert(nread == 0); /* we are at EOF */
return (0); return 0;
} }
Assert(tape->bttb_magic == BTTAPEMAGIC); Assert(tape->bttb_magic == BTTAPEMAGIC);
NDirectFileRead += TAPEBLCKSZ / BLCKSZ; NDirectFileRead += TAPEBLCKSZ / BLCKSZ;
return (1); return 1;
} }
/* /*
@ -506,11 +506,11 @@ _bt_tapenext(BTTapeBlock *tape, char **pos)
BTItem bti; BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top) if (*pos >= tape->bttb_data + tape->bttb_top)
return ((BTItem) NULL); return (BTItem) NULL;
bti = (BTItem) *pos; bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti); itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz); *pos += DOUBLEALIGN(itemsz);
return (bti); return bti;
} }
/* /*
@ -574,7 +574,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
_bt_isortcmpinit(index, btspool); _bt_isortcmpinit(index, btspool);
return ((void *) btspool); return (void *) btspool;
} }
/* /*
@ -838,7 +838,7 @@ _bt_pagestate(Relation index, int flags, int level, bool doupper)
state->btps_level = level; state->btps_level = level;
state->btps_doupper = doupper; state->btps_doupper = doupper;
return ((void *) state); return (void *) state;
} }
/* /*
@ -859,7 +859,7 @@ _bt_minitem(Page opage, BlockNumber oblkno, int atend)
nbti = _bt_formitem(&(obti->bti_itup)); nbti = _bt_formitem(&(obti->bti_itup));
ItemPointerSet(&(nbti->bti_itup.t_tid), oblkno, P_HIKEY); ItemPointerSet(&(nbti->bti_itup.t_tid), oblkno, P_HIKEY);
return (nbti); return nbti;
} }
/* /*
@ -1074,7 +1074,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
state->btps_lastoff = last_off; state->btps_lastoff = last_off;
state->btps_firstoff = first_off; state->btps_firstoff = first_off;
return (last_bti); return last_bti;
} }
static void static void

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.6 1997/09/08 02:20:59 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.7 1998/09/01 03:21:21 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -115,7 +115,7 @@ _bt_getstrat(Relation rel,
Assert(StrategyNumberIsValid(strat)); Assert(StrategyNumberIsValid(strat));
return (strat); return strat;
} }
bool bool

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.21 1998/08/19 02:01:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.22 1998/09/01 03:21:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -44,7 +44,7 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
bits16 flag; bits16 flag;
natts = rel->rd_rel->relnatts; natts = rel->rd_rel->relnatts;
itupdesc = RelationGetTupleDescriptor(rel); itupdesc = RelationGetDescr(rel);
skey = (ScanKey) palloc(natts * sizeof(ScanKeyData)); skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
@ -64,7 +64,7 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
ScanKeyEntryInitialize(&skey[i], flag, (AttrNumber) (i + 1), proc, arg); ScanKeyEntryInitialize(&skey[i], flag, (AttrNumber) (i + 1), proc, arg);
} }
return (skey); return skey;
} }
void void
@ -306,7 +306,7 @@ _bt_formitem(IndexTuple itup)
#ifndef BTREE_VERSION_1 #ifndef BTREE_VERSION_1
btitem->bti_oid = newoid(); btitem->bti_oid = newoid();
#endif #endif
return (btitem); return btitem;
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -317,10 +317,10 @@ _bt_checkqual(IndexScanDesc scan, IndexTuple itup)
so = (BTScanOpaque) scan->opaque; so = (BTScanOpaque) scan->opaque;
if (so->numberOfKeys > 0) if (so->numberOfKeys > 0)
return (index_keytest(itup, RelationGetTupleDescriptor(scan->relation), return (index_keytest(itup, RelationGetDescr(scan->relation),
so->numberOfKeys, so->keyData)); so->numberOfKeys, so->keyData));
else else
return (true); return true;
} }
#endif #endif
@ -333,10 +333,10 @@ _bt_checkforkeys(IndexScanDesc scan, IndexTuple itup, Size keysz)
so = (BTScanOpaque) scan->opaque; so = (BTScanOpaque) scan->opaque;
if (keysz > 0 && so->numberOfKeys >= keysz) if (keysz > 0 && so->numberOfKeys >= keysz)
return (index_keytest(itup, RelationGetTupleDescriptor(scan->relation), return (index_keytest(itup, RelationGetDescr(scan->relation),
keysz, so->keyData)); keysz, so->keyData));
else else
return (true); return true;
} }
#endif #endif
@ -354,10 +354,10 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
*keysok = 0; *keysok = 0;
if (keysz == 0) if (keysz == 0)
return (true); return true;
key = so->keyData; key = so->keyData;
tupdesc = RelationGetTupleDescriptor(scan->relation); tupdesc = RelationGetDescr(scan->relation);
IncrIndexProcessed(); IncrIndexProcessed();
@ -370,7 +370,7 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
/* btree doesn't support 'A is null' clauses, yet */ /* btree doesn't support 'A is null' clauses, yet */
if (isNull || key[0].sk_flags & SK_ISNULL) if (isNull || key[0].sk_flags & SK_ISNULL)
return (false); return false;
if (key[0].sk_flags & SK_COMMUTE) if (key[0].sk_flags & SK_COMMUTE)
{ {
@ -386,12 +386,12 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
} }
if (!test == !(key[0].sk_flags & SK_NEGATE)) if (!test == !(key[0].sk_flags & SK_NEGATE))
return (false); return false;
keysz -= 1; keysz -= 1;
key++; key++;
(*keysok)++; (*keysok)++;
} }
return (true); return true;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.10 1998/06/15 19:28:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.11 1998/09/01 03:21:24 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -43,14 +43,14 @@ rtgettuple(IndexScanDesc s, ScanDirection dir)
/* if we have it cached in the scan desc, just return the value */ /* if we have it cached in the scan desc, just return the value */
if ((res = rtscancache(s, dir)) != (RetrieveIndexResult) NULL) if ((res = rtscancache(s, dir)) != (RetrieveIndexResult) NULL)
return (res); return res;
/* not cached, so we'll have to do some work */ /* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData))) if (ItemPointerIsValid(&(s->currentItemData)))
res = rtnext(s, dir); res = rtnext(s, dir);
else else
res = rtfirst(s, dir); res = rtfirst(s, dir);
return (res); return res;
} }
static RetrieveIndexResult static RetrieveIndexResult
@ -85,7 +85,7 @@ rtfirst(IndexScanDesc s, ScanDirection dir)
ReleaseBuffer(b); ReleaseBuffer(b);
if (so->s_stack == (RTSTACK *) NULL) if (so->s_stack == (RTSTACK *) NULL)
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
stk = so->s_stack; stk = so->s_stack;
b = ReadBuffer(s->relation, stk->rts_blk); b = ReadBuffer(s->relation, stk->rts_blk);
@ -111,7 +111,7 @@ rtfirst(IndexScanDesc s, ScanDirection dir)
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid)); res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b); ReleaseBuffer(b);
return (res); return res;
} }
else else
{ {
@ -169,7 +169,7 @@ rtnext(IndexScanDesc s, ScanDirection dir)
ReleaseBuffer(b); ReleaseBuffer(b);
if (so->s_stack == (RTSTACK *) NULL) if (so->s_stack == (RTSTACK *) NULL)
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
stk = so->s_stack; stk = so->s_stack;
b = ReadBuffer(s->relation, stk->rts_blk); b = ReadBuffer(s->relation, stk->rts_blk);
@ -195,7 +195,7 @@ rtnext(IndexScanDesc s, ScanDirection dir)
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid)); res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b); ReleaseBuffer(b);
return (res); return res;
} }
else else
{ {
@ -250,14 +250,14 @@ findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
if (po->flags & F_LEAF) if (po->flags & F_LEAF)
{ {
if (index_keytest(it, if (index_keytest(it,
RelationGetTupleDescriptor(s->relation), RelationGetDescr(s->relation),
s->numberOfKeys, s->keyData)) s->numberOfKeys, s->keyData))
break; break;
} }
else else
{ {
if (index_keytest(it, if (index_keytest(it,
RelationGetTupleDescriptor(s->relation), RelationGetDescr(s->relation),
so->s_internalNKey, so->s_internalKey)) so->s_internalNKey, so->s_internalKey))
break; break;
} }
@ -268,7 +268,7 @@ findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
n = OffsetNumberNext(n); n = OffsetNumberNext(n);
} }
return (n); return n;
} }
static RetrieveIndexResult static RetrieveIndexResult
@ -281,7 +281,7 @@ rtscancache(IndexScanDesc s, ScanDirection dir)
&& ItemPointerIsValid(&(s->currentItemData)))) && ItemPointerIsValid(&(s->currentItemData))))
{ {
return ((RetrieveIndexResult) NULL); return (RetrieveIndexResult) NULL;
} }
ip = rtheapptr(s->relation, &(s->currentItemData)); ip = rtheapptr(s->relation, &(s->currentItemData));
@ -293,7 +293,7 @@ rtscancache(IndexScanDesc s, ScanDirection dir)
pfree(ip); pfree(ip);
return (res); return res;
} }
/* /*
@ -323,5 +323,5 @@ rtheapptr(Relation r, ItemPointer itemp)
else else
ItemPointerSetInvalid(ip); ItemPointerSetInvalid(ip);
return (ip); return ip;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.16 1998/02/26 04:30:06 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.17 1998/09/01 03:21:26 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -36,7 +36,7 @@ rt_box_union(BOX *a, BOX *b)
n->low.x = Min(a->low.x, b->low.x); n->low.x = Min(a->low.x, b->low.x);
n->low.y = Min(a->low.y, b->low.y); n->low.y = Min(a->low.y, b->low.y);
return (n); return n;
} }
BOX * BOX *
@ -55,10 +55,10 @@ rt_box_inter(BOX *a, BOX *b)
if (n->high.x < n->low.x || n->high.y < n->low.y) if (n->high.x < n->low.x || n->high.y < n->low.y)
{ {
pfree(n); pfree(n);
return ((BOX *) NULL); return (BOX *) NULL;
} }
return (n); return n;
} }
void void
@ -149,8 +149,8 @@ rt_poly_inter(POLYGON *a, POLYGON *b)
if (p->boundbox.high.x < p->boundbox.low.x || p->boundbox.high.y < p->boundbox.low.y) if (p->boundbox.high.x < p->boundbox.low.x || p->boundbox.high.y < p->boundbox.low.y)
{ {
pfree(p); pfree(p);
return ((POLYGON *) NULL); return (POLYGON *) NULL;
} }
return (p); return p;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.26 1998/08/19 02:01:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.27 1998/09/01 03:21:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -136,8 +136,8 @@ rtbuild(Relation heap,
} }
/* init the tuple descriptors and get set for a heap scan */ /* init the tuple descriptors and get set for a heap scan */
hd = RelationGetTupleDescriptor(heap); hd = RelationGetDescr(heap);
id = RelationGetTupleDescriptor(index); id = RelationGetDescr(index);
d = (Datum *) palloc(natts * sizeof(*d)); d = (Datum *) palloc(natts * sizeof(*d));
nulls = (bool *) palloc(natts * sizeof(*nulls)); nulls = (bool *) palloc(natts * sizeof(*nulls));
@ -310,7 +310,7 @@ rtinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation he
RTSTATE rtState; RTSTATE rtState;
/* generate an index tuple */ /* generate an index tuple */
itup = index_formtuple(RelationGetTupleDescriptor(r), datum, nulls); itup = index_formtuple(RelationGetDescr(r), datum, nulls);
itup->t_tid = *ht_ctid; itup->t_tid = *ht_ctid;
initRtstate(&rtState, r); initRtstate(&rtState, r);
@ -318,7 +318,7 @@ rtinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation he
res = rtdoinsert(r, itup, &rtState); res = rtdoinsert(r, itup, &rtState);
/* XXX two-phase locking -- don't unlock the relation until EOT */ /* XXX two-phase locking -- don't unlock the relation until EOT */
return (res); return res;
} }
static InsertIndexResult static InsertIndexResult
@ -372,7 +372,7 @@ rtdoinsert(Relation r, IndexTuple itup, RTSTATE *rtstate)
res = dosplit(r, buffer, stack, itup, rtstate); res = dosplit(r, buffer, stack, itup, rtstate);
freestack(stack); freestack(stack);
WriteBuffer(buffer); /* don't forget to release buffer! */ WriteBuffer(buffer); /* don't forget to release buffer! */
return (res); return res;
} }
/* add the item and write the buffer */ /* add the item and write the buffer */
@ -402,7 +402,7 @@ rtdoinsert(Relation r, IndexTuple itup, RTSTATE *rtstate)
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData)); res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), blk, l); ItemPointerSet(&(res->pointerData), blk, l);
return (res); return res;
} }
static void static void
@ -435,7 +435,7 @@ rttighten(Relation r,
if (newd_size != old_size) if (newd_size != old_size)
{ {
TupleDesc td = RelationGetTupleDescriptor(r); TupleDesc td = RelationGetDescr(r);
if (td->attrs[0]->attlen < 0) if (td->attrs[0]->attlen < 0)
{ {
@ -620,7 +620,7 @@ dosplit(Relation r,
pfree(ltup); pfree(ltup);
pfree(rtup); pfree(rtup);
return (res); return res;
} }
static void static void
@ -922,13 +922,13 @@ choose(Relation r, Page p, IndexTuple it, RTSTATE *rtstate)
} }
} }
return (which); return which;
} }
static int static int
nospace(Page p, IndexTuple it) nospace(Page p, IndexTuple it)
{ {
return (PageGetFreeSpace(p) < IndexTupleSize(it)); return PageGetFreeSpace(p) < IndexTupleSize(it);
} }
void void
@ -970,7 +970,7 @@ rtdelete(Relation r, ItemPointer tid)
WriteBuffer(buf); WriteBuffer(buf);
/* XXX -- two-phase locking, don't release the write lock */ /* XXX -- two-phase locking, don't release the write lock */
return ((char *) NULL); return (char *) NULL;
} }
static void static void

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.17 1998/08/19 02:01:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.18 1998/09/01 03:21:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -73,7 +73,7 @@ rtbeginscan(Relation r,
s = RelationGetIndexScan(r, fromEnd, nkeys, key); s = RelationGetIndexScan(r, fromEnd, nkeys, key);
rtregscan(s); rtregscan(s);
return (s); return s;
} }
void void

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.8 1997/09/08 02:21:11 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.9 1998/09/01 03:21:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -209,7 +209,7 @@ RelationGetRTStrategy(Relation r,
AttrNumber attnum, AttrNumber attnum,
RegProcedure proc) RegProcedure proc)
{ {
return (RelationGetStrategy(r, attnum, &RTEvaluationData, proc)); return RelationGetStrategy(r, attnum, &RTEvaluationData, proc);
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -239,5 +239,5 @@ RTMapOperator(Relation r,
RTNStrategies, RTNStrategies,
attnum); attnum);
return (strategyMap->entry[RTOperMap[procstrat - 1] - 1].sk_procedure); return strategyMap->entry[RTOperMap[procstrat - 1] - 1].sk_procedure;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.17 1998/02/26 04:30:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.18 1998/09/01 03:21:31 momjian Exp $
* *
* NOTES * NOTES
* This file contains the high level access-method interface to the * This file contains the high level access-method interface to the
@ -188,7 +188,7 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */
/* /*
* so lint is happy... * so lint is happy...
*/ */
return (false); return false;
} }
/* -------------------------------- /* --------------------------------

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.21 1998/07/21 04:17:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.22 1998/09/01 03:21:33 momjian Exp $
* *
* NOTES * NOTES
* Transaction aborts can now occur two ways: * Transaction aborts can now occur two ways:
@ -295,7 +295,7 @@ IsTransactionState(void)
/* /*
* Shouldn't get here, but lint is not happy with this... * Shouldn't get here, but lint is not happy with this...
*/ */
return (false); return false;
} }
/* -------------------------------- /* --------------------------------
@ -863,7 +863,7 @@ StartTransaction()
bool bool
CurrentXactInProgress() CurrentXactInProgress()
{ {
return (CurrentTransactionState->state == TRANS_INPROGRESS); return CurrentTransactionState->state == TRANS_INPROGRESS;
} }
/* -------------------------------- /* --------------------------------
@ -1462,7 +1462,7 @@ IsTransactionBlock()
if (s->blockState == TBLOCK_INPROGRESS if (s->blockState == TBLOCK_INPROGRESS
|| s->blockState == TBLOCK_ENDABORT) || s->blockState == TBLOCK_ENDABORT)
return (true); return true;
return (false); return false;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.16 1998/04/26 04:05:34 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.17 1998/09/01 03:21:34 momjian Exp $
* *
* OLD COMMENTS * OLD COMMENTS
* XXX WARNING * XXX WARNING
@ -34,7 +34,7 @@ extern TransactionId FirstTransactionId;
TransactionId TransactionId
xidin(char *representation) xidin(char *representation)
{ {
return (atol(representation)); return atol(representation);
} }
/* XXX name for catalogs */ /* XXX name for catalogs */
@ -49,7 +49,7 @@ xidout(TransactionId transactionId)
sprintf(representation, "%u", transactionId); sprintf(representation, "%u", transactionId);
return (representation); return representation;
} }
@ -60,7 +60,7 @@ xidout(TransactionId transactionId)
bool bool
TransactionIdIsLessThan(TransactionId id1, TransactionId id2) TransactionIdIsLessThan(TransactionId id1, TransactionId id2)
{ {
return ((bool) (id1 < id2)); return (bool) (id1 < id2);
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -75,7 +75,7 @@ TransactionIdIsLessThan(TransactionId id1, TransactionId id2)
bool bool
xideq(TransactionId xid1, TransactionId xid2) xideq(TransactionId xid1, TransactionId xid2)
{ {
return ((bool) (xid1 == xid2)); return (bool) (xid1 == xid2);
} }

View File

@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.49 1998/08/24 19:04:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.50 1998/09/01 03:21:36 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -86,7 +86,7 @@
extern int Int_yyparse(void); extern int Int_yyparse(void);
static hashnode *AddStr(char *str, int strlength, int mderef); static hashnode *AddStr(char *str, int strlength, int mderef);
static AttributeTupleForm AllocateAttribute(void); static Form_pg_attribute AllocateAttribute(void);
static bool BootstrapAlreadySeen(Oid id); static bool BootstrapAlreadySeen(Oid id);
static int CompHash(char *str, int len); static int CompHash(char *str, int len);
static hashnode *FindStr(char *str, int length, hashnode *mderef); static hashnode *FindStr(char *str, int length, hashnode *mderef);
@ -165,7 +165,7 @@ static int n_types = sizeof(Procid) / sizeof(struct typinfo);
struct typmap struct typmap
{ /* a hack */ { /* a hack */
Oid am_oid; Oid am_oid;
TypeTupleFormData am_typ; FormData_pg_type am_typ;
}; };
static struct typmap **Typ = (struct typmap **) NULL; static struct typmap **Typ = (struct typmap **) NULL;
@ -176,7 +176,7 @@ static char Blanks[MAXATTR];
static char *relname; /* current relation name */ static char *relname; /* current relation name */
AttributeTupleForm attrtypes[MAXATTR]; /* points to attribute info */ Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
static char *values[MAXATTR]; /* cooresponding attribute values */ static char *values[MAXATTR]; /* cooresponding attribute values */
int numattr; /* number of attributes for cur. rel */ int numattr; /* number of attributes for cur. rel */
extern int fsyncOff; /* do not fsync the database */ extern int fsyncOff; /* do not fsync the database */
@ -394,7 +394,7 @@ BootstrapMain(int argc, char *argv[])
for (i = 0; i < MAXATTR; i++) for (i = 0; i < MAXATTR; i++)
{ {
attrtypes[i] = (AttributeTupleForm) NULL; attrtypes[i] = (Form_pg_attribute) NULL;
Blanks[i] = ' '; Blanks[i] = ' ';
} }
for (i = 0; i < STRTABLESIZE; ++i) for (i = 0; i < STRTABLESIZE; ++i)
@ -514,7 +514,7 @@ boot_openrel(char *relname)
if (DebugMode) if (DebugMode)
{ {
AttributeTupleForm at = attrtypes[i]; Form_pg_attribute at = attrtypes[i];
printf("create attribute %d name %s len %d num %d type %d\n", printf("create attribute %d name %s len %d num %d type %d\n",
i, at->attname.data, at->attlen, at->attnum, i, at->attname.data, at->attlen, at->attnum,
@ -580,7 +580,7 @@ DefineAttr(char *name, char *type, int attnum)
} }
typeoid = gettype(type); typeoid = gettype(type);
if (attrtypes[attnum] == (AttributeTupleForm) NULL) if (attrtypes[attnum] == (Form_pg_attribute) NULL)
attrtypes[attnum] = AllocateAttribute(); attrtypes[attnum] = AllocateAttribute();
if (Typ != (struct typmap **) NULL) if (Typ != (struct typmap **) NULL)
{ {
@ -757,7 +757,7 @@ BootstrapAlreadySeen(Oid id)
seenArray[nseen] = id; seenArray[nseen] = id;
nseen++; nseen++;
} }
return (seenthis); return seenthis;
} }
/* ---------------- /* ----------------
@ -802,7 +802,7 @@ gettype(char *type)
if (strncmp((*app)->am_typ.typname.data, type, NAMEDATALEN) == 0) if (strncmp((*app)->am_typ.typname.data, type, NAMEDATALEN) == 0)
{ {
Ap = *app; Ap = *app;
return ((*app)->am_oid); return (*app)->am_oid;
} }
} }
} }
@ -811,7 +811,7 @@ gettype(char *type)
for (i = 0; i <= n_types; i++) for (i = 0; i <= n_types; i++)
{ {
if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0) if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0)
return (i); return i;
} }
if (DebugMode) if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type); printf("bootstrap.c: External Type: %s\n", type);
@ -836,7 +836,7 @@ gettype(char *type)
} }
heap_endscan(scan); heap_endscan(scan);
heap_close(rel); heap_close(rel);
return (gettype(type)); return gettype(type);
} }
elog(ERROR, "Error: unknown type '%s'.\n", type); elog(ERROR, "Error: unknown type '%s'.\n", type);
err_out(); err_out();
@ -848,17 +848,17 @@ gettype(char *type)
* AllocateAttribute * AllocateAttribute
* ---------------- * ----------------
*/ */
static AttributeTupleForm /* XXX */ static Form_pg_attribute /* XXX */
AllocateAttribute() AllocateAttribute()
{ {
AttributeTupleForm attribute = Form_pg_attribute attribute =
(AttributeTupleForm) malloc(ATTRIBUTE_TUPLE_SIZE); (Form_pg_attribute) malloc(ATTRIBUTE_TUPLE_SIZE);
if (!PointerIsValid(attribute)) if (!PointerIsValid(attribute))
elog(FATAL, "AllocateAttribute: malloc failed"); elog(FATAL, "AllocateAttribute: malloc failed");
MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE); MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE);
return (attribute); return attribute;
} }
/* ---------------- /* ----------------
@ -912,11 +912,11 @@ EnterString(char *str)
node = FindStr(str, len, 0); node = FindStr(str, len, 0);
if (node) if (node)
return (node->strnum); return node->strnum;
else else
{ {
node = AddStr(str, len, 0); node = AddStr(str, len, 0);
return (node->strnum); return node->strnum;
} }
} }
@ -929,7 +929,7 @@ EnterString(char *str)
char * char *
LexIDStr(int ident_num) LexIDStr(int ident_num)
{ {
return (strtable[ident_num]); return strtable[ident_num];
} }
@ -949,7 +949,7 @@ CompHash(char *str, int len)
result = (NUM * str[0] + NUMSQR * str[len - 1] + NUMCUBE * str[(len - 1) / 2]); result = (NUM * str[0] + NUMSQR * str[len - 1] + NUMCUBE * str[(len - 1) / 2]);
return (result % HASHTABLESIZE); return result % HASHTABLESIZE;
} }
@ -976,13 +976,13 @@ FindStr(char *str, int length, hashnode *mderef)
*/ */
if (!strcmp(str, strtable[node->strnum])) if (!strcmp(str, strtable[node->strnum]))
{ {
return (node); /* no need to check */ return node; /* no need to check */
} }
else else
node = node->next; node = node->next;
} }
/* Couldn't find it in the list */ /* Couldn't find it in the list */
return (NULL); return NULL;
} }
/* ---------------- /* ----------------
@ -1048,7 +1048,7 @@ AddStr(char *str, int strlength, int mderef)
} }
trail->next = newnode; trail->next = newnode;
} }
return (newnode); return newnode;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.14 1998/08/19 02:01:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.15 1998/09/01 03:21:38 momjian Exp $
* *
* NOTES * NOTES
* See acl.h. * See acl.h.
@ -130,7 +130,7 @@ ChangeAcl(char *relname,
if (!heap_attisnull(tuple, Anum_pg_class_relacl)) if (!heap_attisnull(tuple, Anum_pg_class_relacl))
old_acl = (Acl *) heap_getattr(tuple, old_acl = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl, Anum_pg_class_relacl,
RelationGetTupleDescriptor(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
if (!old_acl || ACL_NUM(old_acl) < 1) if (!old_acl || ACL_NUM(old_acl) < 1)
{ {
@ -190,7 +190,7 @@ get_grosysid(char *groname)
id = ((Form_pg_group) GETSTRUCT(tuple))->grosysid; id = ((Form_pg_group) GETSTRUCT(tuple))->grosysid;
else else
elog(ERROR, "non-existent group \"%s\"", groname); elog(ERROR, "non-existent group \"%s\"", groname);
return (id); return id;
} }
char * char *
@ -206,7 +206,7 @@ get_groname(AclId grosysid)
name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data; name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data;
else else
elog(NOTICE, "get_groname: group %d not found", grosysid); elog(NOTICE, "get_groname: group %d not found", grosysid);
return (name); return name;
} }
static int32 static int32
@ -225,7 +225,7 @@ in_group(AclId uid, AclId gid)
{ {
elog(NOTICE, "in_group: could not open \"%s\"??", elog(NOTICE, "in_group: could not open \"%s\"??",
GroupRelationName); GroupRelationName);
return (0); return 0;
} }
tuple = SearchSysCacheTuple(GROSYSID, tuple = SearchSysCacheTuple(GROSYSID,
ObjectIdGetDatum(gid), ObjectIdGetDatum(gid),
@ -235,7 +235,7 @@ in_group(AclId uid, AclId gid)
{ {
tmp = (IdList *) heap_getattr(tuple, tmp = (IdList *) heap_getattr(tuple,
Anum_pg_group_grolist, Anum_pg_group_grolist,
RelationGetTupleDescriptor(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
/* XXX make me a function */ /* XXX make me a function */
num = IDLIST_NUM(tmp); num = IDLIST_NUM(tmp);
@ -250,7 +250,7 @@ in_group(AclId uid, AclId gid)
else else
elog(NOTICE, "in_group: group %d not found", gid); elog(NOTICE, "in_group: group %d not found", gid);
heap_close(relation); heap_close(relation);
return (found); return found;
} }
/* /*
@ -300,7 +300,7 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
elog(DEBUG, "aclcheck: found %d/%d", elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode); aip->ai_id, aip->ai_mode);
#endif #endif
return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV); return (aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV;
} }
} }
for (found_group = 0; for (found_group = 0;
@ -340,7 +340,7 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
elog(DEBUG, "aclcheck: found %d/%d", elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode); aip->ai_id, aip->ai_mode);
#endif #endif
return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV); return (aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV;
} }
} }
break; break;
@ -354,7 +354,7 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
#ifdef ACLDEBUG_TRACE #ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: using world=%d", aidat->ai_mode); elog(DEBUG, "aclcheck: using world=%d", aidat->ai_mode);
#endif #endif
return ((aidat->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV); return (aidat->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV;
} }
int32 int32
@ -433,7 +433,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
relation = heap_openr(RelationRelationName); relation = heap_openr(RelationRelationName);
tmp = (Acl *) heap_getattr(tuple, tmp = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl, Anum_pg_class_relacl,
RelationGetTupleDescriptor(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
acl = makeacl(ACL_NUM(tmp)); acl = makeacl(ACL_NUM(tmp));
memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp)); memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp));
@ -451,7 +451,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
relation = heap_openr(RelationRelationName); relation = heap_openr(RelationRelationName);
ownerId = (int4) heap_getattr(tuple, ownerId = (int4) heap_getattr(tuple,
Anum_pg_class_relowner, Anum_pg_class_relowner,
RelationGetTupleDescriptor(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
acl = aclownerdefault(relname, (AclId)ownerId); acl = aclownerdefault(relname, (AclId)ownerId);
} }
@ -476,7 +476,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
{ {
tmp = (Acl *) heap_getattr(tuple, tmp = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl, Anum_pg_class_relacl,
RelationGetTupleDescriptor(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
acl = makeacl(ACL_NUM(tmp)); acl = makeacl(ACL_NUM(tmp));
memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp)); memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp));
@ -487,7 +487,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
result = aclcheck(relname, acl, id, (AclIdType) ACL_IDTYPE_UID, mode); result = aclcheck(relname, acl, id, (AclIdType) ACL_IDTYPE_UID, mode);
if (acl) if (acl)
pfree(acl); pfree(acl);
return (result); return result;
} }
int32 int32
@ -516,7 +516,7 @@ pg_ownercheck(char *usename,
elog(DEBUG, "pg_ownercheck: user \"%s\" is superuser", elog(DEBUG, "pg_ownercheck: user \"%s\" is superuser",
usename); usename);
#endif #endif
return (1); return 1;
} }
tuple = SearchSysCacheTuple(cacheid, PointerGetDatum(value), tuple = SearchSysCacheTuple(cacheid, PointerGetDatum(value),
@ -527,7 +527,7 @@ pg_ownercheck(char *usename,
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_ownercheck: operator %ld not found", elog(ERROR, "pg_ownercheck: operator %ld not found",
PointerGetDatum(value)); PointerGetDatum(value));
owner_id = ((OperatorTupleForm) GETSTRUCT(tuple))->oprowner; owner_id = ((Form_pg_operator) GETSTRUCT(tuple))->oprowner;
break; break;
case PRONAME: case PRONAME:
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
@ -545,7 +545,7 @@ pg_ownercheck(char *usename,
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_ownercheck: type \"%s\" not found", elog(ERROR, "pg_ownercheck: type \"%s\" not found",
value); value);
owner_id = ((TypeTupleForm) GETSTRUCT(tuple))->typowner; owner_id = ((Form_pg_type) GETSTRUCT(tuple))->typowner;
break; break;
default: default:
elog(ERROR, "pg_ownercheck: invalid cache id: %d", elog(ERROR, "pg_ownercheck: invalid cache id: %d",
@ -553,7 +553,7 @@ pg_ownercheck(char *usename,
break; break;
} }
return (user_id == owner_id); return user_id == owner_id;
} }
int32 int32
@ -583,7 +583,7 @@ pg_func_ownercheck(char *usename,
elog(DEBUG, "pg_ownercheck: user \"%s\" is superuser", elog(DEBUG, "pg_ownercheck: user \"%s\" is superuser",
usename); usename);
#endif #endif
return (1); return 1;
} }
tuple = SearchSysCacheTuple(PRONAME, tuple = SearchSysCacheTuple(PRONAME,
@ -596,7 +596,7 @@ pg_func_ownercheck(char *usename,
owner_id = ((Form_pg_proc) GETSTRUCT(tuple))->proowner; owner_id = ((Form_pg_proc) GETSTRUCT(tuple))->proowner;
return (user_id == owner_id); return user_id == owner_id;
} }
int32 int32
@ -625,7 +625,7 @@ pg_aggr_ownercheck(char *usename,
elog(DEBUG, "pg_aggr_ownercheck: user \"%s\" is superuser", elog(DEBUG, "pg_aggr_ownercheck: user \"%s\" is superuser",
usename); usename);
#endif #endif
return (1); return 1;
} }
tuple = SearchSysCacheTuple(AGGNAME, tuple = SearchSysCacheTuple(AGGNAME,
@ -638,5 +638,5 @@ pg_aggr_ownercheck(char *usename,
owner_id = ((Form_pg_aggregate) GETSTRUCT(tuple))->aggowner; owner_id = ((Form_pg_aggregate) GETSTRUCT(tuple))->aggowner;
return (user_id == owner_id); return user_id == owner_id;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.16 1998/08/19 02:01:29 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.17 1998/09/01 03:21:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -27,7 +27,7 @@
* Perhaps this should be in-line code in relopen(). * Perhaps this should be in-line code in relopen().
*/ */
char * char *
relpath(char relname[]) relpath(char *relname)
{ {
char *path; char *path;
@ -35,9 +35,9 @@ relpath(char relname[])
{ {
path = (char *) palloc(strlen(DataDir) + sizeof(NameData) + 2); path = (char *) palloc(strlen(DataDir) + sizeof(NameData) + 2);
sprintf(path, "%s/%s", DataDir, relname); sprintf(path, "%s/%s", DataDir, relname);
return (path); return path;
} }
return (relname); return relname;
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -51,7 +51,7 @@ relpath(char relname[])
* XXX this is way bogus. -- pma * XXX this is way bogus. -- pma
*/ */
bool bool
issystem(char relname[]) issystem(char *relname)
{ {
if (relname[0] && relname[1] && relname[2]) if (relname[0] && relname[1] && relname[2])
return (relname[0] == 'p' && return (relname[0] == 'p' &&
@ -154,12 +154,12 @@ newoid()
void void
fillatt(TupleDesc tupleDesc) fillatt(TupleDesc tupleDesc)
{ {
AttributeTupleForm *attributeP; Form_pg_attribute *attributeP;
TypeTupleForm typp; Form_pg_type typp;
HeapTuple tuple; HeapTuple tuple;
int i; int i;
int natts = tupleDesc->natts; int natts = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs; Form_pg_attribute *att = tupleDesc->attrs;
if (natts < 0 || natts > MaxHeapAttributeNumber) if (natts < 0 || natts > MaxHeapAttributeNumber)
elog(ERROR, "fillatt: %d attributes is too large", natts); elog(ERROR, "fillatt: %d attributes is too large", natts);
@ -193,7 +193,7 @@ fillatt(TupleDesc tupleDesc)
*/ */
if (!(*attributeP)->attisset) if (!(*attributeP)->attisset)
{ {
typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */ typp = (Form_pg_type) GETSTRUCT(tuple); /* XXX */
(*attributeP)->attlen = typp->typlen; (*attributeP)->attlen = typp->typlen;
(*attributeP)->attbyval = typp->typbyval; (*attributeP)->attbyval = typp->typbyval;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.62 1998/08/29 04:19:08 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.63 1998/09/01 03:21:41 momjian Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation * heap_create() - Create an uncataloged heap relation
@ -73,7 +73,7 @@ static void AddToTempRelList(Relation r);
static void DeletePgAttributeTuples(Relation rel); static void DeletePgAttributeTuples(Relation rel);
static void DeletePgRelationTuple(Relation rel); static void DeletePgRelationTuple(Relation rel);
static void DeletePgTypeTuple(Relation rel); static void DeletePgTypeTuple(Relation rel);
static int RelationAlreadyExists(Relation pg_class_desc, char relname[]); static int RelationAlreadyExists(Relation pg_class_desc, char *relname);
static void RelationRemoveIndexes(Relation relation); static void RelationRemoveIndexes(Relation relation);
static void RelationRemoveInheritance(Relation relation); static void RelationRemoveInheritance(Relation relation);
static void RemoveFromTempRelList(Relation r); static void RemoveFromTempRelList(Relation r);
@ -129,7 +129,7 @@ static FormData_pg_attribute a6 = {
MaxCommandIdAttributeNumber, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' MaxCommandIdAttributeNumber, 0, -1, -1, '\001', '\0', 'i', '\0', '\0'
}; };
static AttributeTupleForm HeapAtt[] = static Form_pg_attribute HeapAtt[] =
{&a1, &a2, &a3, &a4, &a5, &a6}; {&a1, &a2, &a3, &a4, &a5, &a6};
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -185,7 +185,7 @@ heap_create(char *name,
int isTemp = 0; int isTemp = 0;
int natts = tupDesc->natts; int natts = tupDesc->natts;
/* AttributeTupleForm *att = tupDesc->attrs; */ /* Form_pg_attribute *att = tupDesc->attrs; */
extern GlobalMemory CacheCxt; extern GlobalMemory CacheCxt;
MemoryContext oldcxt; MemoryContext oldcxt;
@ -332,7 +332,7 @@ heap_create(char *name,
if (isTemp) if (isTemp)
AddToTempRelList(rel); AddToTempRelList(rel);
return (rel); return rel;
} }
@ -465,7 +465,7 @@ CheckAttributeNames(TupleDesc tupdesc)
* -------------------------------- * --------------------------------
*/ */
static int static int
RelationAlreadyExists(Relation pg_class_desc, char relname[]) RelationAlreadyExists(Relation pg_class_desc, char *relname)
{ {
ScanKeyData key; ScanKeyData key;
HeapScanDesc pg_class_scan; HeapScanDesc pg_class_scan;
@ -535,7 +535,7 @@ static void
AddNewAttributeTuples(Oid new_rel_oid, AddNewAttributeTuples(Oid new_rel_oid,
TupleDesc tupdesc) TupleDesc tupdesc)
{ {
AttributeTupleForm *dpp; Form_pg_attribute *dpp;
unsigned i; unsigned i;
HeapTuple tup; HeapTuple tup;
Relation rel; Relation rel;
@ -555,7 +555,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
*/ */
Assert(rel); Assert(rel);
Assert(rel->rd_rel); Assert(rel->rd_rel);
hasindex = RelationGetRelationTupleForm(rel)->relhasindex; hasindex = RelationGetForm(rel)->relhasindex;
if (hasindex) if (hasindex)
CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs); CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs);
@ -911,7 +911,7 @@ RelationRemoveInheritance(Relation relation)
heap_close(catalogRelation); heap_close(catalogRelation);
elog(ERROR, "relation <%d> inherits \"%s\"", elog(ERROR, "relation <%d> inherits \"%s\"",
((InheritsTupleForm) GETSTRUCT(tuple))->inhrel, ((Form_pg_inherits) GETSTRUCT(tuple))->inhrel,
RelationGetRelationName(relation)); RelationGetRelationName(relation));
} }
@ -984,7 +984,7 @@ RelationRemoveIndexes(Relation relation)
&entry); &entry);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
index_destroy(((IndexTupleForm) GETSTRUCT(tuple))->indexrelid); index_destroy(((Form_pg_index) GETSTRUCT(tuple))->indexrelid);
heap_endscan(scan); heap_endscan(scan);
heap_close(indexRelation); heap_close(indexRelation);
@ -1165,7 +1165,7 @@ DeletePgTypeTuple(Relation rel)
if (HeapTupleIsValid(atttup)) if (HeapTupleIsValid(atttup))
{ {
Oid relid = ((AttributeTupleForm) GETSTRUCT(atttup))->attrelid; Oid relid = ((Form_pg_attribute) GETSTRUCT(atttup))->attrelid;
heap_endscan(pg_type_scan); heap_endscan(pg_type_scan);
heap_close(pg_type_desc); heap_close(pg_type_desc);
@ -1428,7 +1428,7 @@ StoreAttrDefault(Relation rel, AttrDefault *attrdef)
{ {
char str[MAX_PARSE_BUFFER]; char str[MAX_PARSE_BUFFER];
char cast[2 * NAMEDATALEN] = {0}; char cast[2 * NAMEDATALEN] = {0};
AttributeTupleForm atp = rel->rd_att->attrs[attrdef->adnum - 1]; Form_pg_attribute atp = rel->rd_att->attrs[attrdef->adnum - 1];
QueryTreeList *queryTree_list; QueryTreeList *queryTree_list;
Query *query; Query *query;
List *planTree_list; List *planTree_list;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.58 1998/08/31 17:49:16 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.59 1998/09/01 03:21:43 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
@ -71,7 +71,7 @@ static TupleDesc BuildFuncTupleDesc(FuncIndexInfo *funcInfo);
static TupleDesc static TupleDesc
ConstructTupleDescriptor(Oid heapoid, Relation heapRelation, ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
List *attributeList, List *attributeList,
int numatts, AttrNumber attNums[]); int numatts, AttrNumber *attNums);
static void ConstructIndexReldesc(Relation indexRelation, Oid amoid); static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
static Oid UpdateRelationRelation(Relation indexRelation); static Oid UpdateRelationRelation(Relation indexRelation);
@ -84,13 +84,13 @@ static void
static void static void
UpdateIndexRelation(Oid indexoid, Oid heapoid, UpdateIndexRelation(Oid indexoid, Oid heapoid,
FuncIndexInfo *funcInfo, int natts, FuncIndexInfo *funcInfo, int natts,
AttrNumber attNums[], Oid classOids[], Node *predicate, AttrNumber *attNums, Oid *classOids, Node *predicate,
List *attributeList, bool islossy, bool unique); List *attributeList, bool islossy, bool unique);
static void static void
DefaultBuild(Relation heapRelation, Relation indexRelation, DefaultBuild(Relation heapRelation, Relation indexRelation,
int numberOfAttributes, AttrNumber attributeNumber[], int numberOfAttributes, AttrNumber *attributeNumber,
IndexStrategy indexStrategy, uint16 parameterCount, IndexStrategy indexStrategy, uint16 parameterCount,
Datum parameter[], FuncIndexInfoPtr funcInfo, PredInfo *predInfo); Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* sysatts is a structure containing attribute tuple forms * sysatts is a structure containing attribute tuple forms
@ -241,7 +241,7 @@ BuildFuncTupleDesc(FuncIndexInfo *funcInfo)
* Allocate and zero a tuple descriptor. * Allocate and zero a tuple descriptor.
*/ */
funcTupDesc = CreateTemplateTupleDesc(1); funcTupDesc = CreateTemplateTupleDesc(1);
funcTupDesc->attrs[0] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); funcTupDesc->attrs[0] = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
MemSet(funcTupDesc->attrs[0], 0, ATTRIBUTE_TUPLE_SIZE); MemSet(funcTupDesc->attrs[0], 0, ATTRIBUTE_TUPLE_SIZE);
/* /*
@ -273,20 +273,20 @@ BuildFuncTupleDesc(FuncIndexInfo *funcInfo)
/* /*
* Assign some of the attributes values. Leave the rest as 0. * Assign some of the attributes values. Leave the rest as 0.
*/ */
funcTupDesc->attrs[0]->attlen = ((TypeTupleForm) GETSTRUCT(tuple))->typlen; funcTupDesc->attrs[0]->attlen = ((Form_pg_type) GETSTRUCT(tuple))->typlen;
funcTupDesc->attrs[0]->atttypid = retType; funcTupDesc->attrs[0]->atttypid = retType;
funcTupDesc->attrs[0]->attnum = 1; funcTupDesc->attrs[0]->attnum = 1;
funcTupDesc->attrs[0]->attbyval = ((TypeTupleForm) GETSTRUCT(tuple))->typbyval; funcTupDesc->attrs[0]->attbyval = ((Form_pg_type) GETSTRUCT(tuple))->typbyval;
funcTupDesc->attrs[0]->attcacheoff = -1; funcTupDesc->attrs[0]->attcacheoff = -1;
funcTupDesc->attrs[0]->atttypmod = -1; funcTupDesc->attrs[0]->atttypmod = -1;
funcTupDesc->attrs[0]->attalign = ((TypeTupleForm) GETSTRUCT(tuple))->typalign; funcTupDesc->attrs[0]->attalign = ((Form_pg_type) GETSTRUCT(tuple))->typalign;
/* /*
* make the attributes name the same as the functions * make the attributes name the same as the functions
*/ */
namestrcpy(&funcTupDesc->attrs[0]->attname, funcname); namestrcpy(&funcTupDesc->attrs[0]->attname, funcname);
return (funcTupDesc); return funcTupDesc;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -298,7 +298,7 @@ ConstructTupleDescriptor(Oid heapoid,
Relation heapRelation, Relation heapRelation,
List *attributeList, List *attributeList,
int numatts, int numatts,
AttrNumber attNums[]) AttrNumber *attNums)
{ {
TupleDesc heapTupDesc; TupleDesc heapTupDesc;
TupleDesc indexTupDesc; TupleDesc indexTupDesc;
@ -306,7 +306,7 @@ ConstructTupleDescriptor(Oid heapoid,
TypeName *IndexKeyType; TypeName *IndexKeyType;
AttrNumber atnum; /* attributeNumber[attributeOffset] */ AttrNumber atnum; /* attributeNumber[attributeOffset] */
AttrNumber atind; AttrNumber atind;
int natts; /* RelationTupleForm->relnatts */ int natts; /* Form_pg_class->relnatts */
char *from; /* used to simplify memcpy below */ char *from; /* used to simplify memcpy below */
char *to; /* used to simplify memcpy below */ char *to; /* used to simplify memcpy below */
int i; int i;
@ -315,7 +315,7 @@ ConstructTupleDescriptor(Oid heapoid,
* allocate the new tuple descriptor * allocate the new tuple descriptor
* ---------------- * ----------------
*/ */
natts = RelationGetRelationTupleForm(heapRelation)->relnatts; natts = RelationGetForm(heapRelation)->relnatts;
indexTupDesc = CreateTemplateTupleDesc(numatts); indexTupDesc = CreateTemplateTupleDesc(numatts);
@ -350,7 +350,7 @@ ConstructTupleDescriptor(Oid heapoid,
else else
IndexKeyType = NULL; IndexKeyType = NULL;
indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); indexTupDesc->attrs[i] = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
/* ---------------- /* ----------------
* determine which tuple descriptor to copy * determine which tuple descriptor to copy
@ -379,7 +379,7 @@ ConstructTupleDescriptor(Oid heapoid,
* here we are indexing on a normal attribute (1...n) * here we are indexing on a normal attribute (1...n)
* ---------------- * ----------------
*/ */
heapTupDesc = RelationGetTupleDescriptor(heapRelation); heapTupDesc = RelationGetDescr(heapRelation);
atind = AttrNumberGetAttrOffset(atnum); atind = AttrNumberGetAttrOffset(atnum);
from = (char *) (heapTupDesc->attrs[atind]); from = (char *) (heapTupDesc->attrs[atind]);
@ -394,13 +394,13 @@ ConstructTupleDescriptor(Oid heapoid,
to = (char *) (indexTupDesc->attrs[i]); to = (char *) (indexTupDesc->attrs[i]);
memcpy(to, from, ATTRIBUTE_TUPLE_SIZE); memcpy(to, from, ATTRIBUTE_TUPLE_SIZE);
((AttributeTupleForm) to)->attnum = i + 1; ((Form_pg_attribute) to)->attnum = i + 1;
((AttributeTupleForm) to)->attnotnull = false; ((Form_pg_attribute) to)->attnotnull = false;
((AttributeTupleForm) to)->atthasdef = false; ((Form_pg_attribute) to)->atthasdef = false;
((AttributeTupleForm) to)->attcacheoff = -1; ((Form_pg_attribute) to)->attcacheoff = -1;
((AttributeTupleForm) to)->atttypmod = -1; ((Form_pg_attribute) to)->atttypmod = -1;
((AttributeTupleForm) to)->attalign = 'i'; ((Form_pg_attribute) to)->attalign = 'i';
/* /*
* if the keytype is defined, we need to change the tuple form's * if the keytype is defined, we need to change the tuple form's
@ -416,14 +416,14 @@ ConstructTupleDescriptor(Oid heapoid,
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "create index: type '%s' undefined", elog(ERROR, "create index: type '%s' undefined",
IndexKeyType->name); IndexKeyType->name);
((AttributeTupleForm) to)->atttypid = tup->t_oid; ((Form_pg_attribute) to)->atttypid = tup->t_oid;
((AttributeTupleForm) to)->attbyval = ((Form_pg_attribute) to)->attbyval =
((TypeTupleForm) GETSTRUCT(tup))->typbyval; ((Form_pg_type) GETSTRUCT(tup))->typbyval;
((AttributeTupleForm) to)->attlen = ((Form_pg_attribute) to)->attlen =
((TypeTupleForm) GETSTRUCT(tup))->typlen; ((Form_pg_type) GETSTRUCT(tup))->typlen;
((AttributeTupleForm) to)->attalign = ((Form_pg_attribute) to)->attalign =
((TypeTupleForm) GETSTRUCT(tup))->typalign; ((Form_pg_type) GETSTRUCT(tup))->typalign;
((AttributeTupleForm) to)->atttypmod = IndexKeyType->typmod; ((Form_pg_attribute) to)->atttypmod = IndexKeyType->typmod;
} }
@ -433,14 +433,14 @@ ConstructTupleDescriptor(Oid heapoid,
* all set. * all set.
* ---------------- * ----------------
*/ */
((AttributeTupleForm) to)->attrelid = heapoid; ((Form_pg_attribute) to)->attrelid = heapoid;
} }
return indexTupDesc; return indexTupDesc;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* AccessMethodObjectIdGetAccessMethodTupleForm -- * AccessMethodObjectIdGetForm --
* Returns the formated access method tuple given its object identifier. * Returns the formated access method tuple given its object identifier.
* *
* XXX ADD INDEXING * XXX ADD INDEXING
@ -450,7 +450,7 @@ ConstructTupleDescriptor(Oid heapoid,
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
Form_pg_am Form_pg_am
AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId) AccessMethodObjectIdGetForm(Oid accessMethodObjectId)
{ {
Relation pg_am_desc; Relation pg_am_desc;
HeapScanDesc pg_am_scan; HeapScanDesc pg_am_scan;
@ -483,7 +483,7 @@ AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
{ {
heap_endscan(pg_am_scan); heap_endscan(pg_am_scan);
heap_close(pg_am_desc); heap_close(pg_am_desc);
return (NULL); return NULL;
} }
/* ---------------- /* ----------------
@ -496,7 +496,7 @@ AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
heap_endscan(pg_am_scan); heap_endscan(pg_am_scan);
heap_close(pg_am_desc); heap_close(pg_am_desc);
return (form); return form;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -521,7 +521,7 @@ ConstructIndexReldesc(Relation indexRelation, Oid amoid)
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt); oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
indexRelation->rd_am = indexRelation->rd_am =
AccessMethodObjectIdGetAccessMethodTupleForm(amoid); AccessMethodObjectIdGetForm(amoid);
MemoryContextSwitchTo(oldcxt); MemoryContextSwitchTo(oldcxt);
@ -583,7 +583,7 @@ UpdateRelationRelation(Relation indexRelation)
pfree(tuple); pfree(tuple);
heap_close(pg_class); heap_close(pg_class);
return (tupleOid); return tupleOid;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -598,7 +598,7 @@ InitializeAttributeOids(Relation indexRelation,
TupleDesc tupleDescriptor; TupleDesc tupleDescriptor;
int i; int i;
tupleDescriptor = RelationGetTupleDescriptor(indexRelation); tupleDescriptor = RelationGetDescr(indexRelation);
for (i = 0; i < numatts; i += 1) for (i = 0; i < numatts; i += 1)
tupleDescriptor->attrs[i]->attrelid = indexoid; tupleDescriptor->attrs[i]->attrelid = indexoid;
@ -633,7 +633,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
pg_attribute = heap_openr(AttributeRelationName); pg_attribute = heap_openr(AttributeRelationName);
/* ---------------- /* ----------------
* initialize null[], replace[] and value[] * initialize *null, *replace and *value
* ---------------- * ----------------
*/ */
MemSet(nullv, ' ', Natts_pg_attribute); MemSet(nullv, ' ', Natts_pg_attribute);
@ -681,7 +681,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
* descriptor to form the remaining attribute tuples. * descriptor to form the remaining attribute tuples.
* ---------------- * ----------------
*/ */
indexTupDesc = RelationGetTupleDescriptor(indexRelation); indexTupDesc = RelationGetDescr(indexRelation);
for (i = 1; i < numatts; i += 1) for (i = 1; i < numatts; i += 1)
{ {
@ -731,14 +731,14 @@ UpdateIndexRelation(Oid indexoid,
Oid heapoid, Oid heapoid,
FuncIndexInfo *funcInfo, FuncIndexInfo *funcInfo,
int natts, int natts,
AttrNumber attNums[], AttrNumber *attNums,
Oid classOids[], Oid *classOids,
Node *predicate, Node *predicate,
List *attributeList, List *attributeList,
bool islossy, bool islossy,
bool unique) bool unique)
{ {
IndexTupleForm indexForm; Form_pg_index indexForm;
IndexElem *IndexKey; IndexElem *IndexKey;
char *predString; char *predString;
text *predText; text *predText;
@ -749,7 +749,7 @@ UpdateIndexRelation(Oid indexoid,
int i; int i;
/* ---------------- /* ----------------
* allocate an IndexTupleForm big enough to hold the * allocate an Form_pg_index big enough to hold the
* index-predicate (if any) in string form * index-predicate (if any) in string form
* ---------------- * ----------------
*/ */
@ -763,7 +763,7 @@ UpdateIndexRelation(Oid indexoid,
predText = (text *) fmgr(F_TEXTIN, ""); predText = (text *) fmgr(F_TEXTIN, "");
predLen = VARSIZE(predText); predLen = VARSIZE(predText);
itupLen = predLen + sizeof(FormData_pg_index); itupLen = predLen + sizeof(FormData_pg_index);
indexForm = (IndexTupleForm) palloc(itupLen); indexForm = (Form_pg_index) palloc(itupLen);
memmove((char *) &indexForm->indpred, (char *) predText, predLen); memmove((char *) &indexForm->indpred, (char *) predText, predLen);
@ -1009,8 +1009,8 @@ index_create(char *heapRelationName,
List *attributeList, List *attributeList,
Oid accessMethodObjectId, Oid accessMethodObjectId,
int numatts, int numatts,
AttrNumber attNums[], AttrNumber *attNums,
Oid classObjectId[], Oid *classObjectId,
uint16 parameterCount, uint16 parameterCount,
Datum *parameter, Datum *parameter,
Node *predicate, Node *predicate,
@ -1259,7 +1259,7 @@ index_destroy(Oid indexId)
*/ */
void void
FormIndexDatum(int numberOfAttributes, FormIndexDatum(int numberOfAttributes,
AttrNumber attributeNumber[], AttrNumber *attributeNumber,
HeapTuple heapTuple, HeapTuple heapTuple,
TupleDesc heapDescriptor, TupleDesc heapDescriptor,
Datum *datum, Datum *datum,
@ -1475,10 +1475,10 @@ static void
DefaultBuild(Relation heapRelation, DefaultBuild(Relation heapRelation,
Relation indexRelation, Relation indexRelation,
int numberOfAttributes, int numberOfAttributes,
AttrNumber attributeNumber[], AttrNumber *attributeNumber,
IndexStrategy indexStrategy, /* not used */ IndexStrategy indexStrategy, /* not used */
uint16 parameterCount, /* not used */ uint16 parameterCount, /* not used */
Datum parameter[], /* not used */ Datum *parameter, /* not used */
FuncIndexInfoPtr funcInfo, FuncIndexInfoPtr funcInfo,
PredInfo *predInfo) PredInfo *predInfo)
{ {
@ -1514,8 +1514,8 @@ DefaultBuild(Relation heapRelation,
* how to form the index tuples.. * how to form the index tuples..
* ---------------- * ----------------
*/ */
heapDescriptor = RelationGetTupleDescriptor(heapRelation); heapDescriptor = RelationGetDescr(heapRelation);
indexDescriptor = RelationGetTupleDescriptor(indexRelation); indexDescriptor = RelationGetDescr(indexRelation);
/* ---------------- /* ----------------
* datum and null are arrays in which we collect the index attributes * datum and null are arrays in which we collect the index attributes
@ -1675,7 +1675,7 @@ void
index_build(Relation heapRelation, index_build(Relation heapRelation,
Relation indexRelation, Relation indexRelation,
int numberOfAttributes, int numberOfAttributes,
AttrNumber attributeNumber[], AttrNumber *attributeNumber,
uint16 parameterCount, uint16 parameterCount,
Datum *parameter, Datum *parameter,
FuncIndexInfo *funcInfo, FuncIndexInfo *funcInfo,
@ -1727,7 +1727,7 @@ bool
IndexIsUnique(Oid indexId) IndexIsUnique(Oid indexId)
{ {
HeapTuple tuple; HeapTuple tuple;
IndexTupleForm index; Form_pg_index index;
tuple = SearchSysCacheTuple(INDEXRELID, tuple = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(indexId), ObjectIdGetDatum(indexId),
@ -1737,7 +1737,7 @@ IndexIsUnique(Oid indexId)
elog(ERROR, "IndexIsUnique: can't find index id %d", elog(ERROR, "IndexIsUnique: can't find index id %d",
indexId); indexId);
} }
index = (IndexTupleForm) GETSTRUCT(tuple); index = (Form_pg_index) GETSTRUCT(tuple);
Assert(index->indexrelid == indexId); Assert(index->indexrelid == indexId);
return index->indisunique; return index->indisunique;
@ -1762,7 +1762,7 @@ IndexIsUniqueNoCache(Oid indexId)
ScanKeyData skey[1]; ScanKeyData skey[1];
HeapScanDesc scandesc; HeapScanDesc scandesc;
HeapTuple tuple; HeapTuple tuple;
IndexTupleForm index; Form_pg_index index;
bool isunique; bool isunique;
pg_index = heap_openr(IndexRelationName); pg_index = heap_openr(IndexRelationName);
@ -1779,7 +1779,7 @@ IndexIsUniqueNoCache(Oid indexId)
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "IndexIsUniqueNoCache: can't find index id %d", indexId); elog(ERROR, "IndexIsUniqueNoCache: can't find index id %d", indexId);
index = (IndexTupleForm) GETSTRUCT(tuple); index = (Form_pg_index) GETSTRUCT(tuple);
Assert(index->indexrelid == indexId); Assert(index->indexrelid == indexId);
isunique = index->indisunique; isunique = index->indisunique;

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.24 1998/08/31 17:49:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.25 1998/09/01 03:21:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -74,7 +74,7 @@ static HeapTuple CatalogIndexFetchTuple(Relation heapRelation,
* associated with them. * associated with them.
*/ */
void void
CatalogOpenIndices(int nIndices, char *names[], Relation idescs[]) CatalogOpenIndices(int nIndices, char **names, Relation *idescs)
{ {
int i; int i;
@ -108,7 +108,7 @@ CatalogIndexInsert(Relation *idescs,
{ {
HeapTuple pgIndexTup; HeapTuple pgIndexTup;
TupleDesc heapDescriptor; TupleDesc heapDescriptor;
IndexTupleForm pgIndexP; Form_pg_index pgIndexP;
Datum datum; Datum datum;
int natts; int natts;
AttrNumber *attnumP; AttrNumber *attnumP;
@ -117,19 +117,19 @@ CatalogIndexInsert(Relation *idescs,
char nulls[INDEX_MAX_KEYS]; char nulls[INDEX_MAX_KEYS];
int i; int i;
heapDescriptor = RelationGetTupleDescriptor(heapRelation); heapDescriptor = RelationGetDescr(heapRelation);
for (i = 0; i < nIndices; i++) for (i = 0; i < nIndices; i++)
{ {
TupleDesc indexDescriptor; TupleDesc indexDescriptor;
InsertIndexResult indexRes; InsertIndexResult indexRes;
indexDescriptor = RelationGetTupleDescriptor(idescs[i]); indexDescriptor = RelationGetDescr(idescs[i]);
pgIndexTup = SearchSysCacheTupleCopy(INDEXRELID, pgIndexTup = SearchSysCacheTupleCopy(INDEXRELID,
ObjectIdGetDatum(idescs[i]->rd_id), ObjectIdGetDatum(idescs[i]->rd_id),
0, 0, 0); 0, 0, 0);
Assert(pgIndexTup); Assert(pgIndexTup);
pgIndexP = (IndexTupleForm) GETSTRUCT(pgIndexTup); pgIndexP = (Form_pg_index) GETSTRUCT(pgIndexTup);
/* /*
* Compute the number of attributes we are indexing upon. * Compute the number of attributes we are indexing upon.
@ -191,9 +191,9 @@ CatalogHasIndex(char *catName, Oid catId)
for (i = 0; IndexedCatalogNames[i] != NULL; i++) for (i = 0; IndexedCatalogNames[i] != NULL; i++)
{ {
if (strcmp(IndexedCatalogNames[i], catName) == 0) if (strcmp(IndexedCatalogNames[i], catName) == 0)
return (true); return true;
} }
return (false); return false;
} }
pg_class = heap_openr(RelationRelationName); pg_class = heap_openr(RelationRelationName);
@ -207,7 +207,7 @@ CatalogHasIndex(char *catName, Oid catId)
} }
pgRelP = (Form_pg_class) GETSTRUCT(htup); pgRelP = (Form_pg_class) GETSTRUCT(htup);
return (pgRelP->relhasindex); return pgRelP->relhasindex;
} }
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.15 1998/08/19 02:01:34 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.16 1998/09/01 03:21:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -314,14 +314,14 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
* NULL * NULL
*/ */
textInitVal = (text *) fastgetattr(tup, initValAttno, textInitVal = (text *) fastgetattr(tup, initValAttno,
RelationGetTupleDescriptor(aggRel), RelationGetDescr(aggRel),
isNull); isNull);
if (!PointerIsValid(textInitVal)) if (!PointerIsValid(textInitVal))
*isNull = true; *isNull = true;
if (*isNull) if (*isNull)
{ {
heap_close(aggRel); heap_close(aggRel);
return ((char *) NULL); return (char *) NULL;
} }
strInitVal = textout(textInitVal); strInitVal = textout(textInitVal);
heap_close(aggRel); heap_close(aggRel);
@ -334,7 +334,7 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
pfree(strInitVal); pfree(strInitVal);
elog(ERROR, "AggNameGetInitVal: cache lookup failed on aggregate transition function return type"); elog(ERROR, "AggNameGetInitVal: cache lookup failed on aggregate transition function return type");
} }
initVal = fmgr(((TypeTupleForm) GETSTRUCT(tup))->typinput, strInitVal, -1); initVal = fmgr(((Form_pg_type) GETSTRUCT(tup))->typinput, strInitVal, -1);
pfree(strInitVal); pfree(strInitVal);
return (initVal); return initVal;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.27 1998/08/19 02:01:36 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.28 1998/09/01 03:21:47 momjian Exp $
* *
* NOTES * NOTES
* these routines moved here from commands/define.c and somewhat cleaned up. * these routines moved here from commands/define.c and somewhat cleaned up.
@ -234,7 +234,7 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
TupleDesc tupDesc; TupleDesc tupDesc;
/* ---------------- /* ----------------
* initialize our nulls[] and values[] arrays * initialize our *nulls and *values arrays
* ---------------- * ----------------
*/ */
for (i = 0; i < Natts_pg_operator; ++i) for (i = 0; i < Natts_pg_operator; ++i)
@ -244,7 +244,7 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
} }
/* ---------------- /* ----------------
* initialize values[] with the type name and * initialize *values with the type name and
* ---------------- * ----------------
*/ */
i = 0; i = 0;
@ -807,9 +807,9 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
{ {
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
OperatorTupleForm t; Form_pg_operator t;
t = (OperatorTupleForm) GETSTRUCT(tup); t = (Form_pg_operator) GETSTRUCT(tup);
if (!OidIsValid(t->oprcom) if (!OidIsValid(t->oprcom)
|| !OidIsValid(t->oprnegate)) || !OidIsValid(t->oprnegate))
{ {
@ -849,7 +849,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
/* if commutator and negator are different, do two updates */ /* if commutator and negator are different, do two updates */
if (HeapTupleIsValid(tup) && if (HeapTupleIsValid(tup) &&
!(OidIsValid(((OperatorTupleForm) GETSTRUCT(tup))->oprcom))) !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprcom)))
{ {
values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId); values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
replaces[Anum_pg_operator_oprcom - 1] = 'r'; replaces[Anum_pg_operator_oprcom - 1] = 'r';
@ -878,7 +878,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
tup = heap_getnext(pg_operator_scan, 0); tup = heap_getnext(pg_operator_scan, 0);
if (HeapTupleIsValid(tup) && if (HeapTupleIsValid(tup) &&
!(OidIsValid(((OperatorTupleForm) GETSTRUCT(tup))->oprnegate))) !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate)))
{ {
values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId); values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
replaces[Anum_pg_operator_oprnegate - 1] = 'r'; replaces[Anum_pg_operator_oprnegate - 1] = 'r';

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.21 1998/08/31 17:49:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.22 1998/09/01 03:21:48 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -266,7 +266,7 @@ ProcedureCreate(char *procedureName,
heap_insert(rel, tup); heap_insert(rel, tup);
if (RelationGetRelationTupleForm(rel)->relhasindex) if (RelationGetForm(rel)->relhasindex)
{ {
Relation idescs[Num_pg_proc_indices]; Relation idescs[Num_pg_proc_indices];

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.28 1998/08/20 22:07:37 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.29 1998/09/01 03:21:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -98,7 +98,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
* ---------------- * ----------------
*/ */
heap_endscan(scan); heap_endscan(scan);
*defined = (bool) ((TypeTupleForm) GETSTRUCT(tup))->typisdefined; *defined = (bool) ((Form_pg_type) GETSTRUCT(tup))->typisdefined;
return tup->t_oid; return tup->t_oid;
} }
@ -163,7 +163,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
TupleDesc tupDesc; TupleDesc tupDesc;
/* ---------------- /* ----------------
* initialize our nulls[] and values[] arrays * initialize our *nulls and *values arrays
* ---------------- * ----------------
*/ */
for (i = 0; i < Natts_pg_type; ++i) for (i = 0; i < Natts_pg_type; ++i)
@ -173,7 +173,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
} }
/* ---------------- /* ----------------
* initialize values[] with the type name and * initialize *values with the type name and
* ---------------- * ----------------
*/ */
i = 0; i = 0;
@ -215,7 +215,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
heap_insert(pg_type_desc, tup); heap_insert(pg_type_desc, tup);
typoid = tup->t_oid; typoid = tup->t_oid;
if (RelationGetRelationTupleForm(pg_type_desc)->relhasindex) if (RelationGetForm(pg_type_desc)->relhasindex)
{ {
Relation idescs[Num_pg_type_indices]; Relation idescs[Num_pg_type_indices];
@ -375,7 +375,7 @@ TypeCreate(char *typeName,
internalSize = -1; internalSize = -1;
/* ---------------- /* ----------------
* initialize the values[] information * initialize the *values information
* ---------------- * ----------------
*/ */
i = 0; i = 0;
@ -509,7 +509,7 @@ TypeCreate(char *typeName,
*/ */
heap_endscan(pg_type_scan); heap_endscan(pg_type_scan);
if (RelationGetRelationTupleForm(pg_type_desc)->relhasindex) if (RelationGetForm(pg_type_desc)->relhasindex)
{ {
Relation idescs[Num_pg_type_indices]; Relation idescs[Num_pg_type_indices];
@ -558,7 +558,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
elog(ERROR, "TypeRename: type %s already defined", newTypeName); elog(ERROR, "TypeRename: type %s already defined", newTypeName);
} }
namestrcpy(&(((TypeTupleForm) GETSTRUCT(oldtup))->typname), newTypeName); namestrcpy(&(((Form_pg_type) GETSTRUCT(oldtup))->typname), newTypeName);
setheapoverride(true); setheapoverride(true);
heap_replace(pg_type_desc, &oldtup->t_ctid, oldtup); heap_replace(pg_type_desc, &oldtup->t_ctid, oldtup);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.38 1998/08/30 21:04:43 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.39 1998/09/01 03:21:50 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -189,7 +189,7 @@ Async_Notify(char *relname)
PointerGetDatum(notifyName)); PointerGetDatum(notifyName));
lRel = heap_openr(ListenerRelationName); lRel = heap_openr(ListenerRelationName);
tdesc = RelationGetTupleDescriptor(lRel); tdesc = RelationGetDescr(lRel);
RelationSetLockForWrite(lRel); RelationSetLockForWrite(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key); sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
@ -281,7 +281,7 @@ Async_NotifyAtCommit()
lRel = heap_openr(ListenerRelationName); lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel); RelationSetLockForWrite(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key); sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
tdesc = RelationGetTupleDescriptor(lRel); tdesc = RelationGetDescr(lRel);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0))) while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{ {
@ -445,7 +445,7 @@ Async_Listen(char *relname, int pid)
RelationSetLockForWrite(lDesc); RelationSetLockForWrite(lDesc);
/* is someone already listening. One listener per relation */ /* is someone already listening. One listener per relation */
tdesc = RelationGetTupleDescriptor(lDesc); tdesc = RelationGetDescr(lDesc);
scan = heap_beginscan(lDesc, 0, SnapshotNow, 0, (ScanKey) NULL); scan = heap_beginscan(lDesc, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{ {
@ -571,7 +571,7 @@ Async_UnlistenAll()
Int32GetDatum(MyProcPid)); Int32GetDatum(MyProcPid));
lRel = heap_openr(ListenerRelationName); lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel); RelationSetLockForWrite(lRel);
tdesc = RelationGetTupleDescriptor(lRel); tdesc = RelationGetDescr(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key); sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0))) while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
@ -672,7 +672,7 @@ Async_NotifyFrontEnd_Aux()
Int32GetDatum(MyProcPid)); Int32GetDatum(MyProcPid));
lRel = heap_openr(ListenerRelationName); lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel); RelationSetLockForWrite(lRel);
tdesc = RelationGetTupleDescriptor(lRel); tdesc = RelationGetDescr(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 2, key); sRel = heap_beginscan(lRel, 0, SnapshotNow, 2, key);
nulls[0] = nulls[1] = nulls[2] = ' '; nulls[0] = nulls[1] = nulls[2] = ' ';

View File

@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.29 1998/08/20 22:24:10 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.30 1998/09/01 03:21:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -80,7 +80,7 @@ static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
* *
*/ */
void void
cluster(char oldrelname[], char oldindexname[]) cluster(char *oldrelname, char *oldindexname)
{ {
Oid OIDOldHeap, Oid OIDOldHeap,
OIDOldIndex, OIDOldIndex,
@ -209,7 +209,7 @@ copy_heap(Oid OIDOldHeap)
sprintf(NewName, "temp_%x", OIDOldHeap); sprintf(NewName, "temp_%x", OIDOldHeap);
OldHeap = heap_open(OIDOldHeap); OldHeap = heap_open(OIDOldHeap);
OldHeapDesc = RelationGetTupleDescriptor(OldHeap); OldHeapDesc = RelationGetDescr(OldHeap);
/* /*
* Need to make a copy of the tuple descriptor, * Need to make a copy of the tuple descriptor,
@ -239,7 +239,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
HeapTuple Old_pg_index_Tuple, HeapTuple Old_pg_index_Tuple,
Old_pg_index_relation_Tuple, Old_pg_index_relation_Tuple,
pg_proc_Tuple; pg_proc_Tuple;
IndexTupleForm Old_pg_index_Form; Form_pg_index Old_pg_index_Form;
Form_pg_class Old_pg_index_relation_Form; Form_pg_class Old_pg_index_relation_Form;
Form_pg_proc pg_proc_Form; Form_pg_proc pg_proc_Form;
char *NewIndexName; char *NewIndexName;
@ -261,7 +261,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
0, 0, 0); 0, 0, 0);
Assert(Old_pg_index_Tuple); Assert(Old_pg_index_Tuple);
Old_pg_index_Form = (IndexTupleForm) GETSTRUCT(Old_pg_index_Tuple); Old_pg_index_Form = (Form_pg_index) GETSTRUCT(Old_pg_index_Tuple);
Old_pg_index_relation_Tuple = Old_pg_index_relation_Tuple =
SearchSysCacheTuple(RELOID, SearchSysCacheTuple(RELOID,

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.30 1998/08/19 02:01:42 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.31 1998/09/01 03:21:53 momjian Exp $
* *
* NOTES * NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated * The PortalExecutorHeapMemory crap needs to be eliminated
@ -270,11 +270,11 @@ PerformAddAttribute(char *relationName,
bool inherits, bool inherits,
ColumnDef *colDef) ColumnDef *colDef)
{ {
Relation relrdesc, Relation rel,
attrdesc; attrdesc;
HeapTuple reltup; HeapTuple reltup;
HeapTuple attributeTuple; HeapTuple attributeTuple;
AttributeTupleForm attribute; Form_pg_attribute attribute;
FormData_pg_attribute attributeD; FormData_pg_attribute attributeD;
int i; int i;
int minattnum, int minattnum,
@ -325,14 +325,14 @@ PerformAddAttribute(char *relationName,
List *child, List *child,
*children; *children;
relrdesc = heap_openr(relationName); rel = heap_openr(relationName);
if (!RelationIsValid(relrdesc)) if (!RelationIsValid(rel))
{ {
elog(ERROR, "PerformAddAttribute: unknown relation: \"%s\"", elog(ERROR, "PerformAddAttribute: unknown relation: \"%s\"",
relationName); relationName);
} }
myrelid = RelationGetRelid(relrdesc); myrelid = RelationGetRelid(rel);
heap_close(relrdesc); heap_close(rel);
/* this routine is actually in the planner */ /* this routine is actually in the planner */
children = find_all_inheritors(lconsi(myrelid, NIL), NIL); children = find_all_inheritors(lconsi(myrelid, NIL), NIL);
@ -347,20 +347,20 @@ PerformAddAttribute(char *relationName,
childrelid = lfirsti(child); childrelid = lfirsti(child);
if (childrelid == myrelid) if (childrelid == myrelid)
continue; continue;
relrdesc = heap_open(childrelid); rel = heap_open(childrelid);
if (!RelationIsValid(relrdesc)) if (!RelationIsValid(rel))
{ {
elog(ERROR, "PerformAddAttribute: can't find catalog entry for inheriting class with oid %d", elog(ERROR, "PerformAddAttribute: can't find catalog entry for inheriting class with oid %d",
childrelid); childrelid);
} }
PerformAddAttribute((relrdesc->rd_rel->relname).data, PerformAddAttribute((rel->rd_rel->relname).data,
userName, false, colDef); userName, false, colDef);
heap_close(relrdesc); heap_close(rel);
} }
} }
} }
relrdesc = heap_openr(RelationRelationName); rel = heap_openr(RelationRelationName);
reltup = SearchSysCacheTupleCopy(RELNAME, reltup = SearchSysCacheTupleCopy(RELNAME,
PointerGetDatum(relationName), PointerGetDatum(relationName),
@ -368,7 +368,7 @@ PerformAddAttribute(char *relationName,
if (!HeapTupleIsValid(reltup)) if (!HeapTupleIsValid(reltup))
{ {
heap_close(relrdesc); heap_close(rel);
elog(ERROR, "PerformAddAttribute: relation \"%s\" not found", elog(ERROR, "PerformAddAttribute: relation \"%s\" not found",
relationName); relationName);
} }
@ -388,7 +388,7 @@ PerformAddAttribute(char *relationName,
if (maxatts > MaxHeapAttributeNumber) if (maxatts > MaxHeapAttributeNumber)
{ {
pfree(reltup); pfree(reltup);
heap_close(relrdesc); heap_close(rel);
elog(ERROR, "PerformAddAttribute: relations limited to %d attributes", elog(ERROR, "PerformAddAttribute: relations limited to %d attributes",
MaxHeapAttributeNumber); MaxHeapAttributeNumber);
} }
@ -396,12 +396,12 @@ PerformAddAttribute(char *relationName,
attrdesc = heap_openr(AttributeRelationName); attrdesc = heap_openr(AttributeRelationName);
Assert(attrdesc); Assert(attrdesc);
Assert(RelationGetRelationTupleForm(attrdesc)); Assert(RelationGetForm(attrdesc));
/* /*
* Open all (if any) pg_attribute indices * Open all (if any) pg_attribute indices
*/ */
hasindex = RelationGetRelationTupleForm(attrdesc)->relhasindex; hasindex = RelationGetForm(attrdesc)->relhasindex;
if (hasindex) if (hasindex)
CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs); CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs);
@ -411,13 +411,13 @@ PerformAddAttribute(char *relationName,
sizeof attributeD, sizeof attributeD,
(char *) &attributeD); (char *) &attributeD);
attribute = (AttributeTupleForm) GETSTRUCT(attributeTuple); attribute = (Form_pg_attribute) GETSTRUCT(attributeTuple);
i = 1 + minattnum; i = 1 + minattnum;
{ {
HeapTuple typeTuple; HeapTuple typeTuple;
TypeTupleForm form; Form_pg_type form;
char *typename; char *typename;
int attnelems; int attnelems;
@ -429,7 +429,7 @@ PerformAddAttribute(char *relationName,
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
heap_close(attrdesc); heap_close(attrdesc);
heap_close(relrdesc); heap_close(rel);
elog(ERROR, "PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"", elog(ERROR, "PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"",
colDef->colname, relationName); colDef->colname, relationName);
} }
@ -451,7 +451,7 @@ PerformAddAttribute(char *relationName,
typeTuple = SearchSysCacheTuple(TYPNAME, typeTuple = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(typename), PointerGetDatum(typename),
0, 0, 0); 0, 0, 0);
form = (TypeTupleForm) GETSTRUCT(typeTuple); form = (Form_pg_type) GETSTRUCT(typeTuple);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "Add: type \"%s\" nonexistent", typename); elog(ERROR, "Add: type \"%s\" nonexistent", typename);
@ -482,13 +482,13 @@ PerformAddAttribute(char *relationName,
heap_close(attrdesc); heap_close(attrdesc);
((Form_pg_class) GETSTRUCT(reltup))->relnatts = maxatts; ((Form_pg_class) GETSTRUCT(reltup))->relnatts = maxatts;
heap_replace(relrdesc, &reltup->t_ctid, reltup); heap_replace(rel, &reltup->t_ctid, reltup);
/* keep catalog indices current */ /* keep catalog indices current */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs); CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, relrdesc, reltup); CatalogIndexInsert(ridescs, Num_pg_class_indices, rel, reltup);
CatalogCloseIndices(Num_pg_class_indices, ridescs); CatalogCloseIndices(Num_pg_class_indices, ridescs);
pfree(reltup); pfree(reltup);
heap_close(relrdesc); heap_close(rel);
} }

View File

@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.57 1998/08/29 18:19:59 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.58 1998/09/01 03:21:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -217,7 +217,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
int32 attr_count, int32 attr_count,
i; i;
AttributeTupleForm *attr; Form_pg_attribute *attr;
FmgrInfo *out_functions; FmgrInfo *out_functions;
Oid out_func_oid; Oid out_func_oid;
Oid *elements; Oid *elements;
@ -371,7 +371,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
{ {
HeapTuple tuple; HeapTuple tuple;
AttrNumber attr_count; AttrNumber attr_count;
AttributeTupleForm *attr; Form_pg_attribute *attr;
FmgrInfo *in_functions; FmgrInfo *in_functions;
int i; int i;
Oid in_func_oid; Oid in_func_oid;
@ -397,7 +397,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
**finfoP = NULL; **finfoP = NULL;
TupleDesc *itupdescArr; TupleDesc *itupdescArr;
HeapTuple pgIndexTup; HeapTuple pgIndexTup;
IndexTupleForm *pgIndexP = NULL; Form_pg_index *pgIndexP = NULL;
int *indexNatts = NULL; int *indexNatts = NULL;
char *predString; char *predString;
Node **indexPred = NULL; Node **indexPred = NULL;
@ -418,7 +418,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
Oid loaded_oid; Oid loaded_oid;
bool skip_tuple = false; bool skip_tuple = false;
tupDesc = RelationGetTupleDescriptor(rel); tupDesc = RelationGetDescr(rel);
attr = tupDesc->attrs; attr = tupDesc->attrs;
attr_count = tupDesc->natts; attr_count = tupDesc->natts;
@ -438,7 +438,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
itupdescArr = itupdescArr =
(TupleDesc *) palloc(n_indices * sizeof(TupleDesc)); (TupleDesc *) palloc(n_indices * sizeof(TupleDesc));
pgIndexP = pgIndexP =
(IndexTupleForm *) palloc(n_indices * sizeof(IndexTupleForm)); (Form_pg_index *) palloc(n_indices * sizeof(Form_pg_index));
indexNatts = (int *) palloc(n_indices * sizeof(int)); indexNatts = (int *) palloc(n_indices * sizeof(int));
finfo = (FuncIndexInfo *) palloc(n_indices * sizeof(FuncIndexInfo)); finfo = (FuncIndexInfo *) palloc(n_indices * sizeof(FuncIndexInfo));
finfoP = (FuncIndexInfo **) palloc(n_indices * sizeof(FuncIndexInfo *)); finfoP = (FuncIndexInfo **) palloc(n_indices * sizeof(FuncIndexInfo *));
@ -446,13 +446,13 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
econtext = NULL; econtext = NULL;
for (i = 0; i < n_indices; i++) for (i = 0; i < n_indices; i++)
{ {
itupdescArr[i] = RelationGetTupleDescriptor(index_rels[i]); itupdescArr[i] = RelationGetDescr(index_rels[i]);
pgIndexTup = pgIndexTup =
SearchSysCacheTuple(INDEXRELID, SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(index_rels[i])), ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
0, 0, 0); 0, 0, 0);
Assert(pgIndexTup); Assert(pgIndexTup);
pgIndexP[i] = (IndexTupleForm) GETSTRUCT(pgIndexTup); pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup);
for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0; for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber; *attnumP != InvalidAttrNumber;
attnumP++, natts++); attnumP++, natts++);
@ -480,7 +480,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
slot = ExecAllocTableSlot(tupleTable); slot = ExecAllocTableSlot(tupleTable);
econtext = makeNode(ExprContext); econtext = makeNode(ExprContext);
econtext->ecxt_scantuple = slot; econtext->ecxt_scantuple = slot;
rtupdesc = RelationGetTupleDescriptor(rel); rtupdesc = RelationGetDescr(rel);
slot->ttc_tupleDescriptor = rtupdesc; slot->ttc_tupleDescriptor = rtupdesc;
/* /*
@ -831,10 +831,10 @@ GetOutputFunction(Oid type)
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typeTuple)) if (HeapTupleIsValid(typeTuple))
return ((int) ((TypeTupleForm) GETSTRUCT(typeTuple))->typoutput); return (int) ((Form_pg_type) GETSTRUCT(typeTuple))->typoutput;
elog(ERROR, "GetOutputFunction: Cache lookup of type %d failed", type); elog(ERROR, "GetOutputFunction: Cache lookup of type %d failed", type);
return (InvalidOid); return InvalidOid;
} }
static Oid static Oid
@ -847,10 +847,10 @@ GetTypeElement(Oid type)
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typeTuple)) if (HeapTupleIsValid(typeTuple))
return ((int) ((TypeTupleForm) GETSTRUCT(typeTuple))->typelem); return (int) ((Form_pg_type) GETSTRUCT(typeTuple))->typelem;
elog(ERROR, "GetOutputFunction: Cache lookup of type %d failed", type); elog(ERROR, "GetOutputFunction: Cache lookup of type %d failed", type);
return (InvalidOid); return InvalidOid;
} }
static Oid static Oid
@ -863,10 +863,10 @@ GetInputFunction(Oid type)
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typeTuple)) if (HeapTupleIsValid(typeTuple))
return ((int) ((TypeTupleForm) GETSTRUCT(typeTuple))->typinput); return (int) ((Form_pg_type) GETSTRUCT(typeTuple))->typinput;
elog(ERROR, "GetInputFunction: Cache lookup of type %d failed", type); elog(ERROR, "GetInputFunction: Cache lookup of type %d failed", type);
return (InvalidOid); return InvalidOid;
} }
static Oid static Oid
@ -879,11 +879,11 @@ IsTypeByVal(Oid type)
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typeTuple)) if (HeapTupleIsValid(typeTuple))
return ((int) ((TypeTupleForm) GETSTRUCT(typeTuple))->typbyval); return (int) ((Form_pg_type) GETSTRUCT(typeTuple))->typbyval;
elog(ERROR, "GetInputFunction: Cache lookup of type %d failed", type); elog(ERROR, "GetInputFunction: Cache lookup of type %d failed", type);
return (InvalidOid); return InvalidOid;
} }
/* /*
@ -917,7 +917,7 @@ GetIndexRelations(Oid main_relation_oid,
pg_index_rel = heap_openr(IndexRelationName); pg_index_rel = heap_openr(IndexRelationName);
scandesc = heap_beginscan(pg_index_rel, 0, SnapshotNow, 0, NULL); scandesc = heap_beginscan(pg_index_rel, 0, SnapshotNow, 0, NULL);
tupDesc = RelationGetTupleDescriptor(pg_index_rel); tupDesc = RelationGetDescr(pg_index_rel);
*n_indices = 0; *n_indices = 0;
@ -1039,25 +1039,25 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
if (*newline) if (*newline)
{ {
*isnull = (bool) true; *isnull = (bool) true;
return (NULL); return NULL;
} }
#endif #endif
*isnull = (bool) false; /* set default */ *isnull = (bool) false; /* set default */
if (feof(fp)) if (feof(fp))
return (NULL); return NULL;
while (!done) while (!done)
{ {
c = getc(fp); c = getc(fp);
if (feof(fp)) if (feof(fp))
return (NULL); return NULL;
else if (c == '\\') else if (c == '\\')
{ {
c = getc(fp); c = getc(fp);
if (feof(fp)) if (feof(fp))
return (NULL); return NULL;
switch (c) switch (c)
{ {
case '0': case '0':
@ -1082,14 +1082,14 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
else else
{ {
if (feof(fp)) if (feof(fp))
return (NULL); return NULL;
ungetc(c, fp); ungetc(c, fp);
} }
} }
else else
{ {
if (feof(fp)) if (feof(fp))
return (NULL); return NULL;
ungetc(c, fp); ungetc(c, fp);
} }
c = val & 0377; c = val & 0377;
@ -1121,7 +1121,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
c = getc(fp); c = getc(fp);
if (c != '\n') if (c != '\n')
elog(ERROR, "CopyReadAttribute - end of record marker corrupted. line: %d", lineno); elog(ERROR, "CopyReadAttribute - end of record marker corrupted. line: %d", lineno);
return (NULL); return NULL;
break; break;
} }
} }
@ -1142,7 +1142,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
for(j=0;j<mblen;j++) { for(j=0;j<mblen;j++) {
c = getc(fp); c = getc(fp);
if (feof(fp)) if (feof(fp))
return (NULL); return NULL;
attribute[i++] = c; attribute[i++] = c;
} }
#endif #endif
@ -1153,7 +1153,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
#ifdef MULTIBYTE #ifdef MULTIBYTE
return(pg_client_to_server((unsigned char*)attribute, strlen(attribute))); return(pg_client_to_server((unsigned char*)attribute, strlen(attribute)));
#else #else
return (&attribute[0]); return &attribute[0];
#endif #endif
} }
@ -1233,5 +1233,5 @@ CountTuples(Relation relation)
while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0))) while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0)))
i++; i++;
heap_endscan(scandesc); heap_endscan(scandesc);
return (i); return i;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.32 1998/08/19 02:01:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.33 1998/09/01 03:21:56 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -258,12 +258,12 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
} }
if (relation->rd_rel->relkind == 'S') if (relation->rd_rel->relkind == 'S')
elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name); elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name);
tupleDesc = RelationGetTupleDescriptor(relation); tupleDesc = RelationGetDescr(relation);
constr = tupleDesc->constr; constr = tupleDesc->constr;
for (attrno = relation->rd_rel->relnatts - 1; attrno >= 0; attrno--) for (attrno = relation->rd_rel->relnatts - 1; attrno >= 0; attrno--)
{ {
AttributeTupleForm attribute = tupleDesc->attrs[attrno]; Form_pg_attribute attribute = tupleDesc->attrs[attrno];
char *attributeName; char *attributeName;
char *attributeType; char *attributeType;
HeapTuple tuple; HeapTuple tuple;
@ -280,7 +280,7 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
0, 0, 0); 0, 0, 0);
AssertState(HeapTupleIsValid(tuple)); AssertState(HeapTupleIsValid(tuple));
attributeType = attributeType =
(((TypeTupleForm) GETSTRUCT(tuple))->typname).data; (((Form_pg_type) GETSTRUCT(tuple))->typname).data;
/* /*
* check validity * check validity
@ -363,7 +363,7 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
*/ */
schema = nconc(inhSchema, schema); schema = nconc(inhSchema, schema);
*supconstr = constraints; *supconstr = constraints;
return (schema); return schema;
} }
/* /*
@ -394,7 +394,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
* ---------------- * ----------------
*/ */
relation = heap_openr(InheritsRelationName); relation = heap_openr(InheritsRelationName);
desc = RelationGetTupleDescriptor(relation); desc = RelationGetDescr(relation);
seqNumber = 1; seqNumber = 1;
idList = NIL; idList = NIL;
@ -469,7 +469,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
break; break;
lnext(current) = lnext(current) =
lconsi(((InheritsTupleForm) lconsi(((Form_pg_inherits)
GETSTRUCT(tuple))->inhparent, GETSTRUCT(tuple))->inhparent,
NIL); NIL);
@ -519,7 +519,7 @@ again:
* ---------------- * ----------------
*/ */
relation = heap_openr(InheritancePrecidenceListRelationName); relation = heap_openr(InheritancePrecidenceListRelationName);
desc = RelationGetTupleDescriptor(relation); desc = RelationGetDescr(relation);
seqNumber = 1; seqNumber = 1;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.22 1998/08/29 04:09:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.23 1998/09/01 03:21:57 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -171,7 +171,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
dbtup = tup; dbtup = tup;
heap_endscan(scan); heap_endscan(scan);
return (dbtup); return dbtup;
} }
/* /*
@ -250,12 +250,12 @@ check_permissions(char *command,
{ {
dbowner = (int4) heap_getattr(dbtup, dbowner = (int4) heap_getattr(dbtup,
Anum_pg_database_datdba, Anum_pg_database_datdba,
RelationGetTupleDescriptor(dbrel), RelationGetDescr(dbrel),
(char *) NULL); (char *) NULL);
*dbIdP = dbtup->t_oid; *dbIdP = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup, dbtext = (text *) heap_getattr(dbtup,
Anum_pg_database_datpath, Anum_pg_database_datpath,
RelationGetTupleDescriptor(dbrel), RelationGetDescr(dbrel),
(char *) NULL); (char *) NULL);
strncpy(path, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ)); strncpy(path, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ));

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.24 1998/08/26 16:43:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.25 1998/09/01 03:21:58 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -234,7 +234,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
HeapTuple tuple; HeapTuple tuple;
FuncIndexInfo fInfo; FuncIndexInfo fInfo;
FuncIndexInfo *funcInfo = NULL; FuncIndexInfo *funcInfo = NULL;
IndexTupleForm index; Form_pg_index index;
Node *oldPred = NULL; Node *oldPred = NULL;
List *cnfPred = NULL; List *cnfPred = NULL;
PredInfo *predInfo; PredInfo *predInfo;
@ -271,7 +271,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
/* /*
* Extract info from the pg_index tuple * Extract info from the pg_index tuple
*/ */
index = (IndexTupleForm) GETSTRUCT(tuple); index = (Form_pg_index) GETSTRUCT(tuple);
Assert(index->indexrelid == indexId); Assert(index->indexrelid == indexId);
relationId = index->indrelid; relationId = index->indrelid;
indproc = index->indproc; indproc = index->indproc;
@ -421,7 +421,7 @@ FuncIndexArgs(IndexElem *funcIndex,
{ {
List *rest; List *rest;
HeapTuple tuple; HeapTuple tuple;
AttributeTupleForm att; Form_pg_attribute att;
tuple = SearchSysCacheTuple(CLANAME, tuple = SearchSysCacheTuple(CLANAME,
PointerGetDatum(funcIndex->class), PointerGetDatum(funcIndex->class),
@ -455,7 +455,7 @@ FuncIndexArgs(IndexElem *funcIndex,
"DefineIndex: attribute \"%s\" not found", "DefineIndex: attribute \"%s\" not found",
arg); arg);
} }
att = (AttributeTupleForm) GETSTRUCT(tuple); att = (Form_pg_attribute) GETSTRUCT(tuple);
*attNumP++ = att->attnum; *attNumP++ = att->attnum;
*argTypes++ = att->atttypid; *argTypes++ = att->atttypid;
} }
@ -477,7 +477,7 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
for (rest = attList; rest != NIL; rest = lnext(rest)) for (rest = attList; rest != NIL; rest = lnext(rest))
{ {
IndexElem *attribute; IndexElem *attribute;
AttributeTupleForm attform; Form_pg_attribute attform;
attribute = lfirst(rest); attribute = lfirst(rest);
@ -495,7 +495,7 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
attribute->name); attribute->name);
} }
attform = (AttributeTupleForm) GETSTRUCT(atttuple); attform = (Form_pg_attribute) GETSTRUCT(atttuple);
*attNumP++ = attform->attnum; *attNumP++ = attform->attnum;
/* we want the type so we can set the proper alignment, etc. */ /* we want the type so we can set the proper alignment, etc. */
@ -509,7 +509,7 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
attribute->name); attribute->name);
/* we just set the type name because that is all we need */ /* we just set the type name because that is all we need */
attribute->typename = makeNode(TypeName); attribute->typename = makeNode(TypeName);
attribute->typename->name = nameout(&((TypeTupleForm) GETSTRUCT(tuple))->typname); attribute->typename->name = nameout(&((Form_pg_type) GETSTRUCT(tuple))->typname);
} }
if (attribute->class == NULL) if (attribute->class == NULL)

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.25 1998/06/15 19:28:15 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.26 1998/09/01 03:22:00 momjian Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
@ -182,7 +182,7 @@ compute_full_attributes(const List *parameters, int32 *byte_pct_p,
static void static void
interpret_AS_clause(const char languageName[], const char as[], interpret_AS_clause(const char *languageName, const char *as,
char **prosrc_str_p, char **probin_str_p) char **prosrc_str_p, char **probin_str_p)
{ {
@ -710,14 +710,14 @@ defGetString(DefElem *def)
{ {
if (nodeTag(def->arg) != T_String) if (nodeTag(def->arg) != T_String)
elog(ERROR, "Define: \"%s\" = what?", def->defname); elog(ERROR, "Define: \"%s\" = what?", def->defname);
return (strVal(def->arg)); return strVal(def->arg);
} }
static int static int
defGetTypeLength(DefElem *def) defGetTypeLength(DefElem *def)
{ {
if (nodeTag(def->arg) == T_Integer) if (nodeTag(def->arg) == T_Integer)
return (intVal(def->arg)); return intVal(def->arg);
else if (nodeTag(def->arg) == T_String && else if (nodeTag(def->arg) == T_String &&
!strcasecmp(strVal(def->arg), "variable")) !strcasecmp(strVal(def->arg), "variable"))
return -1; /* variable length */ return -1; /* variable length */

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.22 1998/08/06 05:12:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.23 1998/09/01 03:22:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -692,7 +692,7 @@ tg_rewriteParamsInExpr(Node *expression, QueryTreeList *inputQlist)
this code is very similar to ProcedureDefine() in pg_proc.c this code is very similar to ProcedureDefine() in pg_proc.c
*/ */
static int static int
getParamTypes(TgElement * elem, Oid typev[]) getParamTypes(TgElement * elem, Oid *typev)
{ {
/* this code is similar to ProcedureDefine() */ /* this code is similar to ProcedureDefine() */
int16 parameterCount; int16 parameterCount;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.27 1998/08/19 02:01:50 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.28 1998/09/01 03:22:02 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -201,7 +201,7 @@ AttributeAndRelationRemove(Oid typeOid)
scan = heap_beginscan(rel, 0, SnapshotNow, 1, key); scan = heap_beginscan(rel, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(tup = heap_getnext(scan, 0))) while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
{ {
optr->reloid = ((AttributeTupleForm) GETSTRUCT(tup))->attrelid; optr->reloid = ((Form_pg_attribute) GETSTRUCT(tup))->attrelid;
optr->next = (struct oidlist *) palloc(sizeof(*oidptr)); optr->next = (struct oidlist *) palloc(sizeof(*oidptr));
optr = optr->next; optr = optr->next;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.15 1998/08/24 01:13:42 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.16 1998/09/01 03:22:04 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -164,7 +164,7 @@ renameatt(char *relname,
if (!HeapTupleIsValid(oldatttup)) if (!HeapTupleIsValid(oldatttup))
elog(ERROR, "renameatt: attribute \"%s\" nonexistent", oldattname); elog(ERROR, "renameatt: attribute \"%s\" nonexistent", oldattname);
if (((AttributeTupleForm) GETSTRUCT(oldatttup))->attnum < 0) if (((Form_pg_attribute) GETSTRUCT(oldatttup))->attnum < 0)
elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname); elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname);
newatttup = SearchSysCacheTuple(ATTNAME, newatttup = SearchSysCacheTuple(ATTNAME,
@ -178,7 +178,7 @@ renameatt(char *relname,
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname); elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
} }
StrNCpy((((AttributeTupleForm) (GETSTRUCT(oldatttup)))->attname.data), StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
newattname, NAMEDATALEN); newattname, NAMEDATALEN);
attrelation = heap_openr(AttributeRelationName); attrelation = heap_openr(AttributeRelationName);

View File

@ -38,7 +38,7 @@ typedef struct FormData_pg_sequence
char is_called; char is_called;
} FormData_pg_sequence; } FormData_pg_sequence;
typedef FormData_pg_sequence *SequenceTupleForm; typedef FormData_pg_sequence *Form_pg_sequence;
typedef struct sequence_magic typedef struct sequence_magic
{ {
@ -61,8 +61,8 @@ typedef SeqTableData *SeqTable;
static SeqTable seqtab = NULL; static SeqTable seqtab = NULL;
static SeqTable init_sequence(char *caller, char *name); static SeqTable init_sequence(char *caller, char *name);
static SequenceTupleForm read_info(char *caller, SeqTable elm, Buffer *buf); static Form_pg_sequence read_info(char *caller, SeqTable elm, Buffer *buf);
static void init_params(CreateSeqStmt *seq, SequenceTupleForm new); static void init_params(CreateSeqStmt *seq, Form_pg_sequence new);
static int get_param(DefElem *def); static int get_param(DefElem *def);
/* /*
@ -91,7 +91,7 @@ DefineSequence(CreateSeqStmt *seq)
init_params(seq, &new); init_params(seq, &new);
/* /*
* Create relation (and fill null[] & value[]) * Create relation (and fill *null & *value)
*/ */
stmt->tableElts = NIL; stmt->tableElts = NIL;
for (i = SEQ_COL_FIRSTCOL; i <= SEQ_COL_LASTCOL; i++) for (i = SEQ_COL_FIRSTCOL; i <= SEQ_COL_LASTCOL; i++)
@ -164,7 +164,7 @@ DefineSequence(CreateSeqStmt *seq)
RelationSetLockForWrite(rel); RelationSetLockForWrite(rel);
tupDesc = RelationGetTupleDescriptor(rel); tupDesc = RelationGetDescr(rel);
Assert(RelationGetNumberOfBlocks(rel) == 0); Assert(RelationGetNumberOfBlocks(rel) == 0);
buf = ReadBuffer(rel, P_NEW); buf = ReadBuffer(rel, P_NEW);
@ -199,7 +199,7 @@ nextval(struct varlena * seqin)
char *seqname = textout(seqin); char *seqname = textout(seqin);
SeqTable elm; SeqTable elm;
Buffer buf; Buffer buf;
SequenceTupleForm seq; Form_pg_sequence seq;
ItemPointerData iptr; ItemPointerData iptr;
int4 incby, int4 incby,
maxv, maxv,
@ -216,7 +216,7 @@ nextval(struct varlena * seqin)
if (elm->last != elm->cached) /* some numbers were cached */ if (elm->last != elm->cached) /* some numbers were cached */
{ {
elm->last += elm->increment; elm->last += elm->increment;
return (elm->last); return elm->last;
} }
seq = read_info("nextval", elm, &buf); /* lock page and read seq = read_info("nextval", elm, &buf); /* lock page and read
@ -288,7 +288,7 @@ nextval(struct varlena * seqin)
ItemPointerSet(&iptr, 0, FirstOffsetNumber); ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationUnsetSingleWLockPage(elm->rel, &iptr); RelationUnsetSingleWLockPage(elm->rel, &iptr);
return (result); return result;
} }
@ -309,7 +309,7 @@ currval(struct varlena * seqin)
result = elm->last; result = elm->last;
return (result); return result;
} }
@ -319,7 +319,7 @@ setval(struct varlena * seqin, int4 next)
char *seqname = textout(seqin); char *seqname = textout(seqin);
SeqTable elm; SeqTable elm;
Buffer buf; Buffer buf;
SequenceTupleForm seq; Form_pg_sequence seq;
ItemPointerData iptr; ItemPointerData iptr;
#ifndef NO_SECURITY #ifndef NO_SECURITY
@ -356,10 +356,10 @@ setval(struct varlena * seqin, int4 next)
ItemPointerSet(&iptr, 0, FirstOffsetNumber); ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationUnsetSingleWLockPage (elm->rel, &iptr); RelationUnsetSingleWLockPage (elm->rel, &iptr);
return (next); return next;
} }
static SequenceTupleForm static Form_pg_sequence
read_info(char *caller, SeqTable elm, Buffer *buf) read_info(char *caller, SeqTable elm, Buffer *buf)
{ {
ItemPointerData iptr; ItemPointerData iptr;
@ -367,7 +367,7 @@ read_info(char *caller, SeqTable elm, Buffer *buf)
ItemId lp; ItemId lp;
HeapTuple tuple; HeapTuple tuple;
sequence_magic *sm; sequence_magic *sm;
SequenceTupleForm seq; Form_pg_sequence seq;
ItemPointerSet(&iptr, 0, FirstOffsetNumber); ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationSetSingleWLockPage(elm->rel, &iptr); RelationSetSingleWLockPage(elm->rel, &iptr);
@ -390,11 +390,11 @@ read_info(char *caller, SeqTable elm, Buffer *buf)
Assert(ItemIdIsUsed(lp)); Assert(ItemIdIsUsed(lp));
tuple = (HeapTuple) PageGetItem((Page) page, lp); tuple = (HeapTuple) PageGetItem((Page) page, lp);
seq = (SequenceTupleForm) GETSTRUCT(tuple); seq = (Form_pg_sequence) GETSTRUCT(tuple);
elm->increment = seq->increment_by; elm->increment = seq->increment_by;
return (seq); return seq;
} }
@ -427,7 +427,7 @@ init_sequence(char *caller, char *name)
/* found */ /* found */
{ {
if (elm->rel != (Relation) NULL) /* already opened */ if (elm->rel != (Relation) NULL) /* already opened */
return (elm); return elm;
temp = elm; temp = elm;
} }
@ -461,7 +461,7 @@ init_sequence(char *caller, char *name)
priv->next = elm; priv->next = elm;
} }
return (elm); return elm;
} }
@ -494,7 +494,7 @@ CloseSequences(void)
static void static void
init_params(CreateSeqStmt *seq, SequenceTupleForm new) init_params(CreateSeqStmt *seq, Form_pg_sequence new)
{ {
DefElem *last_value = NULL; DefElem *last_value = NULL;
DefElem *increment_by = NULL; DefElem *increment_by = NULL;
@ -591,8 +591,8 @@ get_param(DefElem *def)
elog(ERROR, "DefineSequence: \"%s\" value unspecified", def->defname); elog(ERROR, "DefineSequence: \"%s\" value unspecified", def->defname);
if (nodeTag(def->arg) == T_Integer) if (nodeTag(def->arg) == T_Integer)
return (intVal(def->arg)); return intVal(def->arg);
elog(ERROR, "DefineSequence: \"%s\" is to be integer", def->defname); elog(ERROR, "DefineSequence: \"%s\" is to be integer", def->defname);
return (-1); return -1;
} }

View File

@ -57,7 +57,7 @@ CreateTrigger(CreateTrigStmt *stmt)
Relation tgrel; Relation tgrel;
HeapScanDesc tgscan; HeapScanDesc tgscan;
ScanKeyData key; ScanKeyData key;
Relation relrdesc; Relation pgrel;
HeapTuple tuple; HeapTuple tuple;
Relation idescs[Num_pg_trigger_indices]; Relation idescs[Num_pg_trigger_indices];
Relation ridescs[Num_pg_class_indices]; Relation ridescs[Num_pg_class_indices];
@ -225,15 +225,15 @@ CreateTrigger(CreateTrigStmt *stmt)
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "CreateTrigger: relation %s not found in pg_class", stmt->relname); elog(ERROR, "CreateTrigger: relation %s not found in pg_class", stmt->relname);
relrdesc = heap_openr(RelationRelationName); pgrel = heap_openr(RelationRelationName);
((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found + 1; ((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found + 1;
RelationInvalidateHeapTuple(relrdesc, tuple); RelationInvalidateHeapTuple(pgrel, tuple);
heap_replace(relrdesc, &tuple->t_ctid, tuple); heap_replace(pgrel, &tuple->t_ctid, tuple);
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs); CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, relrdesc, tuple); CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tuple);
CatalogCloseIndices(Num_pg_class_indices, ridescs); CatalogCloseIndices(Num_pg_class_indices, ridescs);
pfree(tuple); pfree(tuple);
heap_close(relrdesc); heap_close(pgrel);
CommandCounterIncrement(); CommandCounterIncrement();
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt); oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
@ -252,7 +252,7 @@ DropTrigger(DropTrigStmt *stmt)
Relation tgrel; Relation tgrel;
HeapScanDesc tgscan; HeapScanDesc tgscan;
ScanKeyData key; ScanKeyData key;
Relation relrdesc; Relation pgrel;
HeapTuple tuple; HeapTuple tuple;
Relation ridescs[Num_pg_class_indices]; Relation ridescs[Num_pg_class_indices];
MemoryContext oldcxt; MemoryContext oldcxt;
@ -304,15 +304,15 @@ DropTrigger(DropTrigStmt *stmt)
elog(ERROR, "DropTrigger: relation %s not found in pg_class", stmt->relname); elog(ERROR, "DropTrigger: relation %s not found in pg_class", stmt->relname);
/* update pg_class */ /* update pg_class */
relrdesc = heap_openr(RelationRelationName); pgrel = heap_openr(RelationRelationName);
((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found; ((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found;
RelationInvalidateHeapTuple(relrdesc, tuple); RelationInvalidateHeapTuple(pgrel, tuple);
heap_replace(relrdesc, &tuple->t_ctid, tuple); heap_replace(pgrel, &tuple->t_ctid, tuple);
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs); CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, relrdesc, tuple); CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tuple);
CatalogCloseIndices(Num_pg_class_indices, ridescs); CatalogCloseIndices(Num_pg_class_indices, ridescs);
pfree(tuple); pfree(tuple);
heap_close(relrdesc); heap_close(pgrel);
CommandCounterIncrement(); CommandCounterIncrement();
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt); oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
@ -631,7 +631,7 @@ ExecBRInsertTriggers(Relation rel, HeapTuple trigtuple)
} }
CurrentTriggerData = NULL; CurrentTriggerData = NULL;
pfree(SaveTriggerData); pfree(SaveTriggerData);
return (newtuple); return newtuple;
} }
void void
@ -670,7 +670,7 @@ ExecBRDeleteTriggers(Relation rel, ItemPointer tupleid)
trigtuple = GetTupleForTrigger(rel, tupleid, true); trigtuple = GetTupleForTrigger(rel, tupleid, true);
if (trigtuple == NULL) if (trigtuple == NULL)
return (false); return false;
SaveTriggerData = (TriggerData *) palloc(sizeof(TriggerData)); SaveTriggerData = (TriggerData *) palloc(sizeof(TriggerData));
SaveTriggerData->tg_event = SaveTriggerData->tg_event =
@ -690,7 +690,7 @@ ExecBRDeleteTriggers(Relation rel, ItemPointer tupleid)
pfree(SaveTriggerData); pfree(SaveTriggerData);
pfree(trigtuple); pfree(trigtuple);
return ((newtuple == NULL) ? false : true); return (newtuple == NULL) ? false : true;
} }
void void
@ -736,7 +736,7 @@ ExecBRUpdateTriggers(Relation rel, ItemPointer tupleid, HeapTuple newtuple)
trigtuple = GetTupleForTrigger(rel, tupleid, true); trigtuple = GetTupleForTrigger(rel, tupleid, true);
if (trigtuple == NULL) if (trigtuple == NULL)
return (NULL); return NULL;
SaveTriggerData = (TriggerData *) palloc(sizeof(TriggerData)); SaveTriggerData = (TriggerData *) palloc(sizeof(TriggerData));
SaveTriggerData->tg_event = SaveTriggerData->tg_event =
@ -757,7 +757,7 @@ ExecBRUpdateTriggers(Relation rel, ItemPointer tupleid, HeapTuple newtuple)
CurrentTriggerData = NULL; CurrentTriggerData = NULL;
pfree(SaveTriggerData); pfree(SaveTriggerData);
pfree(trigtuple); pfree(trigtuple);
return (newtuple); return newtuple;
} }
void void
@ -816,7 +816,7 @@ GetTupleForTrigger(Relation relation, ItemPointer tid, bool before)
{ {
elog(NOTICE, "GetTupleForTrigger: Non-functional delete/update"); elog(NOTICE, "GetTupleForTrigger: Non-functional delete/update");
ReleaseBuffer(b); ReleaseBuffer(b);
return (NULL); return NULL;
} }
HeapTupleSatisfies(lp, relation, b, dp, HeapTupleSatisfies(lp, relation, b, dp,
@ -831,5 +831,5 @@ GetTupleForTrigger(Relation relation, ItemPointer tid, bool before)
tuple = heap_copytuple(tuple); tuple = heap_copytuple(tuple);
ReleaseBuffer(b); ReleaseBuffer(b);
return (tuple); return tuple;
} }

View File

@ -125,7 +125,7 @@ DefineUser(CreateUserStmt *stmt)
* exist. * exist.
*/ */
pg_shadow_rel = heap_openr(ShadowRelationName); pg_shadow_rel = heap_openr(ShadowRelationName);
pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel); pg_shadow_dsc = RelationGetDescr(pg_shadow_rel);
/* /*
* Secure a write lock on pg_shadow so we can be sure of what the next * Secure a write lock on pg_shadow so we can be sure of what the next
@ -247,7 +247,7 @@ AlterUser(AlterUserStmt *stmt)
* Scan the pg_shadow relation to be certain the user exists. * Scan the pg_shadow relation to be certain the user exists.
*/ */
pg_shadow_rel = heap_openr(ShadowRelationName); pg_shadow_rel = heap_openr(ShadowRelationName);
pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel); pg_shadow_dsc = RelationGetDescr(pg_shadow_rel);
/* /*
* Secure a write lock on pg_shadow so we can be sure that when the * Secure a write lock on pg_shadow so we can be sure that when the
@ -363,7 +363,7 @@ RemoveUser(char *user)
* message. * message.
*/ */
pg_shadow_rel = heap_openr(ShadowRelationName); pg_shadow_rel = heap_openr(ShadowRelationName);
pg_dsc = RelationGetTupleDescriptor(pg_shadow_rel); pg_dsc = RelationGetDescr(pg_shadow_rel);
/* /*
* Secure a write lock on pg_shadow so we can be sure that when the * Secure a write lock on pg_shadow so we can be sure that when the
@ -390,7 +390,7 @@ RemoveUser(char *user)
* owned by usesysid. Then drop them. * owned by usesysid. Then drop them.
*/ */
pg_rel = heap_openr(DatabaseRelationName); pg_rel = heap_openr(DatabaseRelationName);
pg_dsc = RelationGetTupleDescriptor(pg_rel); pg_dsc = RelationGetDescr(pg_rel);
scan = heap_beginscan(pg_rel, false, SnapshotNow, 0, NULL); scan = heap_beginscan(pg_rel, false, SnapshotNow, 0, NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.78 1998/08/28 04:57:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.79 1998/09/01 03:22:08 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -87,7 +87,7 @@ static void vc_vacpage(Page page, VPageDescr vpd);
static void vc_vaconeind(VPageList vpl, Relation indrel, int num_tuples); static void vc_vaconeind(VPageList vpl, Relation indrel, int num_tuples);
static void vc_scanoneind(Relation indrel, int num_tuples); static void vc_scanoneind(Relation indrel, int num_tuples);
static void vc_attrstats(Relation onerel, VRelStats *vacrelstats, HeapTuple tuple); static void vc_attrstats(Relation onerel, VRelStats *vacrelstats, HeapTuple tuple);
static void vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum *bucket, int16 *bucket_len); static void vc_bucketcpy(Form_pg_attribute attr, Datum value, Datum *bucket, int16 *bucket_len);
static void vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *vacrelstats); static void vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *vacrelstats);
static void vc_delhilowstats(Oid relid, int attcnt, int *attnums); static void vc_delhilowstats(Oid relid, int attcnt, int *attnums);
static void vc_setpagelock(Relation rel, BlockNumber blkno); static void vc_setpagelock(Relation rel, BlockNumber blkno);
@ -295,7 +295,7 @@ vc_getrels(NameData *VacRelP)
vrl = cur = (VRelList) NULL; vrl = cur = (VRelList) NULL;
rel = heap_openr(RelationRelationName); rel = heap_openr(RelationRelationName);
tupdesc = RelationGetTupleDescriptor(rel); tupdesc = RelationGetDescr(rel);
scan = heap_beginscan(rel, false, SnapshotNow, 1, &key); scan = heap_beginscan(rel, false, SnapshotNow, 1, &key);
@ -354,7 +354,7 @@ vc_getrels(NameData *VacRelP)
CommitTransactionCommand(); CommitTransactionCommand();
return (vrl); return vrl;
} }
/* /*
@ -390,7 +390,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
StartTransactionCommand(); StartTransactionCommand();
rel = heap_openr(RelationRelationName); rel = heap_openr(RelationRelationName);
tupdesc = RelationGetTupleDescriptor(rel); tupdesc = RelationGetDescr(rel);
/* /*
* Race condition -- if the pg_class tuple has gone away since the * Race condition -- if the pg_class tuple has gone away since the
@ -417,7 +417,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
{ {
int attr_cnt, int attr_cnt,
*attnums = NULL; *attnums = NULL;
AttributeTupleForm *attr; Form_pg_attribute *attr;
attr_cnt = onerel->rd_att->natts; attr_cnt = onerel->rd_att->natts;
attr = onerel->rd_att->attrs; attr = onerel->rd_att->attrs;
@ -457,7 +457,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
for (i = 0; i < attr_cnt; i++) for (i = 0; i < attr_cnt; i++)
{ {
Operator func_operator; Operator func_operator;
OperatorTupleForm pgopform; Form_pg_operator pgopform;
VacAttrStats *stats; VacAttrStats *stats;
stats = &vacrelstats->vacattrstats[i]; stats = &vacrelstats->vacattrstats[i];
@ -474,7 +474,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
func_operator = oper("=", stats->attr->atttypid, stats->attr->atttypid, true); func_operator = oper("=", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL) if (func_operator != NULL)
{ {
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator); pgopform = (Form_pg_operator) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpeq)); fmgr_info(pgopform->oprcode, &(stats->f_cmpeq));
} }
else else
@ -483,7 +483,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
func_operator = oper("<", stats->attr->atttypid, stats->attr->atttypid, true); func_operator = oper("<", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL) if (func_operator != NULL)
{ {
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator); pgopform = (Form_pg_operator) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmplt)); fmgr_info(pgopform->oprcode, &(stats->f_cmplt));
} }
else else
@ -492,7 +492,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
func_operator = oper(">", stats->attr->atttypid, stats->attr->atttypid, true); func_operator = oper(">", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL) if (func_operator != NULL)
{ {
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator); pgopform = (Form_pg_operator) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpgt)); fmgr_info(pgopform->oprcode, &(stats->f_cmpgt));
} }
else else
@ -502,7 +502,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
ObjectIdGetDatum(stats->attr->atttypid), ObjectIdGetDatum(stats->attr->atttypid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typetuple)) if (HeapTupleIsValid(typetuple))
stats->outfunc = ((TypeTupleForm) GETSTRUCT(typetuple))->typoutput; stats->outfunc = ((Form_pg_type) GETSTRUCT(typetuple))->typoutput;
else else
stats->outfunc = InvalidOid; stats->outfunc = InvalidOid;
} }
@ -975,7 +975,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
if (Irel != (Relation *) NULL) /* preparation for index' inserts */ if (Irel != (Relation *) NULL) /* preparation for index' inserts */
{ {
vc_mkindesc(onerel, nindices, Irel, &Idesc); vc_mkindesc(onerel, nindices, Irel, &Idesc);
tupdesc = RelationGetTupleDescriptor(onerel); tupdesc = RelationGetDescr(onerel);
idatum = (Datum *) palloc(INDEX_MAX_KEYS * sizeof(*idatum)); idatum = (Datum *) palloc(INDEX_MAX_KEYS * sizeof(*idatum));
inulls = (char *) palloc(INDEX_MAX_KEYS * sizeof(*inulls)); inulls = (char *) palloc(INDEX_MAX_KEYS * sizeof(*inulls));
} }
@ -1559,14 +1559,14 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
vc_cmp_blk); vc_cmp_blk);
if (vpp == (VPageDescr *) NULL) if (vpp == (VPageDescr *) NULL)
return ((VPageDescr) NULL); return (VPageDescr) NULL;
vp = *vpp; vp = *vpp;
/* ok - we are on true page */ /* ok - we are on true page */
if (vp->vpd_offsets_free == 0) if (vp->vpd_offsets_free == 0)
{ /* this is EmptyPage !!! */ { /* this is EmptyPage !!! */
return (vp); return vp;
} }
voff = (OffsetNumber *) vc_find_eq((char *) (vp->vpd_offsets), voff = (OffsetNumber *) vc_find_eq((char *) (vp->vpd_offsets),
@ -1574,9 +1574,9 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
vc_cmp_offno); vc_cmp_offno);
if (voff == (OffsetNumber *) NULL) if (voff == (OffsetNumber *) NULL)
return ((VPageDescr) NULL); return (VPageDescr) NULL;
return (vp); return vp;
} /* vc_tidreapped */ } /* vc_tidreapped */
@ -1702,7 +1702,7 @@ vc_attrstats(Relation onerel, VRelStats *vacrelstats, HeapTuple tuple)
* *
*/ */
static void static void
vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum *bucket, int16 *bucket_len) vc_bucketcpy(Form_pg_attribute attr, Datum value, Datum *bucket, int16 *bucket_len)
{ {
if (attr->attbyval && attr->attlen != -1) if (attr->attbyval && attr->attlen != -1)
*bucket = value; *bucket = value;
@ -1744,7 +1744,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
stup; stup;
Form_pg_class pgcform; Form_pg_class pgcform;
ScanKeyData askey; ScanKeyData askey;
AttributeTupleForm attp; Form_pg_attribute attp;
Buffer buffer; Buffer buffer;
/* /*
@ -1790,7 +1790,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
Datum values[Natts_pg_statistic]; Datum values[Natts_pg_statistic];
char nulls[Natts_pg_statistic]; char nulls[Natts_pg_statistic];
attp = (AttributeTupleForm) GETSTRUCT(atup); attp = (Form_pg_attribute) GETSTRUCT(atup);
if (attp->attnum <= 0) /* skip system attributes for now, */ if (attp->attnum <= 0) /* skip system attributes for now, */
/* they are unique anyway */ /* they are unique anyway */
continue; continue;
@ -2040,27 +2040,27 @@ vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, cha
{ {
res = compar(bot, elm); res = compar(bot, elm);
if (res > 0) if (res > 0)
return (NULL); return NULL;
if (res == 0) if (res == 0)
return (bot); return bot;
first_move = false; first_move = false;
} }
if (last_move == true) if (last_move == true)
{ {
res = compar(elm, bot + last * size); res = compar(elm, bot + last * size);
if (res > 0) if (res > 0)
return (NULL); return NULL;
if (res == 0) if (res == 0)
return (bot + last * size); return bot + last * size;
last_move = false; last_move = false;
} }
res = compar(elm, bot + celm * size); res = compar(elm, bot + celm * size);
if (res == 0) if (res == 0)
return (bot + celm * size); return bot + celm * size;
if (res < 0) if (res < 0)
{ {
if (celm == 0) if (celm == 0)
return (NULL); return NULL;
last = celm - 1; last = celm - 1;
celm = celm / 2; celm = celm / 2;
last_move = true; last_move = true;
@ -2068,7 +2068,7 @@ vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, cha
} }
if (celm == last) if (celm == last)
return (NULL); return NULL;
last = last - celm - 1; last = last - celm - 1;
bot = bot + (celm + 1) * size; bot = bot + (celm + 1) * size;
@ -2088,10 +2088,10 @@ vc_cmp_blk(char *left, char *right)
rblk = (*((VPageDescr *) right))->vpd_blkno; rblk = (*((VPageDescr *) right))->vpd_blkno;
if (lblk < rblk) if (lblk < rblk)
return (-1); return -1;
if (lblk == rblk) if (lblk == rblk)
return (0); return 0;
return (1); return 1;
} /* vc_cmp_blk */ } /* vc_cmp_blk */
@ -2100,10 +2100,10 @@ vc_cmp_offno(char *left, char *right)
{ {
if (*(OffsetNumber *) left < *(OffsetNumber *) right) if (*(OffsetNumber *) left < *(OffsetNumber *) right)
return (-1); return -1;
if (*(OffsetNumber *) left == *(OffsetNumber *) right) if (*(OffsetNumber *) left == *(OffsetNumber *) right)
return (0); return 0;
return (1); return 1;
} /* vc_cmp_offno */ } /* vc_cmp_offno */
@ -2129,7 +2129,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
/* prepare a heap scan on the pg_index relation */ /* prepare a heap scan on the pg_index relation */
pgindex = heap_openr(IndexRelationName); pgindex = heap_openr(IndexRelationName);
tupdesc = RelationGetTupleDescriptor(pgindex); tupdesc = RelationGetDescr(pgindex);
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_index_indrelid, ScanKeyEntryInitialize(&key, 0x0, Anum_pg_index_indrelid,
F_OIDEQ, F_OIDEQ,
@ -2217,7 +2217,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
0, 0, 0); 0, 0, 0);
Assert(cachetuple); Assert(cachetuple);
/* we never free the copy we make, because Idesc needs it for later */ /* we never free the copy we make, because Idesc needs it for later */
idcur->tform = (IndexTupleForm) GETSTRUCT(cachetuple); idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple);
for (attnumP = &(idcur->tform->indkey[0]), natts = 0; for (attnumP = &(idcur->tform->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS; *attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS;
attnumP++, natts++); attnumP++, natts++);
@ -2245,15 +2245,15 @@ vc_enough_space(VPageDescr vpd, Size len)
len = DOUBLEALIGN(len); len = DOUBLEALIGN(len);
if (len > vpd->vpd_free) if (len > vpd->vpd_free)
return (false); return false;
if (vpd->vpd_offsets_used < vpd->vpd_offsets_free) /* there are free itemid(s) */ if (vpd->vpd_offsets_used < vpd->vpd_offsets_free) /* there are free itemid(s) */
return (true); /* and len <= free_space */ return true; /* and len <= free_space */
/* ok. noff_usd >= noff_free and so we'll have to allocate new itemid */ /* ok. noff_usd >= noff_free and so we'll have to allocate new itemid */
if (len <= vpd->vpd_free - sizeof(ItemIdData)) if (len <= vpd->vpd_free - sizeof(ItemIdData))
return (true); return true;
return (false); return false;
} /* vc_enough_space */ } /* vc_enough_space */

View File

@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', * Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements. * 'SHOW var' and 'RESET var' statements.
* *
* $Id: variable.c,v 1.10 1998/07/26 04:30:26 scrappy Exp $ * $Id: variable.c,v 1.11 1998/09/01 03:22:10 momjian Exp $
* *
*/ */
@ -73,13 +73,13 @@ get_token(char **tok, char **val, const char *str)
/* end of string? */ /* end of string? */
if (!(*str)) if (!(*str))
{ {
return (str); return str;
/* delimiter? */ /* delimiter? */
} }
else if (*str == ',') else if (*str == ',')
{ {
return (++str); return ++str;
} }
else if ((val == NULL) || (*str != '=')) else if ((val == NULL) || (*str != '='))
@ -117,9 +117,9 @@ get_token(char **tok, char **val, const char *str)
str++; str++;
if (!(*str)) if (!(*str))
return (NULL); return NULL;
if (*str == ',') if (*str == ',')
return (++str); return ++str;
elog(ERROR, "Syntax error near (%s)", str); elog(ERROR, "Syntax error near (%s)", str);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.5 1997/09/08 21:42:55 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.6 1998/09/01 03:22:11 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -222,7 +222,7 @@ FjoinBumpOuterNodes(TargetEntry *tlist,
if (funcIsDone) if (funcIsDone)
{ {
set_fj_initialized(fjNode, false); set_fj_initialized(fjNode, false);
return (true); return true;
} }
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.13 1998/07/20 20:48:50 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.14 1998/09/01 03:22:13 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -244,7 +244,7 @@ ExecInitJunkFilter(List *targetList)
junkfilter->jf_cleanTupType = cleanTupType; junkfilter->jf_cleanTupType = cleanTupType;
junkfilter->jf_cleanMap = cleanMap; junkfilter->jf_cleanMap = cleanMap;
return (junkfilter); return junkfilter;
} }
@ -301,7 +301,7 @@ ExecGetJunkAttribute(JunkFilter *junkfilter,
if (resno == InvalidAttrNumber) if (resno == InvalidAttrNumber)
{ {
/* Ooops! We couldn't find this attribute... */ /* Ooops! We couldn't find this attribute... */
return (false); return false;
} }
/* --------------------- /* ---------------------
@ -414,5 +414,5 @@ ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
pfree(nulls); pfree(nulls);
} }
return (cleanTuple); return cleanTuple;
} }

View File

@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.53 1998/08/19 02:01:59 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.54 1998/09/01 03:22:14 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -839,7 +839,7 @@ ExecutePlan(EState *estate,
/* /*
* Total hack. I'm ignoring any accessor functions for * Total hack. I'm ignoring any accessor functions for
* Relation, RelationTupleForm, NameData. Assuming that * Relation, RelationForm, NameData. Assuming that
* NameData.data has offset 0. * NameData.data has offset 0.
*/ */
case CMD_NOTIFY: case CMD_NOTIFY:
@ -1288,7 +1288,7 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
pfree(econtext); pfree(econtext);
if (repl == NULL) if (repl == NULL)
return (tuple); return tuple;
newtuple = heap_modifytuple(tuple, rel, replValue, replNull, repl); newtuple = heap_modifytuple(tuple, rel, replValue, replNull, repl);
@ -1297,7 +1297,7 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
pfree(replNull); pfree(replNull);
pfree(replValue); pfree(replValue);
return (newtuple); return newtuple;
} }
@ -1346,7 +1346,7 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
pfree(qual); pfree(qual);
if (!res) if (!res)
return (check[i].ccname); return check[i].ccname;
} }
pfree(slot); pfree(slot);
@ -1355,7 +1355,7 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
pfree(rtlist); pfree(rtlist);
pfree(econtext); pfree(econtext);
return ((char *) NULL); return (char *) NULL;
} }
@ -1391,5 +1391,5 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
elog(ERROR, "%s: rejected due to CHECK constraint %s", caller, failed); elog(ERROR, "%s: rejected due to CHECK constraint %s", caller, failed);
} }
return (newtuple); return newtuple;
} }

View File

@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.11 1998/06/15 19:28:19 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.12 1998/09/01 03:22:17 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -123,7 +123,7 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
{ {
result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node); result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
if (result == FALSE) if (result == FALSE)
return (FALSE); return FALSE;
} }
switch (nodeTag(node)) switch (nodeTag(node))
@ -211,7 +211,7 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
{ {
result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node); result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
if (result == FALSE) if (result == FALSE)
return (FALSE); return FALSE;
} }
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.34 1998/08/01 22:12:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.35 1998/09/01 03:22:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -390,7 +390,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
ExecSetParamPlan(prm->execPlan); ExecSetParamPlan(prm->execPlan);
Assert(prm->execPlan == NULL); Assert(prm->execPlan == NULL);
*isNull = prm->isnull; *isNull = prm->isnull;
return (prm->value); return prm->value;
} }
thisParameterName = expression->paramname; thisParameterName = expression->paramname;
@ -487,7 +487,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
tle, tup, isNull); tle, tup, isNull);
return value; return value;
} }
return (paramList->value); return paramList->value;
} }
@ -545,7 +545,7 @@ att_by_num(TupleTableSlot *slot,
AttrNumber attrno, AttrNumber attrno,
bool *isNull) bool *isNull)
{ {
return (GetAttributeByNum(slot, attrno, isNull)); return GetAttributeByNum(slot, attrno, isNull);
} }
#endif #endif
@ -604,7 +604,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
char * char *
att_by_name(TupleTableSlot *slot, char *attname, bool *isNull) att_by_name(TupleTableSlot *slot, char *attname, bool *isNull)
{ {
return (GetAttributeByName(slot, attname, isNull)); return GetAttributeByName(slot, attname, isNull);
} }
#endif #endif
@ -829,7 +829,7 @@ ExecMakeFunctionResult(Node *node,
if (fcache->nullVect[i] == true) if (fcache->nullVect[i] == true)
*isNull = true; *isNull = true;
return ((Datum) fmgr_c(&fcache->func, (FmgrValues *) argV, isNull)); return (Datum) fmgr_c(&fcache->func, (FmgrValues *) argV, isNull);
} }
} }

View File

@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.19 1998/07/15 14:54:29 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.20 1998/09/01 03:22:20 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -869,7 +869,7 @@ ExecCopyTupType(TupleDesc td, int natts)
while (i < natts) while (i < natts)
{ {
newTd[i] = newTd[i] =
(AttributeTupleForm)palloc(sizeof(FormData_pg_attribute)); (Form_pg_attribute)palloc(sizeof(FormData_pg_attribute));
memmove(newTd[i], td[i], sizeof(FormData_pg_attribute)); memmove(newTd[i], td[i], sizeof(FormData_pg_attribute));
i++; i++;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.36 1998/08/20 22:07:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.37 1998/09/01 03:22:21 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -58,7 +58,7 @@
#include "utils/mcxt.h" #include "utils/mcxt.h"
static void static void
ExecGetIndexKeyInfo(IndexTupleForm indexTuple, int *numAttsOutP, ExecGetIndexKeyInfo(Form_pg_index indexTuple, int *numAttsOutP,
AttrNumber **attsOutP, FuncIndexInfoPtr fInfoP); AttrNumber **attsOutP, FuncIndexInfoPtr fInfoP);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -484,7 +484,7 @@ ExecSetTypeInfo(int index,
bool attbyVal, bool attbyVal,
char attalign) char attalign)
{ {
AttributeTupleForm att; Form_pg_attribute att;
/* ---------------- /* ----------------
* get attribute pointer and preform a sanity check.. * get attribute pointer and preform a sanity check..
@ -600,7 +600,7 @@ QueryDescGetTypeInfo(QueryDesc *queryDesc)
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
static void static void
ExecGetIndexKeyInfo(IndexTupleForm indexTuple, ExecGetIndexKeyInfo(Form_pg_index indexTuple,
int *numAttsOutP, int *numAttsOutP,
AttrNumber **attsOutP, AttrNumber **attsOutP,
FuncIndexInfoPtr fInfoP) FuncIndexInfoPtr fInfoP)
@ -706,7 +706,7 @@ ExecOpenIndices(Oid resultRelationOid,
HeapScanDesc indexSd; HeapScanDesc indexSd;
ScanKeyData key; ScanKeyData key;
HeapTuple tuple; HeapTuple tuple;
IndexTupleForm indexStruct; Form_pg_index indexStruct;
Oid indexOid; Oid indexOid;
List *oidList; List *oidList;
List *nkeyList; List *nkeyList;
@ -770,7 +770,7 @@ ExecOpenIndices(Oid resultRelationOid,
* first get the oid of the index relation from the tuple * first get the oid of the index relation from the tuple
* ---------------- * ----------------
*/ */
indexStruct = (IndexTupleForm) GETSTRUCT(tuple); indexStruct = (Form_pg_index) GETSTRUCT(tuple);
indexOid = indexStruct->indexrelid; indexOid = indexStruct->indexrelid;
/* ---------------- /* ----------------
@ -1005,8 +1005,8 @@ ExecFormIndexTuple(HeapTuple heapTuple,
* how to form the index tuples.. * how to form the index tuples..
* ---------------- * ----------------
*/ */
heapDescriptor = RelationGetTupleDescriptor(heapRelation); heapDescriptor = RelationGetDescr(heapRelation);
indexDescriptor = RelationGetTupleDescriptor(indexRelation); indexDescriptor = RelationGetDescr(indexRelation);
/* ---------------- /* ----------------
* FormIndexDatum fills in its datum and null parameters * FormIndexDatum fills in its datum and null parameters
@ -1124,7 +1124,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
fInfoP = indexInfo->ii_FuncIndexInfo; fInfoP = indexInfo->ii_FuncIndexInfo;
datum = (Datum *) palloc(numberOfAttributes * sizeof *datum); datum = (Datum *) palloc(numberOfAttributes * sizeof *datum);
nulls = (char *) palloc(numberOfAttributes * sizeof *nulls); nulls = (char *) palloc(numberOfAttributes * sizeof *nulls);
heapDescriptor = (TupleDesc) RelationGetTupleDescriptor(heapRelation); heapDescriptor = (TupleDesc) RelationGetDescr(heapRelation);
FormIndexDatum(numberOfAttributes, /* num attributes */ FormIndexDatum(numberOfAttributes, /* num attributes */
keyAttributeNumbers, /* array of att nums to keyAttributeNumbers, /* array of att nums to

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.18 1998/08/24 01:37:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.19 1998/09/01 03:22:22 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -276,7 +276,7 @@ copy_function_result(FunctionCachePtr fcache,
while (i < oldTuple->t_natts) while (i < oldTuple->t_natts)
{ {
funcTd->attrs[i] = funcTd->attrs[i] =
(AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove(funcTd->attrs[i], memmove(funcTd->attrs[i],
resultTd->attrs[i], resultTd->attrs[i],
ATTRIBUTE_TUPLE_SIZE); ATTRIBUTE_TUPLE_SIZE);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.21 1998/06/15 19:28:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.22 1998/09/01 03:22:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -438,7 +438,7 @@ ExecHashTableCreate(Hash *node)
bucket->firstotuple = bucket->lastotuple = -1; bucket->firstotuple = bucket->lastotuple = -1;
bucket = (HashBucket) LONGALIGN(((char *) bucket + bucketsize)); bucket = (HashBucket) LONGALIGN(((char *) bucket + bucketsize));
} }
return (hashtable); return hashtable;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -586,7 +586,7 @@ ExecHashGetBucket(HashJoinTable hashtable,
printf("hash(%d) = %d\n", keyval, bucketno); printf("hash(%d) = %d\n", keyval, bucketno);
#endif #endif
return (bucketno); return bucketno;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -810,7 +810,7 @@ hashFunc(char *key, int len)
h = h * PRIME1 ^ (*k++); h = h * PRIME1 ^ (*k++);
h %= PRIME2; h %= PRIME2;
return (h); return h;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.11 1998/02/26 04:31:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.12 1998/09/01 03:22:25 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -155,7 +155,7 @@ ExecHashJoin(HashJoin *node)
node->hashdone = true; node->hashdone = true;
} }
else if (hashtable == NULL) else if (hashtable == NULL)
return (NULL); return NULL;
nbatch = hashtable->nbatch; nbatch = hashtable->nbatch;
outerbatches = hjstate->hj_OuterBatches; outerbatches = hjstate->hj_OuterBatches;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.25 1998/08/19 15:47:36 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.26 1998/09/01 03:22:26 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -954,7 +954,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* get the scan type from the relation descriptor. * get the scan type from the relation descriptor.
* ---------------- * ----------------
*/ */
ExecAssignScanType(scanstate, RelationGetTupleDescriptor(currentRelation)); ExecAssignScanType(scanstate, RelationGetDescr(currentRelation));
ExecAssignResultTypeFromTL((Plan *) node, &scanstate->cstate); ExecAssignResultTypeFromTL((Plan *) node, &scanstate->cstate);
/* ---------------- /* ----------------

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.15 1998/08/19 02:02:03 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.16 1998/09/01 03:22:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -145,7 +145,7 @@ ExecMaterial(Material *node)
matstate->csstate.css_currentScanDesc = currentScanDesc; matstate->csstate.css_currentScanDesc = currentScanDesc;
ExecAssignScanType(&matstate->csstate, ExecAssignScanType(&matstate->csstate,
RelationGetTupleDescriptor(currentRelation)); RelationGetDescr(currentRelation));
/* ---------------- /* ----------------
* finally set the sorted flag to true * finally set the sorted flag to true

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.12 1998/08/19 02:02:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.13 1998/09/01 03:22:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -185,7 +185,7 @@ InitScanRelation(SeqScan *node, EState *estate,
scanstate->css_currentScanDesc = currentScanDesc; scanstate->css_currentScanDesc = currentScanDesc;
ExecAssignScanType(scanstate, ExecAssignScanType(scanstate,
RelationGetTupleDescriptor(currentRelation)); RelationGetDescr(currentRelation));
} }
else else
{ {

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.15 1998/06/15 19:28:23 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.16 1998/09/01 03:22:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -192,7 +192,7 @@ ExecSort(Sort *node)
*/ */
heapTuple = psort_grabtuple(node, &should_free); heapTuple = psort_grabtuple(node, &should_free);
return (ExecStoreTuple(heapTuple, slot, InvalidBuffer, should_free)); return ExecStoreTuple(heapTuple, slot, InvalidBuffer, should_free);
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------

View File

@ -67,11 +67,11 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
if (sublink->subLinkType == EXPR_SUBLINK && found) if (sublink->subLinkType == EXPR_SUBLINK && found)
{ {
elog(ERROR, "ExecSubPlan: more than one tuple returned by expression subselect"); elog(ERROR, "ExecSubPlan: more than one tuple returned by expression subselect");
return ((Datum) false); return (Datum) false;
} }
if (sublink->subLinkType == EXISTS_SUBLINK) if (sublink->subLinkType == EXISTS_SUBLINK)
return ((Datum) true); return (Datum) true;
found = true; found = true;
@ -96,9 +96,9 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
} }
if (!found && sublink->subLinkType == ALL_SUBLINK) if (!found && sublink->subLinkType == ALL_SUBLINK)
return ((Datum) true); return (Datum) true;
return ((Datum) result); return (Datum) result;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@ -123,7 +123,7 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
sp_estate->es_refcount = estate->es_refcount; sp_estate->es_refcount = estate->es_refcount;
if (!ExecInitNode(node->plan, sp_estate, NULL)) if (!ExecInitNode(node->plan, sp_estate, NULL))
return (false); return false;
node->shutdown = true; node->shutdown = true;
@ -149,7 +149,7 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
*/ */
} }
return (true); return true;
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------

View File

@ -15,7 +15,7 @@
* ExecEndTee * ExecEndTee
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.21 1998/08/19 02:02:06 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.22 1998/09/01 03:22:32 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -402,7 +402,7 @@ ExecTee(Tee *node, Plan *parent)
IncrBufferRefCount(scanDesc->rs_cbuf); IncrBufferRefCount(scanDesc->rs_cbuf);
slot = teeState->cstate.cs_ResultTupleSlot; slot = teeState->cstate.cs_ResultTupleSlot;
slot->ttc_tupleDescriptor = RelationGetTupleDescriptor(bufferRel); slot->ttc_tupleDescriptor = RelationGetDescr(bufferRel);
result = ExecStoreTuple(heapTuple, /* tuple to store */ result = ExecStoreTuple(heapTuple, /* tuple to store */
slot, /* slot to store in */ slot, /* slot to store in */

View File

@ -102,7 +102,7 @@ SPI_connect()
* to _SPI_connected * to _SPI_connected
*/ */
if (_SPI_curid != _SPI_connected) if (_SPI_curid != _SPI_connected)
return (SPI_ERROR_CONNECT); return SPI_ERROR_CONNECT;
if (_SPI_stack == NULL) if (_SPI_stack == NULL)
{ {
@ -141,7 +141,7 @@ SPI_connect()
_SPI_current->savedId = GetScanCommandId(); _SPI_current->savedId = GetScanCommandId();
SetScanCommandId(GetCurrentCommandId()); SetScanCommandId(GetCurrentCommandId());
return (SPI_OK_CONNECT); return SPI_OK_CONNECT;
} }
@ -152,7 +152,7 @@ SPI_finish()
res = _SPI_begin_call(false); /* live in procedure memory */ res = _SPI_begin_call(false); /* live in procedure memory */
if (res < 0) if (res < 0)
return (res); return res;
/* Restore memory context as it was before procedure call */ /* Restore memory context as it was before procedure call */
MemoryContextSwitchTo(_SPI_current->savedcxt); MemoryContextSwitchTo(_SPI_current->savedcxt);
@ -179,7 +179,7 @@ SPI_finish()
_SPI_current = &(_SPI_stack[_SPI_connected]); _SPI_current = &(_SPI_stack[_SPI_connected]);
} }
return (SPI_OK_FINISH); return SPI_OK_FINISH;
} }
@ -189,16 +189,16 @@ SPI_exec(char *src, int tcount)
int res; int res;
if (src == NULL || tcount < 0) if (src == NULL || tcount < 0)
return (SPI_ERROR_ARGUMENT); return SPI_ERROR_ARGUMENT;
res = _SPI_begin_call(true); res = _SPI_begin_call(true);
if (res < 0) if (res < 0)
return (res); return res;
res = _SPI_execute(src, tcount, NULL); res = _SPI_execute(src, tcount, NULL);
_SPI_end_call(true); _SPI_end_call(true);
return (res); return res;
} }
int int
@ -207,14 +207,14 @@ SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
int res; int res;
if (plan == NULL || tcount < 0) if (plan == NULL || tcount < 0)
return (SPI_ERROR_ARGUMENT); return SPI_ERROR_ARGUMENT;
if (((_SPI_plan *) plan)->nargs > 0 && Values == NULL) if (((_SPI_plan *) plan)->nargs > 0 && Values == NULL)
return (SPI_ERROR_PARAM); return SPI_ERROR_PARAM;
res = _SPI_begin_call(true); res = _SPI_begin_call(true);
if (res < 0) if (res < 0)
return (res); return res;
/* copy plan to current (executor) context */ /* copy plan to current (executor) context */
plan = (void *) _SPI_copy_plan(plan, _SPI_CPLAN_CURCXT); plan = (void *) _SPI_copy_plan(plan, _SPI_CPLAN_CURCXT);
@ -222,7 +222,7 @@ SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
res = _SPI_execute_plan((_SPI_plan *) plan, Values, Nulls, tcount); res = _SPI_execute_plan((_SPI_plan *) plan, Values, Nulls, tcount);
_SPI_end_call(true); _SPI_end_call(true);
return (res); return res;
} }
void * void *
@ -233,12 +233,12 @@ SPI_prepare(char *src, int nargs, Oid *argtypes)
if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL)) if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL))
{ {
SPI_result = SPI_ERROR_ARGUMENT; SPI_result = SPI_ERROR_ARGUMENT;
return (NULL); return NULL;
} }
SPI_result = _SPI_begin_call(true); SPI_result = _SPI_begin_call(true);
if (SPI_result < 0) if (SPI_result < 0)
return (NULL); return NULL;
plan = (_SPI_plan *) palloc(sizeof(_SPI_plan)); /* Executor context */ plan = (_SPI_plan *) palloc(sizeof(_SPI_plan)); /* Executor context */
plan->argtypes = argtypes; plan->argtypes = argtypes;
@ -253,7 +253,7 @@ SPI_prepare(char *src, int nargs, Oid *argtypes)
_SPI_end_call(true); _SPI_end_call(true);
return ((void *) plan); return (void *) plan;
} }
@ -265,19 +265,19 @@ SPI_saveplan(void *plan)
if (plan == NULL) if (plan == NULL)
{ {
SPI_result = SPI_ERROR_ARGUMENT; SPI_result = SPI_ERROR_ARGUMENT;
return (NULL); return NULL;
} }
SPI_result = _SPI_begin_call(false); /* don't change context */ SPI_result = _SPI_begin_call(false); /* don't change context */
if (SPI_result < 0) if (SPI_result < 0)
return (NULL); return NULL;
newplan = _SPI_copy_plan((_SPI_plan *) plan, _SPI_CPLAN_TOPCXT); newplan = _SPI_copy_plan((_SPI_plan *) plan, _SPI_CPLAN_TOPCXT);
_SPI_curid--; _SPI_curid--;
SPI_result = 0; SPI_result = 0;
return ((void *) newplan); return (void *) newplan;
} }
@ -290,7 +290,7 @@ SPI_copytuple(HeapTuple tuple)
if (tuple == NULL) if (tuple == NULL)
{ {
SPI_result = SPI_ERROR_ARGUMENT; SPI_result = SPI_ERROR_ARGUMENT;
return (NULL); return NULL;
} }
if (_SPI_curid + 1 == _SPI_connected) /* connected */ if (_SPI_curid + 1 == _SPI_connected) /* connected */
@ -305,7 +305,7 @@ SPI_copytuple(HeapTuple tuple)
if (oldcxt) if (oldcxt)
MemoryContextSwitchTo(oldcxt); MemoryContextSwitchTo(oldcxt);
return (ctuple); return ctuple;
} }
HeapTuple HeapTuple
@ -324,7 +324,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
if (rel == NULL || tuple == NULL || natts <= 0 || attnum == NULL || Values == NULL) if (rel == NULL || tuple == NULL || natts <= 0 || attnum == NULL || Values == NULL)
{ {
SPI_result = SPI_ERROR_ARGUMENT; SPI_result = SPI_ERROR_ARGUMENT;
return (NULL); return NULL;
} }
if (_SPI_curid + 1 == _SPI_connected) /* connected */ if (_SPI_curid + 1 == _SPI_connected) /* connected */
@ -354,7 +354,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
n[attnum[i] - 1] = (Nulls && Nulls[i] == 'n') ? 'n' : ' '; n[attnum[i] - 1] = (Nulls && Nulls[i] == 'n') ? 'n' : ' ';
} }
if (i == natts) /* no errors in attnum[] */ if (i == natts) /* no errors in *attnum */
{ {
mtuple = heap_formtuple(rel->rd_att, v, n); mtuple = heap_formtuple(rel->rd_att, v, n);
infomask = mtuple->t_infomask; infomask = mtuple->t_infomask;
@ -375,7 +375,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
if (oldcxt) if (oldcxt)
MemoryContextSwitchTo(oldcxt); MemoryContextSwitchTo(oldcxt);
return (mtuple); return mtuple;
} }
int int
@ -386,10 +386,10 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
for (res = 0; res < tupdesc->natts; res++) for (res = 0; res < tupdesc->natts; res++)
{ {
if (strcasecmp(tupdesc->attrs[res]->attname.data, fname) == 0) if (strcasecmp(tupdesc->attrs[res]->attname.data, fname) == 0)
return (res + 1); return res + 1;
} }
return (SPI_ERROR_NOATTRIBUTE); return SPI_ERROR_NOATTRIBUTE;
} }
char * char *
@ -400,10 +400,10 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
if (tupdesc->natts < fnumber || fnumber <= 0) if (tupdesc->natts < fnumber || fnumber <= 0)
{ {
SPI_result = SPI_ERROR_NOATTRIBUTE; SPI_result = SPI_ERROR_NOATTRIBUTE;
return (NULL); return NULL;
} }
return (nameout(&(tupdesc->attrs[fnumber - 1]->attname))); return nameout(&(tupdesc->attrs[fnumber - 1]->attname));
} }
char * char *
@ -417,17 +417,17 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
if (tuple->t_natts < fnumber || fnumber <= 0) if (tuple->t_natts < fnumber || fnumber <= 0)
{ {
SPI_result = SPI_ERROR_NOATTRIBUTE; SPI_result = SPI_ERROR_NOATTRIBUTE;
return (NULL); return NULL;
} }
val = heap_getattr(tuple, fnumber, tupdesc, &isnull); val = heap_getattr(tuple, fnumber, tupdesc, &isnull);
if (isnull) if (isnull)
return (NULL); return NULL;
foutoid = typtoout((Oid) tupdesc->attrs[fnumber - 1]->atttypid); foutoid = typtoout((Oid) tupdesc->attrs[fnumber - 1]->atttypid);
if (!OidIsValid(foutoid)) if (!OidIsValid(foutoid))
{ {
SPI_result = SPI_ERROR_NOOUTFUNC; SPI_result = SPI_ERROR_NOOUTFUNC;
return (NULL); return NULL;
} }
return (fmgr(foutoid, val, return (fmgr(foutoid, val,
@ -445,12 +445,12 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
if (tuple->t_natts < fnumber || fnumber <= 0) if (tuple->t_natts < fnumber || fnumber <= 0)
{ {
SPI_result = SPI_ERROR_NOATTRIBUTE; SPI_result = SPI_ERROR_NOATTRIBUTE;
return ((Datum) NULL); return (Datum) NULL;
} }
val = heap_getattr(tuple, fnumber, tupdesc, isnull); val = heap_getattr(tuple, fnumber, tupdesc, isnull);
return (val); return val;
} }
char * char *
@ -462,7 +462,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
if (tupdesc->natts < fnumber || fnumber <= 0) if (tupdesc->natts < fnumber || fnumber <= 0)
{ {
SPI_result = SPI_ERROR_NOATTRIBUTE; SPI_result = SPI_ERROR_NOATTRIBUTE;
return (NULL); return NULL;
} }
typeTuple = SearchSysCacheTuple(TYPOID, typeTuple = SearchSysCacheTuple(TYPOID,
@ -472,10 +472,10 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
{ {
SPI_result = SPI_ERROR_TYPUNKNOWN; SPI_result = SPI_ERROR_TYPUNKNOWN;
return (NULL); return NULL;
} }
return (pstrdup(((TypeTupleForm) GETSTRUCT(typeTuple))->typname.data)); return pstrdup(((Form_pg_type) GETSTRUCT(typeTuple))->typname.data);
} }
Oid Oid
@ -486,16 +486,16 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
if (tupdesc->natts < fnumber || fnumber <= 0) if (tupdesc->natts < fnumber || fnumber <= 0)
{ {
SPI_result = SPI_ERROR_NOATTRIBUTE; SPI_result = SPI_ERROR_NOATTRIBUTE;
return (InvalidOid); return InvalidOid;
} }
return (tupdesc->attrs[fnumber - 1]->atttypid); return tupdesc->attrs[fnumber - 1]->atttypid;
} }
char * char *
SPI_getrelname(Relation rel) SPI_getrelname(Relation rel)
{ {
return (pstrdup(rel->rd_rel->relname.data)); return pstrdup(rel->rd_rel->relname.data);
} }
void * void *
@ -516,7 +516,7 @@ SPI_palloc(Size size)
if (oldcxt) if (oldcxt)
MemoryContextSwitchTo(oldcxt); MemoryContextSwitchTo(oldcxt);
return (pointer); return pointer;
} }
void * void *
@ -536,7 +536,7 @@ SPI_repalloc(void *pointer, Size size)
if (oldcxt) if (oldcxt)
MemoryContextSwitchTo(oldcxt); MemoryContextSwitchTo(oldcxt);
return (pointer); return pointer;
} }
void void
@ -661,13 +661,13 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan)
CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt); CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt);
if (stmt->filename == NULL) if (stmt->filename == NULL)
return (SPI_ERROR_COPY); return SPI_ERROR_COPY;
} }
else if (nodeTag(queryTree->utilityStmt) == T_ClosePortalStmt || else if (nodeTag(queryTree->utilityStmt) == T_ClosePortalStmt ||
nodeTag(queryTree->utilityStmt) == T_FetchStmt) nodeTag(queryTree->utilityStmt) == T_FetchStmt)
return (SPI_ERROR_CURSOR); return SPI_ERROR_CURSOR;
else if (nodeTag(queryTree->utilityStmt) == T_TransactionStmt) else if (nodeTag(queryTree->utilityStmt) == T_TransactionStmt)
return (SPI_ERROR_TRANSACTION); return SPI_ERROR_TRANSACTION;
res = SPI_OK_UTILITY; res = SPI_OK_UTILITY;
if (plan == NULL) if (plan == NULL)
{ {
@ -675,7 +675,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan)
if (i < qlen - 1) if (i < qlen - 1)
CommandCounterIncrement(); CommandCounterIncrement();
else else
return (res); return res;
} }
else if (i >= qlen - 1) else if (i >= qlen - 1)
break; break;
@ -687,7 +687,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan)
state = CreateExecutorState(); state = CreateExecutorState();
res = _SPI_pquery(qdesc, state, (i < qlen - 1) ? 0 : tcount); res = _SPI_pquery(qdesc, state, (i < qlen - 1) ? 0 : tcount);
if (res < 0 || i >= qlen - 1) if (res < 0 || i >= qlen - 1)
return (res); return res;
CommandCounterIncrement(); CommandCounterIncrement();
} }
else else
@ -696,7 +696,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan)
(i < qlen - 1) ? None : SPI); (i < qlen - 1) ? None : SPI);
res = _SPI_pquery(qdesc, NULL, (i < qlen - 1) ? 0 : tcount); res = _SPI_pquery(qdesc, NULL, (i < qlen - 1) ? 0 : tcount);
if (res < 0) if (res < 0)
return (res); return res;
if (i >= qlen - 1) if (i >= qlen - 1)
break; break;
} }
@ -705,7 +705,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan)
plan->qtlist = queryTree_list; plan->qtlist = queryTree_list;
plan->ptlist = ptlist; plan->ptlist = ptlist;
return (res); return res;
} }
@ -745,7 +745,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
if (i < qlen - 1) if (i < qlen - 1)
CommandCounterIncrement(); CommandCounterIncrement();
else else
return (SPI_OK_UTILITY); return SPI_OK_UTILITY;
} }
else else
{ {
@ -771,12 +771,12 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
state->es_param_list_info = NULL; state->es_param_list_info = NULL;
res = _SPI_pquery(qdesc, state, (i < qlen - 1) ? 0 : tcount); res = _SPI_pquery(qdesc, state, (i < qlen - 1) ? 0 : tcount);
if (res < 0 || i >= qlen - 1) if (res < 0 || i >= qlen - 1)
return (res); return res;
CommandCounterIncrement(); CommandCounterIncrement();
} }
} }
return (res); return res;
} }
@ -803,7 +803,7 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
intoName = parseTree->into; intoName = parseTree->into;
parseTree->isBinary = false; /* */ parseTree->isBinary = false; /* */
return (SPI_ERROR_CURSOR); return SPI_ERROR_CURSOR;
} }
else if (parseTree->into != NULL) /* select into table */ else if (parseTree->into != NULL) /* select into table */
@ -823,11 +823,11 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
res = SPI_OK_UPDATE; res = SPI_OK_UPDATE;
break; break;
default: default:
return (SPI_ERROR_OPUNKNOWN); return SPI_ERROR_OPUNKNOWN;
} }
if (state == NULL) /* plan preparation */ if (state == NULL) /* plan preparation */
return (res); return res;
#ifdef SPI_EXECUTOR_STATS #ifdef SPI_EXECUTOR_STATS
if (ShowExecutorStats) if (ShowExecutorStats)
ResetUsage(); ResetUsage();
@ -843,7 +843,7 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
state, state,
tupdesc, tupdesc,
None); None);
return (SPI_OK_CURSOR); return SPI_OK_CURSOR;
} }
ExecutorRun(queryDesc, state, EXEC_FOR, tcount); ExecutorRun(queryDesc, state, EXEC_FOR, tcount);
@ -872,7 +872,7 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
} }
queryDesc->dest = dest; queryDesc->dest = dest;
return (res); return res;
} }
@ -925,7 +925,7 @@ _SPI_execmem()
phmem = PortalGetHeapMemory(_SPI_current->portal); phmem = PortalGetHeapMemory(_SPI_current->portal);
oldcxt = MemoryContextSwitchTo((MemoryContext) phmem); oldcxt = MemoryContextSwitchTo((MemoryContext) phmem);
return (oldcxt); return oldcxt;
} }
@ -938,7 +938,7 @@ _SPI_procmem()
pvmem = PortalGetVariableMemory(_SPI_current->portal); pvmem = PortalGetVariableMemory(_SPI_current->portal);
oldcxt = MemoryContextSwitchTo((MemoryContext) pvmem); oldcxt = MemoryContextSwitchTo((MemoryContext) pvmem);
return (oldcxt); return oldcxt;
} }
@ -950,7 +950,7 @@ static int
_SPI_begin_call(bool execmem) _SPI_begin_call(bool execmem)
{ {
if (_SPI_curid + 1 != _SPI_connected) if (_SPI_curid + 1 != _SPI_connected)
return (SPI_ERROR_UNCONNECTED); return SPI_ERROR_UNCONNECTED;
_SPI_curid++; _SPI_curid++;
if (_SPI_current != &(_SPI_stack[_SPI_curid])) if (_SPI_current != &(_SPI_stack[_SPI_curid]))
elog(FATAL, "SPI: stack corrupted"); elog(FATAL, "SPI: stack corrupted");
@ -961,7 +961,7 @@ _SPI_begin_call(bool execmem)
StartPortalAllocMode(DefaultAllocMode, 0); StartPortalAllocMode(DefaultAllocMode, 0);
} }
return (0); return 0;
} }
static int static int
@ -986,7 +986,7 @@ _SPI_end_call(bool procmem)
_SPI_procmem(); _SPI_procmem();
} }
return (0); return 0;
} }
static bool static bool
@ -1010,7 +1010,7 @@ _SPI_checktuples()
failed = true; failed = true;
} }
return (failed); return failed;
} }
static _SPI_plan * static _SPI_plan *
@ -1048,5 +1048,5 @@ _SPI_copy_plan(_SPI_plan *plan, int location)
if (location != _SPI_CPLAN_CURCXT) if (location != _SPI_CPLAN_CURCXT)
MemoryContextSwitchTo(oldcxt); MemoryContextSwitchTo(oldcxt);
return (newplan); return newplan;
} }

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.10 1998/06/15 19:28:23 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.11 1998/09/01 03:22:35 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -64,7 +64,7 @@ DLFreeElem(Dlelem *e)
Dlelem * Dlelem *
DLGetHead(Dllist *l) DLGetHead(Dllist *l)
{ {
return (l ? l->dll_head : 0); return l ? l->dll_head : 0;
} }
/* get the value stored in the first element */ /* get the value stored in the first element */
@ -74,7 +74,7 @@ DLGetHeadVal(Dllist *l)
{ {
Dlelem *e = DLGetHead(l); Dlelem *e = DLGetHead(l);
return (e ? e->dle_val : 0); return e ? e->dle_val : 0;
} }
#endif #endif
@ -82,7 +82,7 @@ DLGetHeadVal(Dllist *l)
Dlelem * Dlelem *
DLGetTail(Dllist *l) DLGetTail(Dllist *l)
{ {
return (l ? l->dll_tail : 0); return l ? l->dll_tail : 0;
} }
/* get the value stored in the first element */ /* get the value stored in the first element */
@ -92,7 +92,7 @@ DLGetTailVal(Dllist *l)
{ {
Dlelem *e = DLGetTail(l); Dlelem *e = DLGetTail(l);
return (e ? e->dle_val : 0); return e ? e->dle_val : 0;
} }
#endif #endif
@ -100,13 +100,13 @@ DLGetTailVal(Dllist *l)
Dlelem * Dlelem *
DLGetPred(Dlelem *e) /* get predecessor */ DLGetPred(Dlelem *e) /* get predecessor */
{ {
return (e ? e->dle_prev : 0); return e ? e->dle_prev : 0;
} }
Dlelem * Dlelem *
DLGetSucc(Dlelem *e) /* get successor */ DLGetSucc(Dlelem *e) /* get successor */
{ {
return (e ? e->dle_next : 0); return e ? e->dle_next : 0;
} }
void void

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/fstack.c,v 1.8 1998/06/15 19:28:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/fstack.c,v 1.9 1998/09/01 03:22:37 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -62,12 +62,12 @@ FixedStackPop(FixedStack stack)
AssertArg(FixedStackIsValid(stack)); AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top)) if (!PointerIsValid(stack->top))
return (NULL); return NULL;
pointer = FixedStackGetItemBase(stack, stack->top); pointer = FixedStackGetItemBase(stack, stack->top);
stack->top = stack->top->next; stack->top = stack->top->next;
return (pointer); return pointer;
} }
void void
@ -108,9 +108,9 @@ FixedStackContains(FixedStack stack, Pointer pointer)
for (next = stack->top; FixedItemIsValid(next); next = next->next) for (next = stack->top; FixedItemIsValid(next); next = next->next)
{ {
if (next == item) if (next == item)
return (true); return true;
} }
return (false); return false;
} }
#endif #endif
@ -121,9 +121,9 @@ FixedStackGetTop(FixedStack stack)
AssertArg(FixedStackIsValid(stack)); AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top)) if (!PointerIsValid(stack->top))
return (NULL); return NULL;
return (FixedStackGetItemBase(stack, stack->top)); return FixedStackGetItemBase(stack, stack->top);
} }
Pointer Pointer
@ -138,7 +138,7 @@ FixedStackGetNext(FixedStack stack, Pointer pointer)
item = FixedStackGetItem(stack, pointer)->next; item = FixedStackGetItem(stack, pointer)->next;
if (!PointerIsValid(item)) if (!PointerIsValid(item))
return (NULL); return NULL;
return (FixedStackGetItemBase(stack, item)); return FixedStackGetItemBase(stack, item);
} }

View File

@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.8 1998/02/26 04:31:39 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.9 1998/09/01 03:22:38 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -42,7 +42,7 @@ lisp_qsort(List *the_list, /* the list to be sorted */
/* find size of list */ /* find size of list */
num = length(the_list); num = length(the_list);
if (num < 2) if (num < 2)
return (copyObject(the_list)); return copyObject(the_list);
/* copy elements of the list into an array */ /* copy elements of the list into an array */
nodearray = (List **) palloc(num * sizeof(List *)); nodearray = (List **) palloc(num * sizeof(List *));
@ -58,7 +58,7 @@ lisp_qsort(List *the_list, /* the list to be sorted */
for (i = num - 1; i >= 0; i--) for (i = num - 1; i >= 0; i--)
output = lcons(nodearray[i], output); output = lcons(nodearray[i], output);
return (output); return output;
} }
#endif #endif

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.10 1998/06/15 19:28:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.11 1998/09/01 03:22:39 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -54,7 +54,7 @@ makeStringInfo()
*/ */
res->data[0] = '\0'; res->data[0] = '\0';
return (res); return res;
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.29 1998/07/09 03:28:45 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.30 1998/09/01 03:22:41 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -103,7 +103,7 @@ pg_krb4_recvauth(Port *port)
krb_err_txt[status]); krb_err_txt[status]);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
if (strncmp(version, PG_KRB4_VERSION, KRB_SENDAUTH_VLEN)) if (strncmp(version, PG_KRB4_VERSION, KRB_SENDAUTH_VLEN))
{ {
@ -112,7 +112,7 @@ pg_krb4_recvauth(Port *port)
PG_KRB4_VERSION); PG_KRB4_VERSION);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
if (strncmp(port->user, auth_data.pname, SM_USER)) if (strncmp(port->user, auth_data.pname, SM_USER))
{ {
@ -122,9 +122,9 @@ pg_krb4_recvauth(Port *port)
auth_data.pname); auth_data.pname);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
return (STATUS_OK); return STATUS_OK;
} }
#else #else
@ -137,7 +137,7 @@ pg_krb4_recvauth(Port *port)
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
#endif /* KRB4 */ #endif /* KRB4 */
@ -174,7 +174,7 @@ pg_an_to_ln(char *aname)
if ((p = strchr(aname, '/')) || (p = strchr(aname, '@'))) if ((p = strchr(aname, '/')) || (p = strchr(aname, '@')))
*p = '\0'; *p = '\0';
return (aname); return aname;
} }
/* /*
@ -230,7 +230,7 @@ pg_krb5_recvauth(Port *port)
"pg_krb5_recvauth: Kerberos error %d in krb5_parse_name\n", "pg_krb5_recvauth: Kerberos error %d in krb5_parse_name\n",
code); code);
com_err("pg_krb5_recvauth", code, "in krb5_parse_name"); com_err("pg_krb5_recvauth", code, "in krb5_parse_name");
return (STATUS_ERROR); return STATUS_ERROR;
} }
/* /*
@ -265,7 +265,7 @@ pg_krb5_recvauth(Port *port)
code); code);
com_err("pg_krb5_recvauth", code, "in krb5_recvauth"); com_err("pg_krb5_recvauth", code, "in krb5_recvauth");
krb5_free_principal(server); krb5_free_principal(server);
return (STATUS_ERROR); return STATUS_ERROR;
} }
krb5_free_principal(server); krb5_free_principal(server);
@ -281,7 +281,7 @@ pg_krb5_recvauth(Port *port)
code); code);
com_err("pg_krb5_recvauth", code, "in krb5_unparse_name"); com_err("pg_krb5_recvauth", code, "in krb5_unparse_name");
krb5_free_principal(client); krb5_free_principal(client);
return (STATUS_ERROR); return STATUS_ERROR;
} }
krb5_free_principal(client); krb5_free_principal(client);
if (!kusername) if (!kusername)
@ -290,7 +290,7 @@ pg_krb5_recvauth(Port *port)
"pg_krb5_recvauth: could not decode username\n"); "pg_krb5_recvauth: could not decode username\n");
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
kusername = pg_an_to_ln(kusername); kusername = pg_an_to_ln(kusername);
if (strncmp(username, kusername, SM_USER)) if (strncmp(username, kusername, SM_USER))
@ -301,10 +301,10 @@ pg_krb5_recvauth(Port *port)
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
pfree(kusername); pfree(kusername);
return (STATUS_ERROR); return STATUS_ERROR;
} }
pfree(kusername); pfree(kusername);
return (STATUS_OK); return STATUS_OK;
} }
#else #else
@ -317,7 +317,7 @@ pg_krb5_recvauth(Port *port)
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
#endif /* KRB5 */ #endif /* KRB5 */
@ -394,7 +394,7 @@ pg_passwordv0_recvauth(void *arg, PacketLen len, void *pkt)
auth_failed(port); auth_failed(port);
} }
return (STATUS_OK); /* don't close the connection yet */ return STATUS_OK; /* don't close the connection yet */
} }
@ -628,7 +628,7 @@ readPasswordPacket(void *arg, PacketLen len, void *pkt)
else else
sendAuthRequest(port, AUTH_REQ_OK, handle_done_auth); sendAuthRequest(port, AUTH_REQ_OK, handle_done_auth);
return (STATUS_OK); /* don't close the connection yet */ return STATUS_OK; /* don't close the connection yet */
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.16 1998/07/13 16:34:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.17 1998/09/01 03:22:43 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -111,7 +111,7 @@ be_currentportal(void)
Dlelem *elt; Dlelem *elt;
elt = DLGetTail(be_portalstack); elt = DLGetTail(be_portalstack);
return (elt ? (PortalEntry *) DLE_VAL(elt) : NULL); return elt ? (PortalEntry *) DLE_VAL(elt) : NULL;
} }
/* ---------------- /* ----------------
@ -173,7 +173,7 @@ be_typeinit(PortalEntry *entry,
PortalBuffer *portal; PortalBuffer *portal;
GroupBuffer *group; GroupBuffer *group;
int i; int i;
AttributeTupleForm *attrs = tupDesc->attrs; Form_pg_attribute *attrs = tupDesc->attrs;
/* ---------------- /* ----------------
* add a new portal group to the portal * add a new portal group to the portal

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.24 1998/08/19 02:02:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.25 1998/09/01 03:22:44 momjian Exp $
* *
* NOTES * NOTES
* This should be moved to a more appropriate place. It is here * This should be moved to a more appropriate place. It is here
@ -211,7 +211,7 @@ lo_tell(int fd)
int int
lo_unlink(Oid lobjId) lo_unlink(Oid lobjId)
{ {
return (inv_destroy(lobjId)); return inv_destroy(lobjId);
} }
/***************************************************************************** /*****************************************************************************

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.18 1998/08/24 01:37:52 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.19 1998/09/01 03:22:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -412,5 +412,5 @@ pqtest(struct varlena * vlena)
return pqtest_PQexec(q); return pqtest_PQexec(q);
break; break;
} }
return (0); return 0;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.33 1998/06/15 19:28:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.34 1998/09/01 03:22:46 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -36,7 +36,7 @@
static bool static bool
isblank(const char c) isblank(const char c)
{ {
return (c == ' ' || c == 9 /* tab */ ); return c == ' ' || c == 9 /* tab */ ;
} }
@ -97,7 +97,7 @@ read_through_eol(FILE *file)
static void static void
read_hba_entry2(FILE *file, UserAuth *userauth_p, char auth_arg[], read_hba_entry2(FILE *file, UserAuth *userauth_p, char *auth_arg,
bool *error_p) bool *error_p)
{ {
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
@ -154,15 +154,15 @@ read_hba_entry2(FILE *file, UserAuth *userauth_p, char auth_arg[],
static void static void
process_hba_record(FILE *file, SockAddr *raddr, const char user[], process_hba_record(FILE *file, SockAddr *raddr, const char *user,
const char database[], bool *matches_p, bool *error_p, const char *database, bool *matches_p, bool *error_p,
UserAuth *userauth_p, char auth_arg[]) UserAuth *userauth_p, char *auth_arg)
{ {
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Process the non-comment record in the config file that is next on the file. Process the non-comment record in the config file that is next on the file.
See if it applies to a connection to a host with IP address "*raddr" See if it applies to a connection to a host with IP address "*raddr"
to a database named "database[]". If so, return *matches_p true to a database named "*database". If so, return *matches_p true
and *userauth_p and auth_arg[] as the values from the entry. and *userauth_p and *auth_arg as the values from the entry.
If not, leave *matches_p as it was. If the record has a syntax error, If not, leave *matches_p as it was. If the record has a syntax error,
return *error_p true, after issuing a message to stderr. If no error, return *error_p true, after issuing a message to stderr. If no error,
leave *error_p as it was. leave *error_p as it was.
@ -299,9 +299,9 @@ syntax:
static void static void
process_open_config_file(FILE *file, SockAddr *raddr, const char user[], process_open_config_file(FILE *file, SockAddr *raddr, const char *user,
const char database[], bool *host_ok_p, const char *database, bool *host_ok_p,
UserAuth *userauth_p, char auth_arg[]) UserAuth *userauth_p, char *auth_arg)
{ {
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
This function does the same thing as find_hba_entry, only with This function does the same thing as find_hba_entry, only with
@ -355,8 +355,8 @@ process_open_config_file(FILE *file, SockAddr *raddr, const char user[],
static void static void
find_hba_entry(SockAddr *raddr, const char user[], const char database[], find_hba_entry(SockAddr *raddr, const char *user, const char *database,
bool *host_ok_p, UserAuth *userauth_p, char auth_arg[]) bool *host_ok_p, UserAuth *userauth_p, char *auth_arg)
{ {
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
Read the config file and find an entry that allows connection from Read the config file and find an entry that allows connection from
@ -442,16 +442,16 @@ find_hba_entry(SockAddr *raddr, const char user[], const char database[],
static void static void
interpret_ident_response(char ident_response[], interpret_ident_response(char *ident_response,
bool *error_p, char ident_username[]) bool *error_p, char *ident_username)
{ {
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Parse the string "ident_response[]" as a response from a query to an Ident Parse the string "*ident_response" as a response from a query to an Ident
server. If it's a normal response indicating a username, return server. If it's a normal response indicating a username, return
*error_p == false and the username as ident_username[]. If it's anything *error_p == false and the username as *ident_username. If it's anything
else, return *error_p == true and ident_username[] undefined. else, return *error_p == true and *ident_username undefined.
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
char *cursor; /* Cursor into ident_response[] */ char *cursor; /* Cursor into *ident_response */
cursor = &ident_response[0]; cursor = &ident_response[0];
@ -474,7 +474,7 @@ interpret_ident_response(char ident_response[],
{ {
/* We're positioned to colon before response type field */ /* We're positioned to colon before response type field */
char response_type[80]; char response_type[80];
int i; /* Index into response_type[] */ int i; /* Index into *response_type */
cursor++; /* Go over colon */ cursor++; /* Go over colon */
while (isblank(*cursor)) while (isblank(*cursor))
@ -508,7 +508,7 @@ interpret_ident_response(char ident_response[],
*error_p = true; *error_p = true;
else else
{ {
int i; /* Index into ident_username[] */ int i; /* Index into *ident_username */
cursor++; /* Go over colon */ cursor++; /* Go over colon */
while (isblank(*cursor)) while (isblank(*cursor))
@ -531,18 +531,18 @@ interpret_ident_response(char ident_response[],
static void static void
ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr, ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
const ushort remote_port, const ushort local_port, const ushort remote_port, const ushort local_port,
bool *ident_failed, char ident_username[]) bool *ident_failed, char *ident_username)
{ {
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
Talk to the ident server on host "remote_ip_addr" and find out who Talk to the ident server on host "remote_ip_addr" and find out who
owns the tcp connection from his port "remote_port" to port owns the tcp connection from his port "remote_port" to port
"local_port_addr" on host "local_ip_addr". Return the username the "local_port_addr" on host "local_ip_addr". Return the username the
ident server gives as "ident_username[]". ident server gives as "*ident_username".
IP addresses and port numbers are in network byte order. IP addresses and port numbers are in network byte order.
But iff we're unable to get the information from ident, return But iff we're unable to get the information from ident, return
*ident_failed == true (and ident_username[] undefined). *ident_failed == true (and *ident_username undefined).
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
int sock_fd; int sock_fd;
@ -644,7 +644,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
static void static void
parse_map_record(FILE *file, parse_map_record(FILE *file,
char file_map[], char file_pguser[], char file_iuser[]) char *file_map, char *file_pguser, char *file_iuser)
{ {
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Take the noncomment line which is next on file "file" and interpret Take the noncomment line which is next on file "file" and interpret
@ -689,9 +689,9 @@ parse_map_record(FILE *file,
static void static void
verify_against_open_usermap(FILE *file, verify_against_open_usermap(FILE *file,
const char pguser[], const char *pguser,
const char ident_username[], const char *ident_username,
const char usermap_name[], const char *usermap_name,
bool *checks_out_p) bool *checks_out_p)
{ {
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
@ -740,9 +740,9 @@ verify_against_open_usermap(FILE *file,
static void static void
verify_against_usermap(const char pguser[], verify_against_usermap(const char *pguser,
const char ident_username[], const char *ident_username,
const char usermap_name[], const char *usermap_name,
bool *checks_out_p) bool *checks_out_p)
{ {
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
@ -821,14 +821,14 @@ verify_against_usermap(const char pguser[],
int int
authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr, authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
const char postgres_username[], const char *postgres_username,
const char auth_arg[]) const char *auth_arg)
{ {
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Talk to the ident server on the remote host and find out who owns the Talk to the ident server on the remote host and find out who owns the
connection described by "port". Then look in the usermap file under connection described by "port". Then look in the usermap file under
the usermap auth_arg[] and see if that user is equivalent to the usermap *auth_arg and see if that user is equivalent to
Postgres user user[]. Postgres user *user.
Return STATUS_OK if yes. Return STATUS_OK if yes.
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
@ -850,7 +850,7 @@ authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
verify_against_usermap(postgres_username, ident_username, auth_arg, verify_against_usermap(postgres_username, ident_username, auth_arg,
&checks_out); &checks_out);
return (checks_out ? STATUS_OK : STATUS_ERROR); return checks_out ? STATUS_OK : STATUS_ERROR;
} }
@ -930,7 +930,7 @@ InRange(char *buf, int host)
if (valid) if (valid)
{ {
FromAddr = file_ip_addr.s_addr; FromAddr = file_ip_addr.s_addr;
return ((unsigned) FromAddr == (unsigned) host); return (unsigned) FromAddr == (unsigned) host;
} }
} }
} }
@ -938,7 +938,7 @@ InRange(char *buf, int host)
} }
void void
GetCharSetByHost(char TableName[], int host, const char DataDir[]) GetCharSetByHost(char *TableName, int host, const char *DataDir)
{ {
FILE *file; FILE *file;
char buf[MAX_TOKEN], char buf[MAX_TOKEN],
@ -1064,5 +1064,5 @@ hba_getauthmethod(SockAddr *raddr, char *user, char *database,
find_hba_entry(raddr, user, database, &host_ok, auth_method, auth_arg); find_hba_entry(raddr, user, database, &host_ok, auth_method, auth_arg);
return (host_ok ? STATUS_OK : STATUS_ERROR); return host_ok ? STATUS_OK : STATUS_ERROR;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.15 1998/07/13 16:34:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.16 1998/09/01 03:22:48 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -48,7 +48,7 @@
* communicate with a backend or by user-defined functions which * communicate with a backend or by user-defined functions which
* are compiled or dynamically loaded into a backend. * are compiled or dynamically loaded into a backend.
* *
* the portals[] array should be organized as a hash table for * the *portals array should be organized as a hash table for
* quick portal-by-name lookup. * quick portal-by-name lookup.
* *
* Do not confuse "PortalEntry" (or "PortalBuffer") with "Portal" * Do not confuse "PortalEntry" (or "PortalBuffer") with "Portal"
@ -79,9 +79,9 @@ in_range(char *msg, int value, int min, int max)
msg, value, min, max); msg, value, min, max);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
return (0); return 0;
} }
return (1); return 1;
} }
static int static int
@ -92,9 +92,9 @@ valid_pointer(char *msg, void *ptr)
sprintf(PQerrormsg, "FATAL: %s\n", msg); sprintf(PQerrormsg, "FATAL: %s\n", msg);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
return (0); return 0;
} }
return (1); return 1;
} }
@ -122,7 +122,7 @@ PQnportals(int rule_p)
++n; ++n;
} }
} }
return (n); return n;
} }
/* -------------------------------- /* --------------------------------
@ -172,8 +172,8 @@ PQparray(char *pname)
return NULL; return NULL;
if ((i = pbuf_getIndex(pname)) < 0) if ((i = pbuf_getIndex(pname)) < 0)
return ((PortalBuffer *) NULL); return (PortalBuffer *) NULL;
return (portals[i]->portal); return portals[i]->portal;
} }
/* -------------------------------- /* --------------------------------
@ -184,9 +184,9 @@ int
PQrulep(PortalBuffer *portal) PQrulep(PortalBuffer *portal)
{ {
if (!valid_pointer("PQrulep: invalid portal pointer", portal)) if (!valid_pointer("PQrulep: invalid portal pointer", portal))
return (-1); return -1;
return (portal->rule_p); return portal->rule_p;
} }
/* -------------------------------- /* --------------------------------
@ -197,15 +197,15 @@ int
PQntuples(PortalBuffer *portal) PQntuples(PortalBuffer *portal)
{ {
if (!valid_pointer("PQntuples: invalid portal pointer", portal)) if (!valid_pointer("PQntuples: invalid portal pointer", portal))
return (-1); return -1;
return (portal->no_tuples); return portal->no_tuples;
} }
int int
PQninstances(PortalBuffer *portal) PQninstances(PortalBuffer *portal)
{ {
return (PQntuples(portal)); return PQntuples(portal);
} }
/* -------------------------------- /* --------------------------------
@ -216,9 +216,9 @@ int
PQngroups(PortalBuffer *portal) PQngroups(PortalBuffer *portal)
{ {
if (!valid_pointer("PQngroups: invalid portal pointer", portal)) if (!valid_pointer("PQngroups: invalid portal pointer", portal))
return (-1); return -1;
return (portal->no_groups); return portal->no_groups;
} }
/* -------------------------------- /* --------------------------------
@ -233,18 +233,18 @@ PQntuplesGroup(PortalBuffer *portal, int group_index)
if (!valid_pointer("PQntuplesGroup: invalid portal pointer", portal) || if (!valid_pointer("PQntuplesGroup: invalid portal pointer", portal) ||
!in_range("PQntuplesGroup: group index", !in_range("PQntuplesGroup: group index",
group_index, 0, portal->no_groups)) group_index, 0, portal->no_groups))
return (-1); return -1;
gbp = pbuf_findGroup(portal, group_index); gbp = pbuf_findGroup(portal, group_index);
if (gbp) if (gbp)
return (gbp->no_tuples); return gbp->no_tuples;
return (-1); return -1;
} }
int int
PQninstancesGroup(PortalBuffer *portal, int group_index) PQninstancesGroup(PortalBuffer *portal, int group_index)
{ {
return (PQntuplesGroup(portal, group_index)); return PQntuplesGroup(portal, group_index);
} }
/* -------------------------------- /* --------------------------------
@ -259,11 +259,11 @@ PQnfieldsGroup(PortalBuffer *portal, int group_index)
if (!valid_pointer("PQnfieldsGroup: invalid portal pointer", portal) || if (!valid_pointer("PQnfieldsGroup: invalid portal pointer", portal) ||
!in_range("PQnfieldsGroup: group index", !in_range("PQnfieldsGroup: group index",
group_index, 0, portal->no_groups)) group_index, 0, portal->no_groups))
return (-1); return -1;
gbp = pbuf_findGroup(portal, group_index); gbp = pbuf_findGroup(portal, group_index);
if (gbp) if (gbp)
return (gbp->no_fields); return gbp->no_fields;
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -281,11 +281,11 @@ PQfnumberGroup(PortalBuffer *portal, int group_index, char *field_name)
field_name) || field_name) ||
!in_range("PQfnumberGroup: group index", !in_range("PQfnumberGroup: group index",
group_index, 0, portal->no_groups)) group_index, 0, portal->no_groups))
return (-1); return -1;
gbp = pbuf_findGroup(portal, group_index); gbp = pbuf_findGroup(portal, group_index);
if (gbp) if (gbp)
return (pbuf_findFnumber(gbp, field_name)); return pbuf_findFnumber(gbp, field_name);
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -301,13 +301,13 @@ PQfnameGroup(PortalBuffer *portal, int group_index, int field_number)
if (!valid_pointer("PQfnameGroup: invalid portal pointer", portal) || if (!valid_pointer("PQfnameGroup: invalid portal pointer", portal) ||
!in_range("PQfnameGroup: group index", !in_range("PQfnameGroup: group index",
group_index, 0, portal->no_groups)) group_index, 0, portal->no_groups))
return ((char *) NULL); return (char *) NULL;
if ((gbp = pbuf_findGroup(portal, group_index)) && if ((gbp = pbuf_findGroup(portal, group_index)) &&
in_range("PQfnameGroup: field number", in_range("PQfnameGroup: field number",
field_number, 0, gbp->no_fields)) field_number, 0, gbp->no_fields))
return (pbuf_findFname(gbp, field_number)); return pbuf_findFname(gbp, field_number);
return ((char *) NULL); return (char *) NULL;
} }
/* -------------------------------- /* --------------------------------
@ -323,12 +323,12 @@ PQftypeGroup(PortalBuffer *portal, int group_index, int field_number)
if (!valid_pointer("PQftypeGroup: invalid portal pointer", portal) || if (!valid_pointer("PQftypeGroup: invalid portal pointer", portal) ||
!in_range("PQftypeGroup: group index", !in_range("PQftypeGroup: group index",
group_index, 0, portal->no_groups)) group_index, 0, portal->no_groups))
return (-1); return -1;
if ((gbp = pbuf_findGroup(portal, group_index)) && if ((gbp = pbuf_findGroup(portal, group_index)) &&
in_range("PQftypeGroup: field number", field_number, 0, gbp->no_fields)) in_range("PQftypeGroup: field number", field_number, 0, gbp->no_fields))
return (gbp->types[field_number].typid); return gbp->types[field_number].typid;
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -344,12 +344,12 @@ PQfsizeGroup(PortalBuffer *portal, int group_index, int field_number)
if (!valid_pointer("PQfsizeGroup: invalid portal pointer", portal) || if (!valid_pointer("PQfsizeGroup: invalid portal pointer", portal) ||
!in_range("PQfsizeGroup: tuple index", !in_range("PQfsizeGroup: tuple index",
group_index, 0, portal->no_groups)) group_index, 0, portal->no_groups))
return (-1); return -1;
if ((gbp = pbuf_findGroup(portal, group_index)) && if ((gbp = pbuf_findGroup(portal, group_index)) &&
in_range("PQfsizeGroup: field number", field_number, 0, gbp->no_fields)) in_range("PQfsizeGroup: field number", field_number, 0, gbp->no_fields))
return (gbp->types[field_number].typlen); return gbp->types[field_number].typlen;
return (-1); return -1;
} }
@ -366,7 +366,7 @@ PQgroup(PortalBuffer *portal, int tuple_index)
if (!valid_pointer("PQgroup: invalid portal pointer", portal) || if (!valid_pointer("PQgroup: invalid portal pointer", portal) ||
!in_range("PQgroup: tuple index", !in_range("PQgroup: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return ((GroupBuffer *) NULL); return (GroupBuffer *) NULL;
for (gbp = portal->groups; for (gbp = portal->groups;
gbp && tuple_index >= (tuple_count += gbp->no_tuples); gbp && tuple_index >= (tuple_count += gbp->no_tuples);
@ -374,8 +374,8 @@ PQgroup(PortalBuffer *portal, int tuple_index)
; ;
if (!in_range("PQgroup: tuple not found: tuple index", if (!in_range("PQgroup: tuple not found: tuple index",
tuple_index, 0, tuple_count)) tuple_index, 0, tuple_count))
return ((GroupBuffer *) NULL); return (GroupBuffer *) NULL;
return (gbp); return gbp;
} }
/* -------------------------------- /* --------------------------------
@ -393,7 +393,7 @@ PQgetgroup(PortalBuffer *portal, int tuple_index)
if (!valid_pointer("PQgetgroup: invalid portal pointer", portal) || if (!valid_pointer("PQgetgroup: invalid portal pointer", portal) ||
!in_range("PQgetgroup: tuple index", !in_range("PQgetgroup: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return (-1); return -1;
for (gbp = portal->groups; for (gbp = portal->groups;
gbp && tuple_index >= (tuple_count += gbp->no_tuples); gbp && tuple_index >= (tuple_count += gbp->no_tuples);
@ -401,8 +401,8 @@ PQgetgroup(PortalBuffer *portal, int tuple_index)
++group_count; ++group_count;
if (!gbp || !in_range("PQgetgroup: tuple not found: tuple index", if (!gbp || !in_range("PQgetgroup: tuple not found: tuple index",
tuple_index, 0, tuple_count)) tuple_index, 0, tuple_count))
return (-1); return -1;
return (group_count); return group_count;
} }
/* -------------------------------- /* --------------------------------
@ -417,11 +417,11 @@ PQnfields(PortalBuffer *portal, int tuple_index)
if (!valid_pointer("PQnfields: invalid portal pointer", portal) || if (!valid_pointer("PQnfields: invalid portal pointer", portal) ||
!in_range("PQnfields: tuple index", !in_range("PQnfields: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return (-1); return -1;
gbp = PQgroup(portal, tuple_index); gbp = PQgroup(portal, tuple_index);
if (gbp) if (gbp)
return (gbp->no_fields); return gbp->no_fields;
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -438,11 +438,11 @@ PQfnumber(PortalBuffer *portal, int tuple_index, char *field_name)
!valid_pointer("PQfnumber: invalid field name pointer", field_name) || !valid_pointer("PQfnumber: invalid field name pointer", field_name) ||
!in_range("PQfnumber: tuple index", !in_range("PQfnumber: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return (-1); return -1;
gbp = PQgroup(portal, tuple_index); gbp = PQgroup(portal, tuple_index);
if (gbp) if (gbp)
return (pbuf_findFnumber(gbp, field_name)); return pbuf_findFnumber(gbp, field_name);
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -457,13 +457,13 @@ PQfname(PortalBuffer *portal, int tuple_index, int field_number)
if (!valid_pointer("PQfname: invalid portal pointer", portal) || if (!valid_pointer("PQfname: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index", !in_range("PQfname: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return ((char *) NULL); return (char *) NULL;
if ((gbp = PQgroup(portal, tuple_index)) && if ((gbp = PQgroup(portal, tuple_index)) &&
in_range("PQfname: field number", in_range("PQfname: field number",
field_number, 0, gbp->no_fields)) field_number, 0, gbp->no_fields))
return (pbuf_findFname(gbp, field_number)); return pbuf_findFname(gbp, field_number);
return ((char *) NULL); return (char *) NULL;
} }
/* -------------------------------- /* --------------------------------
@ -478,12 +478,12 @@ PQftype(PortalBuffer *portal, int tuple_index, int field_number)
if (!valid_pointer("PQftype: invalid portal pointer", portal) || if (!valid_pointer("PQftype: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index", !in_range("PQfname: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return (-1); return -1;
if ((gbp = PQgroup(portal, tuple_index)) && if ((gbp = PQgroup(portal, tuple_index)) &&
in_range("PQftype: field number", field_number, 0, gbp->no_fields)) in_range("PQftype: field number", field_number, 0, gbp->no_fields))
return (gbp->types[field_number].typid); return gbp->types[field_number].typid;
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -498,12 +498,12 @@ PQfsize(PortalBuffer *portal, int tuple_index, int field_number)
if (!valid_pointer("PQfsize: invalid portal pointer", portal) || if (!valid_pointer("PQfsize: invalid portal pointer", portal) ||
!in_range("PQfsize: tuple index", !in_range("PQfsize: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return (-1); return -1;
if ((gbp = PQgroup(portal, tuple_index)) && if ((gbp = PQgroup(portal, tuple_index)) &&
in_range("PQfsize: field number", field_number, 0, gbp->no_fields)) in_range("PQfsize: field number", field_number, 0, gbp->no_fields))
return (gbp->types[field_number].typlen); return gbp->types[field_number].typlen;
return (-1); return -1;
} }
@ -524,13 +524,13 @@ PQsametype(PortalBuffer *portal, int tuple_index1, int tuple_index2)
tuple_index1, 0, portal->no_tuples) || tuple_index1, 0, portal->no_tuples) ||
!in_range("PQsametype: tuple index 2", !in_range("PQsametype: tuple index 2",
tuple_index2, 0, portal->no_tuples)) tuple_index2, 0, portal->no_tuples))
return (-1); return -1;
gbp1 = PQgroup(portal, tuple_index1); gbp1 = PQgroup(portal, tuple_index1);
gbp2 = PQgroup(portal, tuple_index2); gbp2 = PQgroup(portal, tuple_index2);
if (gbp1 && gbp2) if (gbp1 && gbp2)
return (gbp1 == gbp2); return gbp1 == gbp2;
return (-1); return -1;
} }
static TupleBlock * static TupleBlock *
@ -547,7 +547,7 @@ PQGetTupleBlock(PortalBuffer *portal,
tuple_offset) || tuple_offset) ||
!in_range("PQGetTupleBlock: tuple index", !in_range("PQGetTupleBlock: tuple index",
tuple_index, 0, portal->no_tuples)) tuple_index, 0, portal->no_tuples))
return ((TupleBlock *) NULL); return (TupleBlock *) NULL;
for (gbp = portal->groups; for (gbp = portal->groups;
gbp && tuple_index >= (tuple_count += gbp->no_tuples); gbp && tuple_index >= (tuple_count += gbp->no_tuples);
@ -556,7 +556,7 @@ PQGetTupleBlock(PortalBuffer *portal,
if (!gbp || if (!gbp ||
!in_range("PQGetTupleBlock: tuple not found: tuple index", !in_range("PQGetTupleBlock: tuple not found: tuple index",
tuple_index, 0, tuple_count)) tuple_index, 0, tuple_count))
return ((TupleBlock *) NULL); return (TupleBlock *) NULL;
tuple_count -= gbp->no_tuples; tuple_count -= gbp->no_tuples;
for (tbp = gbp->tuples; for (tbp = gbp->tuples;
tbp && tuple_index >= (tuple_count += TupleBlockSize); tbp && tuple_index >= (tuple_count += TupleBlockSize);
@ -565,11 +565,11 @@ PQGetTupleBlock(PortalBuffer *portal,
if (!tbp || if (!tbp ||
!in_range("PQGetTupleBlock: tuple not found: tuple index", !in_range("PQGetTupleBlock: tuple not found: tuple index",
tuple_index, 0, tuple_count)) tuple_index, 0, tuple_count))
return ((TupleBlock *) NULL); return (TupleBlock *) NULL;
tuple_count -= TupleBlockSize; tuple_count -= TupleBlockSize;
*tuple_offset = tuple_index - tuple_count; *tuple_offset = tuple_index - tuple_count;
return (tbp); return tbp;
} }
/* -------------------------------- /* --------------------------------
@ -586,8 +586,8 @@ PQgetvalue(PortalBuffer *portal,
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset); tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp) if (tbp)
return (tbp->values[tuple_offset][field_number]); return tbp->values[tuple_offset][field_number];
return ((char *) NULL); return (char *) NULL;
} }
/* -------------------------------- /* --------------------------------
@ -634,8 +634,8 @@ PQgetlength(PortalBuffer *portal,
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset); tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp) if (tbp)
return (tbp->lengths[tuple_offset][field_number]); return tbp->lengths[tuple_offset][field_number];
return (-1); return -1;
} }
/* ---------------- /* ----------------
@ -708,7 +708,7 @@ PQnotifies()
PQcleanNotify(); PQcleanNotify();
e = DLGetHead(pqNotifyList); e = DLGetHead(pqNotifyList);
return (e ? (PQNotifyList *) DLE_VAL(e) : NULL); return e ? (PQNotifyList *) DLE_VAL(e) : NULL;
} }
void void

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.10 1998/02/26 04:31:52 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.11 1998/09/01 03:22:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -115,7 +115,7 @@ pbuf_alloc(size_t size)
if (addr == (caddr_t) NULL) if (addr == (caddr_t) NULL)
libpq_raise(&MemoryError, form("Cannot Allocate space.")); libpq_raise(&MemoryError, form("Cannot Allocate space."));
return (addr); return addr;
} }
/* -------------------------------- /* --------------------------------
@ -152,7 +152,7 @@ pbuf_addPortal()
portal->no_groups = 0; portal->no_groups = 0;
portal->groups = NULL; portal->groups = NULL;
return (portal); return portal;
} }
/* -------------------------------- /* --------------------------------
@ -184,7 +184,7 @@ pbuf_addGroup(PortalBuffer *portal)
group1->next = group; group1->next = group;
} }
return (group); return group;
} }
/* -------------------------------- /* --------------------------------
@ -199,7 +199,7 @@ pbuf_addTypes(int n)
types = (TypeBlock *) types = (TypeBlock *)
pbuf_alloc(n * sizeof(TypeBlock)); pbuf_alloc(n * sizeof(TypeBlock));
return (types); return types;
} }
/* -------------------------------- /* --------------------------------
@ -217,7 +217,7 @@ pbuf_addTuples()
tuples->next = NULL; tuples->next = NULL;
tuples->tuple_index = 0; tuples->tuple_index = 0;
return (tuples); return tuples;
} }
/* -------------------------------- /* --------------------------------
@ -373,7 +373,7 @@ pbuf_getIndex(char *pname)
return i; return i;
} }
return (-1); return -1;
} }
/* -------------------------------- /* --------------------------------
@ -465,7 +465,7 @@ pbuf_findGroup(PortalBuffer *portal,
libpq_raise(&PortalError, libpq_raise(&PortalError,
form("Group index %d out of bound.", group_index)); form("Group index %d out of bound.", group_index));
return (group); return group;
} }
/* -------------------------------- /* --------------------------------
@ -483,7 +483,7 @@ pbuf_findFnumber(GroupBuffer *group,
for (i = 0; i < group->no_fields; i++) for (i = 0; i < group->no_fields; i++)
if (strncmp(types[i].name, field_name, NAMEDATALEN) == 0) if (strncmp(types[i].name, field_name, NAMEDATALEN) == 0)
return (i); return i;
libpq_raise(&PortalError, libpq_raise(&PortalError,
form("Field-name %s does not exist.", field_name)); form("Field-name %s does not exist.", field_name));

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.51 1998/08/25 21:32:10 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.52 1998/09/01 03:22:50 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -139,8 +139,8 @@ pq_getport()
char *envport = getenv("PGPORT"); char *envport = getenv("PGPORT");
if (envport) if (envport)
return (atoi(envport)); return atoi(envport);
return (atoi(DEF_PGPORT)); return atoi(DEF_PGPORT);
} }
/* -------------------------------- /* --------------------------------
@ -194,7 +194,7 @@ pq_getstr(char *s, int maxlen)
if (Pfin == (FILE *) NULL) if (Pfin == (FILE *) NULL)
{ {
/* elog(DEBUG, "Input descriptor is null"); */ /* elog(DEBUG, "Input descriptor is null"); */
return (EOF); return EOF;
} }
while (maxlen-- && (c = pq_getc(Pfin)) != EOF && c) while (maxlen-- && (c = pq_getc(Pfin)) != EOF && c)
@ -215,8 +215,8 @@ pq_getstr(char *s, int maxlen)
* ----------------- * -----------------
*/ */
if (c == EOF) if (c == EOF)
return (EOF); return EOF;
return (!EOF); return !EOF;
} }
/* /*
@ -240,7 +240,7 @@ int
PQgetline(char *s, int maxlen) PQgetline(char *s, int maxlen)
{ {
if (!Pfin || !s || maxlen <= 1) if (!Pfin || !s || maxlen <= 1)
return (EOF); return EOF;
if (fgets(s, maxlen - 1, Pfin) == NULL) if (fgets(s, maxlen - 1, Pfin) == NULL)
return feof(Pfin) ? EOF : 1; return feof(Pfin) ? EOF : 1;
@ -275,7 +275,7 @@ PQputline(char *s)
fputs(s, Pfout); fputs(s, Pfout);
fflush(Pfout); fflush(Pfout);
} }
return (0); return 0;
} }
/* -------------------------------- /* --------------------------------
@ -438,7 +438,7 @@ pq_getinaddr(struct sockaddr_in * sin,
if (!(hs = gethostbyname(host))) if (!(hs = gethostbyname(host)))
{ {
perror(host); perror(host);
return (1); return 1;
} }
if (hs->h_addrtype != AF_INET) if (hs->h_addrtype != AF_INET)
{ {
@ -447,7 +447,7 @@ pq_getinaddr(struct sockaddr_in * sin,
host); host);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (1); return 1;
} }
memmove((char *) &sin->sin_addr, memmove((char *) &sin->sin_addr,
hs->h_addr, hs->h_addr,
@ -456,7 +456,7 @@ pq_getinaddr(struct sockaddr_in * sin,
} }
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
sin->sin_port = htons(port); sin->sin_port = htons(port);
return (0); return 0;
} }
/* -------------------------------- /* --------------------------------
@ -469,7 +469,7 @@ pq_getinserv(struct sockaddr_in * sin, char *host, char *serv)
struct servent *ss; struct servent *ss;
if (*serv >= '0' && *serv <= '9') if (*serv >= '0' && *serv <= '9')
return (pq_getinaddr(sin, host, atoi(serv))); return pq_getinaddr(sin, host, atoi(serv));
if (!(ss = getservbyname(serv, NULL))) if (!(ss = getservbyname(serv, NULL)))
{ {
sprintf(PQerrormsg, sprintf(PQerrormsg,
@ -477,9 +477,9 @@ pq_getinserv(struct sockaddr_in * sin, char *host, char *serv)
serv); serv);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (1); return 1;
} }
return (pq_getinaddr(sin, host, ntohs(ss->s_port))); return pq_getinaddr(sin, host, ntohs(ss->s_port));
} }
/* /*
@ -535,7 +535,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
errno); errno);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one, if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
sizeof(one))) == -1) sizeof(one))) == -1)
@ -545,7 +545,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
errno); errno);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
MemSet((char *) &saddr, 0, sizeof(saddr)); MemSet((char *) &saddr, 0, sizeof(saddr));
saddr.sa.sa_family = family; saddr.sa.sa_family = family;
@ -590,7 +590,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
else else
strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n"); strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
return (STATUS_ERROR); return STATUS_ERROR;
} }
if (family == AF_UNIX) { if (family == AF_UNIX) {
@ -620,7 +620,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
*fdP = fd; *fdP = fd;
if (family == AF_UNIX) if (family == AF_UNIX)
chmod(sock_path, 0777); chmod(sock_path, 0777);
return (STATUS_OK); return STATUS_OK;
} }
/* /*
@ -647,7 +647,7 @@ StreamConnection(int server_fd, Port *port)
&addrlen)) < 0) &addrlen)) < 0)
{ {
elog(ERROR, "postmaster: StreamConnection: accept: %m"); elog(ERROR, "postmaster: StreamConnection: accept: %m");
return (STATUS_ERROR); return STATUS_ERROR;
} }
/* fill in the server (local) address */ /* fill in the server (local) address */
@ -656,7 +656,7 @@ StreamConnection(int server_fd, Port *port)
&addrlen) < 0) &addrlen) < 0)
{ {
elog(ERROR, "postmaster: StreamConnection: getsockname: %m"); elog(ERROR, "postmaster: StreamConnection: getsockname: %m");
return (STATUS_ERROR); return STATUS_ERROR;
} }
if (family == AF_INET) if (family == AF_INET)
{ {
@ -667,20 +667,20 @@ StreamConnection(int server_fd, Port *port)
if (pe == NULL) if (pe == NULL)
{ {
elog(ERROR, "postmaster: getprotobyname failed"); elog(ERROR, "postmaster: getprotobyname failed");
return (STATUS_ERROR); return STATUS_ERROR;
} }
if (setsockopt(port->sock, pe->p_proto, TCP_NODELAY, if (setsockopt(port->sock, pe->p_proto, TCP_NODELAY,
&on, sizeof(on)) < 0) &on, sizeof(on)) < 0)
{ {
elog(ERROR, "postmaster: setsockopt failed"); elog(ERROR, "postmaster: setsockopt failed");
return (STATUS_ERROR); return STATUS_ERROR;
} }
} }
/* reset to non-blocking */ /* reset to non-blocking */
fcntl(port->sock, F_SETFL, 1); fcntl(port->sock, F_SETFL, 1);
return (STATUS_OK); return STATUS_OK;
} }
/* /*
@ -722,7 +722,7 @@ StreamOpen(char *hostName, short portName, Port *port)
hostName); hostName);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
memmove((char *) &(port->raddr.in.sin_addr), memmove((char *) &(port->raddr.in.sin_addr),
(char *) hp->h_addr, (char *) hp->h_addr,
@ -744,7 +744,7 @@ StreamOpen(char *hostName, short portName, Port *port)
errno); errno);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
err = connect(port->sock, &port->raddr.sa, len); err = connect(port->sock, &port->raddr.sa, len);
if (err < 0) if (err < 0)
@ -754,7 +754,7 @@ StreamOpen(char *hostName, short portName, Port *port)
errno); errno);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
/* fill in the client address */ /* fill in the client address */
@ -765,10 +765,10 @@ StreamOpen(char *hostName, short portName, Port *port)
errno); errno);
fputs(PQerrormsg, stderr); fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg); pqdebug("%s", PQerrormsg);
return (STATUS_ERROR); return STATUS_ERROR;
} }
return (STATUS_OK); return STATUS_OK;
} }
#ifdef MULTIBYTE #ifdef MULTIBYTE

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.8 1998/06/15 19:28:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.9 1998/09/01 03:22:52 momjian Exp $
* *
* NOTES * NOTES
* This shouldn't be in libpq, but the monitor and some other * This shouldn't be in libpq, but the monitor and some other
@ -58,7 +58,7 @@ pqsignal(int signo, pqsigfunc func)
if (signo != SIGALRM) if (signo != SIGALRM)
act.sa_flags |= SA_RESTART; act.sa_flags |= SA_RESTART;
if (sigaction(signo, &act, &oact) < 0) if (sigaction(signo, &act, &oact) < 0)
return (SIG_ERR); return SIG_ERR;
return (oact.sa_handler); return oact.sa_handler;
#endif /* !USE_POSIX_SIGNALS */ #endif /* !USE_POSIX_SIGNALS */
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.46 1998/08/04 16:43:56 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.47 1998/09/01 03:22:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -765,7 +765,7 @@ _copyConst(Const *from)
if (!from->constisnull && cached_type != from->consttype) if (!from->constisnull && cached_type != from->consttype)
{ {
HeapTuple typeTuple; HeapTuple typeTuple;
TypeTupleForm typeStruct; Form_pg_type typeStruct;
/* ---------------- /* ----------------
* get the type tuple corresponding to the paramList->type, * get the type tuple corresponding to the paramList->type,
@ -784,7 +784,7 @@ _copyConst(Const *from)
*/ */
Assert(PointerIsValid(typeTuple)); Assert(PointerIsValid(typeTuple));
typeStruct = (TypeTupleForm) GETSTRUCT(typeTuple); typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
cached_typbyval = (typeStruct)->typbyval ? true : false; cached_typbyval = (typeStruct)->typbyval ? true : false;
cached_type = from->consttype; cached_type = from->consttype;
} }
@ -1316,13 +1316,13 @@ _copyMergeOrder(MergeOrder *from)
} }
/* ---------------- /* ----------------
* _copyCInfo * _copyClauseInfo
* ---------------- * ----------------
*/ */
static CInfo * static ClauseInfo *
_copyCInfo(CInfo *from) _copyClauseInfo(ClauseInfo *from)
{ {
CInfo *newnode = makeNode(CInfo); ClauseInfo *newnode = makeNode(ClauseInfo);
/* ---------------- /* ----------------
* copy remainder of node * copy remainder of node
@ -1409,13 +1409,13 @@ _copyMInfo(MInfo *from)
} }
/* ---------------- /* ----------------
* _copyJInfo * _copyJoinInfo
* ---------------- * ----------------
*/ */
static JInfo * static JoinInfo *
_copyJInfo(JInfo *from) _copyJoinInfo(JoinInfo *from)
{ {
JInfo *newnode = makeNode(JInfo); JoinInfo *newnode = makeNode(JoinInfo);
/* ---------------- /* ----------------
* copy remainder of node * copy remainder of node
@ -1761,8 +1761,8 @@ copyObject(void *from)
case T_MergeOrder: case T_MergeOrder:
retval = _copyMergeOrder(from); retval = _copyMergeOrder(from);
break; break;
case T_CInfo: case T_ClauseInfo:
retval = _copyCInfo(from); retval = _copyClauseInfo(from);
break; break;
case T_JoinMethod: case T_JoinMethod:
retval = _copyJoinMethod(from); retval = _copyJoinMethod(from);
@ -1773,8 +1773,8 @@ copyObject(void *from)
case T_MInfo: case T_MInfo:
retval = _copyMInfo(from); retval = _copyMInfo(from);
break; break;
case T_JInfo: case T_JoinInfo:
retval = _copyJInfo(from); retval = _copyJoinInfo(from);
break; break;
case T_Iter: case T_Iter:
retval = _copyIter(from); retval = _copyIter(from);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.18 1998/08/04 16:43:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.19 1998/09/01 03:22:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -39,19 +39,19 @@ static bool
_equalResdom(Resdom *a, Resdom *b) _equalResdom(Resdom *a, Resdom *b)
{ {
if (a->resno != b->resno) if (a->resno != b->resno)
return (false); return false;
if (a->restype != b->restype) if (a->restype != b->restype)
return (false); return false;
if (a->restypmod != b->restypmod) if (a->restypmod != b->restypmod)
return (false); return false;
if (strcmp(a->resname, b->resname) != 0) if (strcmp(a->resname, b->resname) != 0)
return (false); return false;
if (a->reskey != b->reskey) if (a->reskey != b->reskey)
return (false); return false;
if (a->reskeyop != b->reskeyop) if (a->reskeyop != b->reskeyop)
return (false); return false;
return (true); return true;
} }
static bool static bool
@ -60,19 +60,19 @@ _equalFjoin(Fjoin *a, Fjoin *b)
int nNodes; int nNodes;
if (a->fj_initialized != b->fj_initialized) if (a->fj_initialized != b->fj_initialized)
return (false); return false;
if (a->fj_nNodes != b->fj_nNodes) if (a->fj_nNodes != b->fj_nNodes)
return (false); return false;
if (!equal(a->fj_innerNode, b->fj_innerNode)) if (!equal(a->fj_innerNode, b->fj_innerNode))
return (false); return false;
nNodes = a->fj_nNodes; nNodes = a->fj_nNodes;
if (memcmp(a->fj_results, b->fj_results, nNodes * sizeof(Datum)) != 0) if (memcmp(a->fj_results, b->fj_results, nNodes * sizeof(Datum)) != 0)
return (false); return false;
if (memcmp(a->fj_alwaysDone, b->fj_alwaysDone, nNodes * sizeof(bool)) != 0) if (memcmp(a->fj_alwaysDone, b->fj_alwaysDone, nNodes * sizeof(bool)) != 0)
return (false); return false;
return (true); return true;
} }
/* /*
@ -82,39 +82,39 @@ static bool
_equalExpr(Expr *a, Expr *b) _equalExpr(Expr *a, Expr *b)
{ {
if (a->opType != b->opType) if (a->opType != b->opType)
return (false); return false;
if (!equal(a->oper, b->oper)) if (!equal(a->oper, b->oper))
return (false); return false;
if (!equal(a->args, b->args)) if (!equal(a->args, b->args))
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalIter(Iter *a, Iter *b) _equalIter(Iter *a, Iter *b)
{ {
return (equal(a->iterexpr, b->iterexpr)); return equal(a->iterexpr, b->iterexpr);
} }
static bool static bool
_equalStream(Stream *a, Stream *b) _equalStream(Stream *a, Stream *b)
{ {
if (a->clausetype != b->clausetype) if (a->clausetype != b->clausetype)
return (false); return false;
if (a->groupup != b->groupup) if (a->groupup != b->groupup)
return (false); return false;
if (a->groupcost != b->groupcost) if (a->groupcost != b->groupcost)
return (false); return false;
if (a->groupsel != b->groupsel) if (a->groupsel != b->groupsel)
return (false); return false;
if (!equal(a->pathptr, b->pathptr)) if (!equal(a->pathptr, b->pathptr))
return (false); return false;
if (!equal(a->cinfo, b->cinfo)) if (!equal(a->cinfo, b->cinfo))
return (false); return false;
if (!equal(a->upstream, b->upstream)) if (!equal(a->upstream, b->upstream))
return (false); return false;
return (equal(a->downstream, b->downstream)); return equal(a->downstream, b->downstream);
} }
/* /*
@ -124,57 +124,57 @@ static bool
_equalVar(Var *a, Var *b) _equalVar(Var *a, Var *b)
{ {
if (a->varno != b->varno) if (a->varno != b->varno)
return (false); return false;
if (a->varattno != b->varattno) if (a->varattno != b->varattno)
return (false); return false;
if (a->vartype != b->vartype) if (a->vartype != b->vartype)
return (false); return false;
if (a->vartypmod != b->vartypmod) if (a->vartypmod != b->vartypmod)
return (false); return false;
if (a->varlevelsup != b->varlevelsup) if (a->varlevelsup != b->varlevelsup)
return (false); return false;
if (a->varnoold != b->varnoold) if (a->varnoold != b->varnoold)
return (false); return false;
if (a->varoattno != b->varoattno) if (a->varoattno != b->varoattno)
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalArray(Array *a, Array *b) _equalArray(Array *a, Array *b)
{ {
if (a->arrayelemtype != b->arrayelemtype) if (a->arrayelemtype != b->arrayelemtype)
return (false); return false;
if (a->arrayndim != b->arrayndim) if (a->arrayndim != b->arrayndim)
return (false); return false;
if (a->arraylow.indx[0] != b->arraylow.indx[0]) if (a->arraylow.indx[0] != b->arraylow.indx[0])
return (false); return false;
if (a->arrayhigh.indx[0] != b->arrayhigh.indx[0]) if (a->arrayhigh.indx[0] != b->arrayhigh.indx[0])
return (false); return false;
if (a->arraylen != b->arraylen) if (a->arraylen != b->arraylen)
return (false); return false;
return (TRUE); return TRUE;
} }
static bool static bool
_equalArrayRef(ArrayRef *a, ArrayRef *b) _equalArrayRef(ArrayRef *a, ArrayRef *b)
{ {
if (a->refelemtype != b->refelemtype) if (a->refelemtype != b->refelemtype)
return (false); return false;
if (a->refattrlength != b->refattrlength) if (a->refattrlength != b->refattrlength)
return (false); return false;
if (a->refelemlength != b->refelemlength) if (a->refelemlength != b->refelemlength)
return (false); return false;
if (a->refelembyval != b->refelembyval) if (a->refelembyval != b->refelembyval)
return (false); return false;
if (!equal(a->refupperindexpr, b->refupperindexpr)) if (!equal(a->refupperindexpr, b->refupperindexpr))
return (false); return false;
if (!equal(a->reflowerindexpr, b->reflowerindexpr)) if (!equal(a->reflowerindexpr, b->reflowerindexpr))
return (false); return false;
if (!equal(a->refexpr, b->refexpr)) if (!equal(a->refexpr, b->refexpr))
return (false); return false;
return (equal(a->refassgnexpr, b->refassgnexpr)); return equal(a->refassgnexpr, b->refassgnexpr);
} }
/* /*
@ -184,11 +184,11 @@ static bool
_equalOper(Oper *a, Oper *b) _equalOper(Oper *a, Oper *b)
{ {
if (a->opno != b->opno) if (a->opno != b->opno)
return (false); return false;
if (a->opresulttype != b->opresulttype) if (a->opresulttype != b->opresulttype)
return (false); return false;
return (true); return true;
} }
/* /*
@ -203,13 +203,13 @@ _equalConst(Const *a, Const *b)
* ridiculous. -- JMH, 7/11/92 * ridiculous. -- JMH, 7/11/92
*/ */
if (a->consttype != b->consttype) if (a->consttype != b->consttype)
return (false); return false;
if (a->constlen != b->constlen) if (a->constlen != b->constlen)
return (false); return false;
if (a->constisnull != b->constisnull) if (a->constisnull != b->constisnull)
return (false); return false;
if (a->constbyval != b->constbyval) if (a->constbyval != b->constbyval)
return (false); return false;
return (datumIsEqual(a->constvalue, b->constvalue, return (datumIsEqual(a->constvalue, b->constvalue,
a->consttype, a->constbyval, a->constlen)); a->consttype, a->constbyval, a->constlen));
} }
@ -221,11 +221,11 @@ static bool
_equalParam(Param *a, Param *b) _equalParam(Param *a, Param *b)
{ {
if (a->paramkind != b->paramkind) if (a->paramkind != b->paramkind)
return (false); return false;
if (a->paramtype != b->paramtype) if (a->paramtype != b->paramtype)
return (false); return false;
if (!equal(a->param_tlist, b->param_tlist)) if (!equal(a->param_tlist, b->param_tlist))
return (false); return false;
switch (a->paramkind) switch (a->paramkind)
{ {
@ -233,26 +233,26 @@ _equalParam(Param *a, Param *b)
case PARAM_NEW: case PARAM_NEW:
case PARAM_OLD: case PARAM_OLD:
if (strcmp(a->paramname, b->paramname) != 0) if (strcmp(a->paramname, b->paramname) != 0)
return (false); return false;
break; break;
case PARAM_NUM: case PARAM_NUM:
case PARAM_EXEC: case PARAM_EXEC:
if (a->paramid != b->paramid) if (a->paramid != b->paramid)
return (false); return false;
break; break;
case PARAM_INVALID: case PARAM_INVALID:
/* /*
* XXX: Hmmm... What are we supposed to return in this case ?? * XXX: Hmmm... What are we supposed to return in this case ??
*/ */
return (true); return true;
break; break;
default: default:
elog(ERROR, "_equalParam: Invalid paramkind value: %d", elog(ERROR, "_equalParam: Invalid paramkind value: %d",
a->paramkind); a->paramkind);
} }
return (true); return true;
} }
/* /*
@ -262,42 +262,42 @@ static bool
_equalFunc(Func *a, Func *b) _equalFunc(Func *a, Func *b)
{ {
if (a->funcid != b->funcid) if (a->funcid != b->funcid)
return (false); return false;
if (a->functype != b->functype) if (a->functype != b->functype)
return (false); return false;
if (a->funcisindex != b->funcisindex) if (a->funcisindex != b->funcisindex)
return (false); return false;
if (a->funcsize != b->funcsize) if (a->funcsize != b->funcsize)
return (false); return false;
if (!equal(a->func_tlist, b->func_tlist)) if (!equal(a->func_tlist, b->func_tlist))
return (false); return false;
if (!equal(a->func_planlist, b->func_planlist)) if (!equal(a->func_planlist, b->func_planlist))
return (false); return false;
return (true); return true;
} }
/* /*
* CInfo is a subclass of Node. * ClauseInfo is a subclass of Node.
*/ */
static bool static bool
_equalCInfo(CInfo *a, CInfo *b) _equalClauseInfo(ClauseInfo *a, ClauseInfo *b)
{ {
Assert(IsA(a, CInfo)); Assert(IsA(a, ClauseInfo));
Assert(IsA(b, CInfo)); Assert(IsA(b, ClauseInfo));
if (!equal(a->clause, b->clause)) if (!equal(a->clause, b->clause))
return (false); return false;
if (a->selectivity != b->selectivity) if (a->selectivity != b->selectivity)
return (false); return false;
if (a->notclause != b->notclause) if (a->notclause != b->notclause)
return (false); return false;
#ifdef EqualMergeOrderExists #ifdef EqualMergeOrderExists
if (!EqualMergeOrder(a->mergejoinorder, b->mergejoinorder)) if (!EqualMergeOrder(a->mergejoinorder, b->mergejoinorder))
return (false); return false;
#endif #endif
if (a->hashjoinoperator != b->hashjoinoperator) if (a->hashjoinoperator != b->hashjoinoperator)
return (false); return false;
return (equal((a->indexids), return (equal((a->indexids),
(b->indexids))); (b->indexids)));
} }
@ -323,20 +323,20 @@ _equalJoinMethod(JoinMethod *a, JoinMethod *b)
if (!equal((a->jmkeys), if (!equal((a->jmkeys),
(b->jmkeys))) (b->jmkeys)))
return (false); return false;
if (!equal((a->clauses), if (!equal((a->clauses),
(b->clauses))) (b->clauses)))
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalPath(Path *a, Path *b) _equalPath(Path *a, Path *b)
{ {
if (a->pathtype != b->pathtype) if (a->pathtype != b->pathtype)
return (false); return false;
if (a->parent != b->parent) if (a->parent != b->parent)
return (false); return false;
/* /*
* if (a->path_cost != b->path_cost) return(false); * if (a->path_cost != b->path_cost) return(false);
@ -370,31 +370,31 @@ _equalPath(Path *a, Path *b)
{ {
if (!equal((a->p_ordering.ord.merge), if (!equal((a->p_ordering.ord.merge),
(b->p_ordering.ord.merge))) (b->p_ordering.ord.merge)))
return (false); return false;
} }
if (!equal((a->keys), if (!equal((a->keys),
(b->keys))) (b->keys)))
return (false); return false;
/* /*
* if (a->outerjoincost != b->outerjoincost) return(false); * if (a->outerjoincost != b->outerjoincost) return(false);
*/ */
if (!equali((a->joinid), if (!equali((a->joinid),
(b->joinid))) (b->joinid)))
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalIndexPath(IndexPath *a, IndexPath *b) _equalIndexPath(IndexPath *a, IndexPath *b)
{ {
if (!_equalPath((Path *) a, (Path *) b)) if (!_equalPath((Path *) a, (Path *) b))
return (false); return false;
if (!equali((a->indexid), (b->indexid))) if (!equali((a->indexid), (b->indexid)))
return (false); return false;
if (!equal((a->indexqual), (b->indexqual))) if (!equal((a->indexqual), (b->indexqual)))
return (false); return false;
return (true); return true;
} }
static bool static bool
@ -404,14 +404,14 @@ _equalJoinPath(JoinPath *a, JoinPath *b)
Assert(IsA_JoinPath(b)); Assert(IsA_JoinPath(b));
if (!_equalPath((Path *) a, (Path *) b)) if (!_equalPath((Path *) a, (Path *) b))
return (false); return false;
if (!equal((a->pathclauseinfo), (b->pathclauseinfo))) if (!equal((a->pathclauseinfo), (b->pathclauseinfo)))
return (false); return false;
if (!equal((a->outerjoinpath), (b->outerjoinpath))) if (!equal((a->outerjoinpath), (b->outerjoinpath)))
return (false); return false;
if (!equal((a->innerjoinpath), (b->innerjoinpath))) if (!equal((a->innerjoinpath), (b->innerjoinpath)))
return (false); return false;
return (true); return true;
} }
static bool static bool
@ -421,14 +421,14 @@ _equalMergePath(MergePath *a, MergePath *b)
Assert(IsA(b, MergePath)); Assert(IsA(b, MergePath));
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b)) if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
return (false); return false;
if (!equal((a->path_mergeclauses), (b->path_mergeclauses))) if (!equal((a->path_mergeclauses), (b->path_mergeclauses)))
return (false); return false;
if (!equal((a->outersortkeys), (b->outersortkeys))) if (!equal((a->outersortkeys), (b->outersortkeys)))
return (false); return false;
if (!equal((a->innersortkeys), (b->innersortkeys))) if (!equal((a->innersortkeys), (b->innersortkeys)))
return (false); return false;
return (true); return true;
} }
static bool static bool
@ -438,14 +438,14 @@ _equalHashPath(HashPath *a, HashPath *b)
Assert(IsA(b, HashPath)); Assert(IsA(b, HashPath));
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b)) if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
return (false); return false;
if (!equal((a->path_hashclauses), (b->path_hashclauses))) if (!equal((a->path_hashclauses), (b->path_hashclauses)))
return (false); return false;
if (!equal((a->outerhashkeys), (b->outerhashkeys))) if (!equal((a->outerhashkeys), (b->outerhashkeys)))
return (false); return false;
if (!equal((a->innerhashkeys), (b->innerhashkeys))) if (!equal((a->innerhashkeys), (b->innerhashkeys)))
return (false); return false;
return (true); return true;
} }
static bool static bool
@ -455,31 +455,31 @@ _equalJoinKey(JoinKey *a, JoinKey *b)
Assert(IsA(b, JoinKey)); Assert(IsA(b, JoinKey));
if (!equal((a->outer), (b->outer))) if (!equal((a->outer), (b->outer)))
return (false); return false;
if (!equal((a->inner), (b->inner))) if (!equal((a->inner), (b->inner)))
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalMergeOrder(MergeOrder *a, MergeOrder *b) _equalMergeOrder(MergeOrder *a, MergeOrder *b)
{ {
if (a == (MergeOrder *) NULL && b == (MergeOrder *) NULL) if (a == (MergeOrder *) NULL && b == (MergeOrder *) NULL)
return (true); return true;
Assert(IsA(a, MergeOrder)); Assert(IsA(a, MergeOrder));
Assert(IsA(b, MergeOrder)); Assert(IsA(b, MergeOrder));
if (a->join_operator != b->join_operator) if (a->join_operator != b->join_operator)
return (false); return false;
if (a->left_operator != b->left_operator) if (a->left_operator != b->left_operator)
return (false); return false;
if (a->right_operator != b->right_operator) if (a->right_operator != b->right_operator)
return (false); return false;
if (a->left_type != b->left_type) if (a->left_type != b->left_type)
return (false); return false;
if (a->right_type != b->right_type) if (a->right_type != b->right_type)
return (false); return false;
return (true); return true;
} }
static bool static bool
@ -489,8 +489,8 @@ _equalHInfo(HInfo *a, HInfo *b)
Assert(IsA(b, HInfo)); Assert(IsA(b, HInfo));
if (a->hashop != b->hashop) if (a->hashop != b->hashop)
return (false); return false;
return (true); return true;
} }
/* XXX This equality function is a quick hack, should be /* XXX This equality function is a quick hack, should be
@ -507,42 +507,42 @@ _equalIndexScan(IndexScan *a, IndexScan *b)
*/ */
if (!equal((a->indxqual), (b->indxqual))) if (!equal((a->indxqual), (b->indxqual)))
return (false); return false;
if (a->scan.scanrelid != b->scan.scanrelid) if (a->scan.scanrelid != b->scan.scanrelid)
return (false); return false;
if (!equali((a->indxid), (b->indxid))) if (!equali((a->indxid), (b->indxid)))
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalSubPlan(SubPlan *a, SubPlan *b) _equalSubPlan(SubPlan *a, SubPlan *b)
{ {
if (a->plan_id != b->plan_id) if (a->plan_id != b->plan_id)
return (false); return false;
if (!equal((a->sublink->oper), (b->sublink->oper))) if (!equal((a->sublink->oper), (b->sublink->oper)))
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalJInfo(JInfo *a, JInfo *b) _equalJoinInfo(JoinInfo *a, JoinInfo *b)
{ {
Assert(IsA(a, JInfo)); Assert(IsA(a, JoinInfo));
Assert(IsA(b, JInfo)); Assert(IsA(b, JoinInfo));
if (!equal((a->otherrels), (b->otherrels))) if (!equal((a->otherrels), (b->otherrels)))
return (false); return false;
if (!equal((a->jinfoclauseinfo), (b->jinfoclauseinfo))) if (!equal((a->jinfoclauseinfo), (b->jinfoclauseinfo)))
return (false); return false;
if (a->mergejoinable != b->mergejoinable) if (a->mergejoinable != b->mergejoinable)
return (false); return false;
if (a->hashjoinable != b->hashjoinable) if (a->hashjoinable != b->hashjoinable)
return (false); return false;
return (true); return true;
} }
/* /*
@ -556,28 +556,28 @@ static bool
_equalEState(EState *a, EState *b) _equalEState(EState *a, EState *b)
{ {
if (a->es_direction != b->es_direction) if (a->es_direction != b->es_direction)
return (false); return false;
if (!equal(a->es_range_table, b->es_range_table)) if (!equal(a->es_range_table, b->es_range_table))
return (false); return false;
if (a->es_result_relation_info != b->es_result_relation_info) if (a->es_result_relation_info != b->es_result_relation_info)
return (false); return false;
return (true); return true;
} }
static bool static bool
_equalTargetEntry(TargetEntry *a, TargetEntry *b) _equalTargetEntry(TargetEntry *a, TargetEntry *b)
{ {
if (!equal(a->resdom, b->resdom)) if (!equal(a->resdom, b->resdom))
return (false); return false;
if (!equal(a->fjoin, b->fjoin)) if (!equal(a->fjoin, b->fjoin))
return (false); return false;
if (!equal(a->expr, b->expr)) if (!equal(a->expr, b->expr))
return (false); return false;
return (true); return true;
} }
@ -591,21 +591,21 @@ static bool
_equalValue(Value *a, Value *b) _equalValue(Value *a, Value *b)
{ {
if (a->type != b->type) if (a->type != b->type)
return (false); return false;
switch (a->type) switch (a->type)
{ {
case T_String: case T_String:
return strcmp(a->val.str, b->val.str); return strcmp(a->val.str, b->val.str);
case T_Integer: case T_Integer:
return (a->val.ival == b->val.ival); return a->val.ival == b->val.ival;
case T_Float: case T_Float:
return (a->val.dval == b->val.dval); return a->val.dval == b->val.dval;
default: default:
break; break;
} }
return (true); return true;
} }
/* /*
@ -618,19 +618,19 @@ equal(void *a, void *b)
bool retval = false; bool retval = false;
if (a == b) if (a == b)
return (true); return true;
/* /*
* note that a!=b, so only one of them can be NULL * note that a!=b, so only one of them can be NULL
*/ */
if (a == NULL || b == NULL) if (a == NULL || b == NULL)
return (false); return false;
/* /*
* are they the same type of nodes? * are they the same type of nodes?
*/ */
if (nodeTag(a) != nodeTag(b)) if (nodeTag(a) != nodeTag(b))
return (false); return false;
switch (nodeTag(a)) switch (nodeTag(a))
{ {
@ -673,8 +673,8 @@ equal(void *a, void *b)
case T_Func: case T_Func:
retval = _equalFunc(a, b); retval = _equalFunc(a, b);
break; break;
case T_CInfo: case T_ClauseInfo:
retval = _equalCInfo(a, b); retval = _equalClauseInfo(a, b);
break; break;
case T_RelOptInfo: case T_RelOptInfo:
retval = _equalRelOptInfo(a, b); retval = _equalRelOptInfo(a, b);
@ -712,8 +712,8 @@ equal(void *a, void *b)
case T_SubPlan: case T_SubPlan:
retval = _equalSubPlan(a, b); retval = _equalSubPlan(a, b);
break; break;
case T_JInfo: case T_JoinInfo:
retval = _equalJInfo(a, b); retval = _equalJoinInfo(a, b);
break; break;
case T_EState: case T_EState:
retval = _equalEState(a, b); retval = _equalEState(a, b);
@ -730,13 +730,13 @@ equal(void *a, void *b)
List *l; List *l;
if (a == NULL && b == NULL) if (a == NULL && b == NULL)
return (true); return true;
if (length(a) != length(b)) if (length(a) != length(b))
return (false); return false;
foreach(l, la) foreach(l, la)
{ {
if (!equal(lfirst(l), lfirst(lb))) if (!equal(lfirst(l), lfirst(lb)))
return (false); return false;
lb = lnext(lb); lb = lnext(lb);
} }
retval = true; retval = true;
@ -765,13 +765,13 @@ equali(List *a, List *b)
List *l; List *l;
if (a == NULL && b == NULL) if (a == NULL && b == NULL)
return (true); return true;
if (length(a) != length(b)) if (length(a) != length(b))
return (false); return false;
foreach(l, la) foreach(l, la)
{ {
if (lfirsti(l) != lfirsti(lb)) if (lfirsti(l) != lfirsti(lb))
return (false); return false;
lb = lnext(lb); lb = lnext(lb);
} }
return true; return true;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.13 1998/06/15 19:28:31 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.14 1998/09/01 03:22:56 momjian Exp $
* *
* NOTES * NOTES
* XXX a few of the following functions are duplicated to handle * XXX a few of the following functions are duplicated to handle
@ -54,7 +54,7 @@ makeList(void *elem,...)
va_end(args); va_end(args);
return (retval); return retval;
} }
List * List *
@ -105,7 +105,7 @@ nconc(List *l1, List *l2)
; ;
lnext(temp) = l2; lnext(temp) = l2;
return (l1); /* list1 is now list1[]list2 */ return l1; /* list1 is now list1+list2 */
} }
@ -116,17 +116,17 @@ nreverse(List *list)
List *p = NIL; List *p = NIL;
if (list == NULL) if (list == NULL)
return (NIL); return NIL;
if (length(list) == 1) if (length(list) == 1)
return (list); return list;
for (p = list; p != NULL; p = lnext(p)) for (p = list; p != NULL; p = lnext(p))
rlist = lcons(lfirst(p), rlist); rlist = lcons(lfirst(p), rlist);
lfirst(list) = lfirst(rlist); lfirst(list) = lfirst(rlist);
lnext(list) = lnext(rlist); lnext(list) = lnext(rlist);
return (list); return list;
} }
Value * Value *
@ -281,19 +281,19 @@ same(List *l1, List *l2)
List *temp = NIL; List *temp = NIL;
if (l1 == NULL) if (l1 == NULL)
return (l2 == NULL); return l2 == NULL;
if (l2 == NULL) if (l2 == NULL)
return (l1 == NULL); return l1 == NULL;
if (length(l1) == length(l2)) if (length(l1) == length(l2))
{ {
foreach(temp, l1) foreach(temp, l1)
{ {
if (!intMember(lfirsti(temp), l2)) if (!intMember(lfirsti(temp), l2))
return (false); return false;
} }
return (true); return true;
} }
return (false); return false;
} }
@ -305,10 +305,10 @@ LispUnion(List *l1, List *l2)
List *j = NIL; List *j = NIL;
if (l1 == NIL) if (l1 == NIL)
return (l2); /* XXX - should be copy of l2 */ return l2; /* XXX - should be copy of l2 */
if (l2 == NIL) if (l2 == NIL)
return (l1); /* XXX - should be copy of l1 */ return l1; /* XXX - should be copy of l1 */
foreach(i, l1) foreach(i, l1)
{ {
@ -324,7 +324,7 @@ LispUnion(List *l1, List *l2)
foreach(i, l2) foreach(i, l2)
retval = lappend(retval, lfirst(i)); retval = lappend(retval, lfirst(i));
return (retval); return retval;
} }
List * List *
@ -335,10 +335,10 @@ LispUnioni(List *l1, List *l2)
List *j = NIL; List *j = NIL;
if (l1 == NIL) if (l1 == NIL)
return (l2); /* XXX - should be copy of l2 */ return l2; /* XXX - should be copy of l2 */
if (l2 == NIL) if (l2 == NIL)
return (l1); /* XXX - should be copy of l1 */ return l1; /* XXX - should be copy of l1 */
foreach(i, l1) foreach(i, l1)
{ {
@ -354,7 +354,7 @@ LispUnioni(List *l1, List *l2)
foreach(i, l2) foreach(i, l2)
retval = lappendi(retval, lfirsti(i)); retval = lappendi(retval, lfirsti(i));
return (retval); return retval;
} }
/* /*
@ -369,8 +369,8 @@ member(void *l1, List *l2)
foreach(i, l2) foreach(i, l2)
if (equal((Node *) (lfirst(i)), (Node *) l1)) if (equal((Node *) (lfirst(i)), (Node *) l1))
return (true); return true;
return (false); return false;
} }
bool bool
@ -380,8 +380,8 @@ intMember(int l1, List *l2)
foreach(i, l2) foreach(i, l2)
if (l1 == lfirsti(i)) if (l1 == lfirsti(i))
return (true); return true;
return (false); return false;
} }
/* /*
@ -432,7 +432,7 @@ LispRemove(void *elem, List *list)
temp = lnext(temp); temp = lnext(temp);
prev = lnext(prev); prev = lnext(prev);
} }
return (list); return list;
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -457,7 +457,7 @@ intLispRemove(int elem, List *list)
temp = lnext(temp); temp = lnext(temp);
prev = lnext(prev); prev = lnext(prev);
} }
return (list); return list;
} }
#endif #endif
@ -469,14 +469,14 @@ set_difference(List *l1, List *l2)
List *result = NIL; List *result = NIL;
if (l2 == NIL) if (l2 == NIL)
return (l1); return l1;
foreach(temp1, l1) foreach(temp1, l1)
{ {
if (!member(lfirst(temp1), l2)) if (!member(lfirst(temp1), l2))
result = lappend(result, lfirst(temp1)); result = lappend(result, lfirst(temp1));
} }
return (result); return result;
} }
List * List *
@ -486,12 +486,12 @@ set_differencei(List *l1, List *l2)
List *result = NIL; List *result = NIL;
if (l2 == NIL) if (l2 == NIL)
return (l1); return l1;
foreach(temp1, l1) foreach(temp1, l1)
{ {
if (!intMember(lfirsti(temp1), l2)) if (!intMember(lfirsti(temp1), l2))
result = lappendi(result, lfirsti(temp1)); result = lappendi(result, lfirsti(temp1));
} }
return (result); return result;
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.7 1998/02/26 04:32:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.8 1998/09/01 03:22:57 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -33,9 +33,9 @@ bool
single_node(Node *node) single_node(Node *node)
{ {
if (IsA(node, Ident) ||IsA(node, Const) ||IsA(node, Var) ||IsA(node, Param)) if (IsA(node, Ident) ||IsA(node, Const) ||IsA(node, Var) ||IsA(node, Param))
return (true); return true;
else else
return (false); return false;
} }
/***************************************************************************** /*****************************************************************************
@ -60,13 +60,13 @@ single_node(Node *node)
bool bool
var_is_outer(Var *var) var_is_outer(Var *var)
{ {
return ((bool) (var->varno == OUTER)); return (bool) (var->varno == OUTER);
} }
static bool static bool
var_is_inner(Var *var) var_is_inner(Var *var)
{ {
return ((bool) (var->varno == INNER)); return (bool) (var->varno == INNER);
} }
bool bool
@ -94,7 +94,7 @@ replace_opid(Oper *oper)
{ {
oper->opid = get_opcode(oper->opno); oper->opid = get_opcode(oper->opno);
oper->op_fcache = NULL; oper->op_fcache = NULL;
return (oper); return oper;
} }
/***************************************************************************** /*****************************************************************************
@ -112,7 +112,7 @@ non_null(Expr *c)
{ {
if (IsA(c, Const) &&!((Const *) c)->constisnull) if (IsA(c, Const) &&!((Const *) c)->constisnull)
return (true); return true;
else else
return (false); return false;
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.5 1998/02/26 04:32:10 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.6 1998/09/01 03:22:58 momjian Exp $
* *
* HISTORY * HISTORY
* Andrew Yu Oct 20, 1994 file creation * Andrew Yu Oct 20, 1994 file creation
@ -41,5 +41,5 @@ newNode(Size size, NodeTag tag)
newNode = (Node *) palloc(size); newNode = (Node *) palloc(size);
MemSet((char *) newNode, 0, size); MemSet((char *) newNode, 0, size);
newNode->type = tag; newNode->type = tag;
return (newNode); return newNode;
} }

Some files were not shown because too many files have changed in this diff Show More