*
*
* 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
* The old interface functions have been converted to macros
*/
Size
ComputeDataSize(TupleDesc tupleDesc,
- Datum value[],
- char nulls[])
+ Datum *value,
+ char *nulls)
{
uint32 data_length;
int i;
int numberOfAttributes = tupleDesc->natts;
- AttributeTupleForm *att = tupleDesc->attrs;
+ Form_pg_attribute *att = tupleDesc->attrs;
for (data_length = 0, i = 0; i < numberOfAttributes; i++)
{
void
DataFill(char *data,
TupleDesc tupleDesc,
- Datum value[],
- char nulls[],
+ Datum *value,
+ char *nulls,
uint16 *infomask,
bits8 *bit)
{
uint32 data_length;
int i;
int numberOfAttributes = tupleDesc->natts;
- AttributeTupleForm *att = tupleDesc->attrs;
+ Form_pg_attribute *att = tupleDesc->attrs;
if (bit != NULL)
{
heap_attisnull(HeapTuple tup, int attnum)
{
if (attnum > (int) tup->t_natts)
- return (1);
+ return 1;
if (HeapTupleNoNulls(tup))
- return (0);
+ return 0;
if (attnum > 0)
- return (att_isnull(attnum - 1, tup->t_bits));
+ return att_isnull(attnum - 1, tup->t_bits);
else
switch (attnum)
{
elog(ERROR, "heap_attisnull: undefined negative attnum");
}
- return (0);
+ return 0;
}
/* ----------------------------------------------------------------
switch (attnum)
{
case SelfItemPointerAttributeNumber:
- return ((Datum) &tup->t_ctid);
+ return (Datum) &tup->t_ctid;
case ObjectIdAttributeNumber:
- return ((Datum) (long) tup->t_oid);
+ return (Datum) (long) tup->t_oid;
case MinTransactionIdAttributeNumber:
- return ((Datum) (long) tup->t_xmin);
+ return (Datum) (long) tup->t_xmin;
case MinCommandIdAttributeNumber:
- return ((Datum) (long) tup->t_cmin);
+ return (Datum) (long) tup->t_cmin;
case MaxTransactionIdAttributeNumber:
- return ((Datum) (long) tup->t_xmax);
+ return (Datum) (long) tup->t_xmax;
case MaxCommandIdAttributeNumber:
- return ((Datum) (long) tup->t_cmax);
+ return (Datum) (long) tup->t_cmax;
default:
elog(ERROR, "heap_getsysattr: undefined attnum %d", attnum);
}
- return ((Datum) NULL);
+ return (Datum) NULL;
}
/* ----------------
char *tp; /* ptr to att in tuple */
bits8 *bp = tup->t_bits; /* ptr to att in tuple */
int slow; /* do we have to walk nulls? */
- AttributeTupleForm *att = tupleDesc->attrs;
+ Form_pg_attribute *att = tupleDesc->attrs;
#if IN_MACRO
/*
* 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
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
- return ((Datum) fetchatt(&(att[0]), (char *) tp));
+ return (Datum) fetchatt(&(att[0]), (char *) tp);
else if (!HeapTupleAllFixed(tup))
{
int j = 0;
HeapTuple newTuple;
if (!HeapTupleIsValid(tuple))
- return (NULL);
+ return NULL;
newTuple = (HeapTuple) palloc(tuple->t_len);
memmove((char *) newTuple, (char *) tuple, (int) tuple->t_len);
- return (newTuple);
+ return newTuple;
}
#ifdef NOT_USED
void
heap_deformtuple(HeapTuple tuple,
TupleDesc tdesc,
- Datum values[],
- char nulls[])
+ Datum *values,
+ char *nulls)
{
int i;
int natts;
/* ----------------
* heap_formtuple
*
- * constructs a tuple from the given value[] and null[] arrays
+ * constructs a tuple from the given *value and *null arrays
*
* old comments
* Handles alignment by aligning 2 byte attributes on short boundries
* not properly align fixed length arrays of 1 or 2 byte types (yet).
*
* 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.)
* Assumes in order.
*/
HeapTuple
heap_formtuple(TupleDesc tupleDescriptor,
- Datum value[],
- char nulls[])
+ Datum *value,
+ char *nulls)
{
char *tp; /* tuple pointer */
HeapTuple tuple; /* return tuple */
tuple->t_infomask |= HEAP_XMAX_INVALID;
- return (tuple);
+ return tuple;
}
/* ----------------
HeapTuple
heap_modifytuple(HeapTuple tuple,
Relation relation,
- Datum replValue[],
- char replNull[],
- char repl[])
+ Datum *replValue,
+ char *replNull,
+ char *repl)
{
int attoff;
int numberOfAttributes;
Assert(PointerIsValid(replNull));
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.
* ----------------
*/
value[attoff] =
heap_getattr(tuple,
AttrOffsetGetAttrNumber(attoff),
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
&isNull);
nulls[attoff] = (isNull) ? 'n' : ' ';
}
/* ----------------
- * 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,
nulls);
memmove(tp, structure, structlen);
- return (tup);
+ return tup;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
IndexTuple
index_formtuple(TupleDesc tupleDescriptor,
- Datum value[],
- char null[])
+ Datum *value,
+ char *null)
{
char *tp; /* tuple pointer */
IndexTuple tuple; /* return tuple */
* ----------------
*/
tuple->t_info = infomask;
- return (tuple);
+ return tuple;
}
/* ----------------
char *bp = NULL; /* ptr to att in tuple */
int slow; /* do we have to walk nulls? */
int data_off; /* tuple data offset */
- AttributeTupleForm *att = tupleDesc->attrs;
+ Form_pg_attribute *att = tupleDesc->attrs;
/* ----------------
* sanity checks
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
- return ((Datum) fetchatt(&(att[0]), (char *) tp));
+ return (Datum) fetchatt(&(att[0]), (char *) tp);
else if (!IndexTupleAllFixed(tup))
{
int j = 0;
result->index_iptr = *indexItemPointer;
result->heap_iptr = *heapItemPointer;
- return (result);
+ return result;
}
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (isNull)
{
/* XXX eventually should check if SK_ISNULL */
- return (false);
+ return false;
}
if (key[0].sk_flags & SK_ISNULL)
- return (false);
+ return false;
if (key[0].sk_flags & SK_COMMUTE)
{
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- return (false);
+ return false;
scanKeySize -= 1;
key++;
}
- return (true);
+ return true;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
0, 0, 0);
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);
- return (InvalidOid);
+ return InvalidOid;
}
Oid
0, 0, 0);
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);
- return (InvalidOid);
+ return InvalidOid;
}
/* ----------------
*/
static void
printatt(unsigned attributeId,
- AttributeTupleForm attributeP,
+ Form_pg_attribute attributeP,
char *value)
{
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
{
int i;
int natts = tupleDesc->natts;
- AttributeTupleForm *attinfo = tupleDesc->attrs;
+ Form_pg_attribute *attinfo = tupleDesc->attrs;
puts(name);
for (i = 0; i < natts; ++i)
*
*
* 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
* some of the executor utility code such as "ExecTypeFromTL" should be
* is filled with NULL pointers.
* ----------------
*/
- size = natts * sizeof(AttributeTupleForm);
+ size = natts * sizeof(Form_pg_attribute);
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
- desc->attrs = (AttributeTupleForm *) palloc(size);
+ desc->attrs = (Form_pg_attribute *) palloc(size);
desc->constr = NULL;
MemSet(desc->attrs, 0, size);
desc->natts = natts;
- return (desc);
+ return desc;
}
/* ----------------------------------------------------------------
* CreateTupleDesc
*
- * This function allocates a new TupleDesc from AttributeTupleForm array
+ * This function allocates a new TupleDesc from Form_pg_attribute array
* ----------------------------------------------------------------
*/
TupleDesc
-CreateTupleDesc(int natts, AttributeTupleForm *attrs)
+CreateTupleDesc(int natts, Form_pg_attribute *attrs)
{
TupleDesc desc;
desc->natts = natts;
desc->constr = NULL;
- return (desc);
+ return desc;
}
/* ----------------------------------------------------------------
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts;
- size = desc->natts * sizeof(AttributeTupleForm);
- desc->attrs = (AttributeTupleForm *) palloc(size);
+ size = desc->natts * sizeof(Form_pg_attribute);
+ desc->attrs = (Form_pg_attribute *) palloc(size);
for (i = 0; i < desc->natts; i++)
{
desc->attrs[i] =
- (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove(desc->attrs[i],
tupdesc->attrs[i],
ATTRIBUTE_TUPLE_SIZE);
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts;
- size = desc->natts * sizeof(AttributeTupleForm);
- desc->attrs = (AttributeTupleForm *) palloc(size);
+ size = desc->natts * sizeof(Form_pg_attribute);
+ desc->attrs = (Form_pg_attribute *) palloc(size);
for (i = 0; i < desc->natts; i++)
{
desc->attrs[i] =
- (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove(desc->attrs[i],
tupdesc->attrs[i],
ATTRIBUTE_TUPLE_SIZE);
bool attisset)
{
HeapTuple tuple;
- TypeTupleForm typeForm;
- AttributeTupleForm att;
+ Form_pg_type typeForm;
+ Form_pg_attribute att;
/* ----------------
* sanity checks
* ----------------
*/
- att = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ att = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
desc->attrs[attributeNumber - 1] = att;
/* ----------------
* information from the type tuple we found..
* ----------------
*/
- typeForm = (TypeTupleForm) GETSTRUCT(tuple);
+ typeForm = (Form_pg_type) GETSTRUCT(tuple);
att->atttypid = tuple->t_oid;
att->attalign = typeForm->typalign;
AttrNumber attnum,
char *relname)
{
- AttributeTupleForm att;
+ Form_pg_attribute att;
Type t = typeidType(OIDOID);
att = desc->attrs[attnum - 1];
}
/* init the tuple descriptors and get set for a heap scan */
- hd = RelationGetTupleDescriptor(heap);
- id = RelationGetTupleDescriptor(index);
+ hd = RelationGetDescr(heap);
+ id = RelationGetDescr(index);
d = (Datum *) palloc(natts * sizeof(*d));
nulls = (bool *) palloc(natts * sizeof(*nulls));
compvec[i] = FALSE;
datum[i] = (Datum) tmpentry.pred;
}
- itup = index_formtuple(RelationGetTupleDescriptor(r), datum, nulls);
+ itup = index_formtuple(RelationGetDescr(r), datum, nulls);
itup->t_tid = *ht_ctid;
RelationSetLockForWrite(r);
pfree(compvec);
/* XXX two-phase locking -- don't unlock the relation until EOT */
- return (res);
+ return res;
}
/*
res = gistSplit(r, buffer, stack, itup, giststate);
gistfreestack(stack);
WriteBuffer(buffer); /* don't forget to release buffer! */
- return (res);
+ return res;
}
if (PageIsEmpty(page))
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), blk, l);
- return (res);
+ return res;
}
*retstack = stack;
*leafbuf = buffer;
- return (blk);
+ return blk;
}
(*fmgr_faddr(&giststate->equalFn)) (ev0p->pred, datum, &result);
if (!result)
{
- TupleDesc td = RelationGetTupleDescriptor(r);
+ TupleDesc td = RelationGetDescr(r);
/* compress datum for storage on page */
gistcentryinit(giststate, ¢ry, datum, ev0p->rel, ev0p->page,
pfree(ltup);
pfree(rtup);
- return (res);
+ return res;
}
/*
res = gistSplit(r, b, stk->gs_parent, tup, giststate);
WriteBuffer(b); /* don't forget to release buffer! -
* 01/31/94 */
- return (res);
+ return res;
}
else
{
pfree(tmpentry.pred);
if (tup != newtup)
pfree(newtup);
- return (res);
+ return res;
}
}
if (identry.pred != id)
pfree(identry.pred);
- return (which);
+ return which;
}
static int
gistnospace(Page p, IndexTuple it)
{
- return (PageGetFreeSpace(p) < IndexTupleSize(it));
+ return PageGetFreeSpace(p) < IndexTupleSize(it);
}
void
picksplit_proc,
equal_proc;
HeapTuple htup;
- IndexTupleForm itupform;
+ Form_pg_index itupform;
consistent_proc = index_getprocid(index, 1, GIST_CONSISTENT_PROC);
union_proc = index_getprocid(index, 1, GIST_UNION_PROC);
htup = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(index)),
0, 0, 0);
- itupform = (IndexTupleForm) GETSTRUCT(htup);
+ itupform = (Form_pg_index) GETSTRUCT(htup);
if (!HeapTupleIsValid(htup))
elog(ERROR, "initGISTstate: index %d not found",
RelationGetRelid(index));
itupform->indexrelid, FirstOffsetNumber);
return;
}
- giststate->keytypbyval = (((AttributeTupleForm) htup)->attbyval);
+ giststate->keytypbyval = (((Form_pg_attribute) htup)->attbyval);
}
else
giststate->keytypbyval = FALSE;
/* or in new size */
t->t_info |= MAXALIGN(entry.bytes + sizeof(IndexTupleData));
- return (t);
+ return t;
}
else
{
isnull);
newtup->t_tid = t->t_tid;
pfree(isnull);
- return (newtup);
+ return newtup;
}
}
*upper;
if (r == NULL)
- return (NULL);
+ return NULL;
result = (char *) palloc(NAMEDATALEN + VARSIZE(TRLOWER(r)) + VARSIZE(TRUPPER(r))
- 2 * VARHDRSZ);
sprintf(result, "[%s,%s): %d", lower, upper, r->flag);
pfree(lower);
pfree(upper);
- return (result);
+ return result;
}
#endif
char *result;
if (r == NULL)
- return (NULL);
+ return NULL;
result = (char *) palloc(80);
sprintf(result, "[%d,%d): %d", r->lower, r->upper, r->flag);
- return (result);
+ return result;
}
#endif /* defined GISTDEBUG */
/* if we have it cached in the scan desc, just return the value */
if ((res = gistscancache(s, dir)) != (RetrieveIndexResult) NULL)
- return (res);
+ return res;
/* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData)))
res = gistnext(s, dir);
else
res = gistfirst(s, dir);
- return (res);
+ return res;
}
static RetrieveIndexResult
ReleaseBuffer(b);
if (so->s_stack == (GISTSTACK *) NULL)
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
stk = so->s_stack;
b = ReadBuffer(s->relation, stk->gs_blk);
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b);
- return (res);
+ return res;
}
else
{
ReleaseBuffer(b);
if (so->s_stack == (GISTSTACK *) NULL)
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
stk = so->s_stack;
b = ReadBuffer(s->relation, stk->gs_blk);
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b);
- return (res);
+ return res;
}
else
{
if (isNull)
{
/* XXX eventually should check if SK_ISNULL */
- return (false);
+ return false;
}
if (key[0].sk_flags & SK_COMMUTE)
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- return (false);
+ return false;
scanKeySize -= 1;
key++;
}
- return (true);
+ return true;
}
{
it = (char *) PageGetItem(p, PageGetItemId(p, n));
if (gistindex_keytest((IndexTuple) it,
- RelationGetTupleDescriptor(s->relation),
+ RelationGetDescr(s->relation),
s->numberOfKeys, s->keyData, giststate,
s->relation, p, n))
break;
n = OffsetNumberNext(n);
}
- return (n);
+ return n;
}
static RetrieveIndexResult
&& ItemPointerIsValid(&(s->currentItemData))))
{
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
ip = gistheapptr(s->relation, &(s->currentItemData));
pfree(ip);
- return (res);
+ return res;
}
/*
else
ItemPointerSetInvalid(ip);
- return (ip);
+ return ip;
}
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
gistregscan(s);
- return (s);
+ return s;
}
void
AttrNumber attnum,
RegProcedure proc)
{
- return (RelationGetStrategy(r, attnum, &GISTEvaluationData, proc));
+ return RelationGetStrategy(r, attnum, &GISTEvaluationData, proc);
}
#ifdef NOT_USED
*
*
* 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
* This file contains only the public interface routines.
_hash_metapinit(index);
/* get tuple descriptors for heap and index relations */
- htupdesc = RelationGetTupleDescriptor(heap);
- itupdesc = RelationGetTupleDescriptor(index);
+ htupdesc = RelationGetDescr(heap);
+ itupdesc = RelationGetDescr(index);
/* get space for data items that'll appear in the index tuple */
attdata = (Datum *) palloc(natts * sizeof(Datum));
/* generate an index tuple */
- itup = index_formtuple(RelationGetTupleDescriptor(rel), datum, nulls);
+ itup = index_formtuple(RelationGetDescr(rel), datum, nulls);
itup->t_tid = *ht_ctid;
if (itup->t_info & INDEX_NULL_MASK)
- return ((InsertIndexResult) NULL);
+ return (InsertIndexResult) NULL;
hitem = _hash_formitem(itup);
pfree(hitem);
pfree(itup);
- return (res);
+ return res;
}
else
res = _hash_first(scan, dir);
- return ((char *) res);
+ return (char *) res;
}
/* register scan in case we change pages it's using */
_hash_regscan(scan);
- return ((char *) scan);
+ return (char *) scan;
}
/*
*
*
* 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
* These functions are stored in pg_amproc. For each operator class
uint32
hashint2(int16 key)
{
- return ((uint32) ~key);
+ return (uint32) ~key;
}
uint32
hashint4(uint32 key)
{
- return (~key);
+ return ~key;
}
/* Hash function from Chris Torek. */
} while (--loop);
}
}
- return (h);
+ return h;
}
} while (--loop);
}
}
- return (h);
+ return h;
}
uint32
hashoid(Oid key)
{
- return ((uint32) ~key);
+ return (uint32) ~key;
}
uint32
-hashoid8(Oid key[])
+hashoid8(Oid *key)
{
int i;
uint32 result = 0;
h = h * PRIME1 ^ (key - ' ');
h %= PRIME2;
- return (h);
+ return h;
}
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
- return (h);
+ return h;
}
} while (--loop);
}
}
- return (n);
+ return n;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* be tidy */
_hash_freeskey(itup_scankey);
- return (res);
+ return res;
}
/*
> metap->hashm_ffactor)
_hash_expandtable(rel, metabuf);
_hash_relbuf(rel, metabuf, HASH_READ);
- return (res);
+ return res;
}
/*
/* write the buffer, but hold our lock */
_hash_wrtnorelbuf(rel, buf);
- return (itup_off);
+ return itup_off;
}
*
*
* 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
* Overflow pages look like ordinary relation pages.
/* logically chain overflow page to previous page */
pageopaque->hasho_nextblkno = ovflblkno;
_hash_wrtnorelbuf(rel, buf);
- return (ovflbuf);
+ return ovflbuf;
}
/*
/* Calculate address of the new overflow page */
oaddr = OADDR_OF(splitnum, offset);
_hash_chgbufaccess(rel, metabufp, HASH_WRITE, HASH_READ);
- return (oaddr);
+ return oaddr;
found:
bit = bit + _hash_firstfreebit(freep[j]);
/* initialize this page */
oaddr = OADDR_OF(i, offset);
_hash_chgbufaccess(rel, metabufp, HASH_WRITE, HASH_READ);
- return (oaddr);
+ return oaddr;
}
/*
for (i = 0; i < BITS_PER_MAP; i++)
{
if (!(mask & map))
- return (i);
+ return i;
mask = mask << 1;
}
- return (i);
+ return i;
}
/*
* return that buffer with a write lock.
*/
if (BlockNumberIsValid(nextblkno))
- return (_hash_getbuf(rel, nextblkno, HASH_WRITE));
+ return _hash_getbuf(rel, nextblkno, HASH_WRITE);
else
- return (InvalidBuffer);
+ return InvalidBuffer;
}
/* write out the new bitmap page (releasing its locks) */
_hash_wrtbuf(rel, buf);
- return (0);
+ return 0;
}
*
*
* 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
* Postgres hash pages look like ordinary relation pages. The opaque
buf = ReadBuffer(rel, blkno);
/* ref count and lock type are correct */
- return (buf);
+ return buf;
}
/*
break;
}
*bufp = _hash_getbuf(rel, blkno, to_access);
- return (BufferGetPage(*bufp));
+ return BufferGetPage(*bufp);
}
/*
/* hash on the tuple */
hitem = (HashItem) PageGetItem(opage, PageGetItemId(opage, ooffnum));
itup = &(hitem->hash_itup);
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
datum = index_getattr(itup, 1, itupdesc, &null);
bucket = _hash_call(rel, metap, datum);
*
*
* 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
* Because we can be doing an index scan on a relation while we
if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno)
- return (true);
+ return true;
current = &(scan->currentMarkData);
if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno)
- return (true);
+ return true;
- return (false);
+ return false;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* next tuple, we come back with a lock on that buffer.
*/
if (!_hash_step(scan, &buf, dir, metabuf))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
/* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData);
itup = &hitem->hash_itup;
res = FormRetrieveIndexResult(current, &(itup->t_tid));
- return (res);
+ return res;
}
static void
{
_hash_relbuf(rel, buf, HASH_READ);
_hash_relbuf(rel, metabuf, HASH_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
}
}
}
if (!_hash_step(scan, &buf, dir, metabuf))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
/* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData);
itup = &hitem->hash_itup;
res = FormRetrieveIndexResult(current, &(itup->t_tid));
- return (res);
+ return res;
}
/*
_hash_relbuf(rel, metabuf, HASH_READ);
*bufP = so->hashso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
/* get ready to check this tuple */
blkno = BufferGetBlockNumber(buf);
*bufP = so->hashso_curbuf = buf;
ItemPointerSet(current, blkno, offnum);
- return (true);
+ return true;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Assert(StrategyNumberIsValid(strat));
- return (strat);
+ return strat;
}
#endif
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
bool null;
natts = rel->rd_rel->relnatts;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
0x0, (AttrNumber) (i + 1), proc, arg);
}
- return (skey);
+ return skey;
}
void
{
if (scan->numberOfKeys > 0)
return (index_keytest(itup,
- RelationGetTupleDescriptor(scan->relation),
+ RelationGetDescr(scan->relation),
scan->numberOfKeys, scan->keyData));
else
- return (true);
+ return true;
}
HashItem
hitem = (HashItem) palloc(nbytes_hitem);
memmove((char *) &(hitem->hash_itup), (char *) itup, tuplen);
- return (hitem);
+ return hitem;
}
Bucket
bucket = n & metap->hashm_highmask;
if (bucket > metap->hashm_maxbucket)
bucket = bucket & metap->hashm_lowmask;
- return (bucket);
+ return bucket;
}
/*
limit = 1;
for (i = 0; limit < num; limit = limit << 1, i++)
;
- return (i);
+ return i;
}
/*
*
*
* 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
static int
nextpage(int page, int dir)
{
- return ((dir < 0) ? page - 1 : page + 1);
+ return (dir < 0) ? page - 1 : page + 1;
}
/* ----------------
* ----------------
*/
if (!(pages = relation->rd_nblocks))
- return (NULL);
+ return NULL;
/* ----------------
* calculate next starting lineoff, given scan direction
if (ItemPointerIsValid(tid) == false)
{
*buf= InvalidBuffer;
- return (NULL);
+ return NULL;
}
*buf = RelationGetBufferWithBuffer(relation,
ItemPointerGetBlockNumber(tid),
lpp = PageGetItemId(dp, lineoff);
rtup = (HeapTuple) PageGetItem((Page) dp, lpp);
- return (rtup);
+ return rtup;
}
else if (dir < 0)
if (page < 0)
{
*buf = InvalidBuffer;
- return (NULL);
+ return NULL;
}
*buf = RelationGetBufferWithBuffer(relation, page, *buf);
if (page >= pages)
{
*buf = InvalidBuffer;
- return (NULL);
+ return NULL;
}
/* page and lineoff now reference the physically next tid */
*/
ItemPointerSetBlockNumber(iptr, page);
}
- return (rtup);
+ return rtup;
}
/* ----------------
if (BufferIsValid(*buf))
ReleaseBuffer(*buf);
*buf = InvalidBuffer;
- return (NULL);
+ return NULL;
}
*buf = ReleaseAndReadBuffer(*buf, relation, page);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
- return (r);
+ return r;
}
/* ----------------
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
- return (r);
+ return r;
}
/* ----------------
scan->rs_snapshot = snapshot;
scan->rs_nkeys = (short) nkeys;
- return (scan);
+ return scan;
}
/* ----------------
{
if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf);
- return (NULL);
+ return NULL;
}
/*
ReleaseBuffer(scan->rs_nbuf);
scan->rs_ntup = NULL;
scan->rs_nbuf = InvalidBuffer;
- return (NULL);
+ return NULL;
}
if (BufferIsValid(scan->rs_pbuf))
if (BufferIsValid(scan->rs_pbuf))
ReleaseBuffer(scan->rs_pbuf);
HEAPDEBUG_3; /* heap_getnext returns NULL at end */
- return (NULL);
+ return NULL;
}
/*
scan->rs_ptup = NULL;
scan->rs_pbuf = InvalidBuffer;
HEAPDEBUG_6; /* heap_getnext returning EOS */
- return (NULL);
+ return NULL;
}
if (BufferIsValid(scan->rs_nbuf))
if (tuple == NULL)
{
ReleaseBuffer(buffer);
- return (NULL);
+ return NULL;
}
/* ----------------
*userbuf = buffer; /* user is required to ReleaseBuffer() this */
- return (tuple);
+ return tuple;
}
/* ----------------
SetRefreshWhenInvalidate((bool) !ImmediateInvalidation);
}
- return (tup->t_oid);
+ return tup->t_oid;
}
/* ----------------
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation);
ReleaseBuffer(buf);
- return (1);
+ return 1;
}
/* ----------------
* check that we're deleteing a valid item
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation);
- return (0);
+ return 0;
}
/* ----------------
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation);
ReleaseBuffer(buffer);
- return (1);
+ return 1;
}
/* ----------------
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation);
- return (0);
+ return 0;
}
/* ----------------
*
*
* 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
* many of the old access method routines have been turned into
index_rescan(scan, scanFromEnd, key);
- return (scan);
+ return scan;
}
#ifdef NOT_USED
*
*
* 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
* index_open - open an index relation by relationId
* ----------------
*/
- return (specificResult);
+ return specificResult;
}
/* ----------------
Assert(loc != NULL);
- return (loc[(natts * (procnum - 1)) + (attnum - 1)]);
+ return loc[(natts * (procnum - 1)) + (attnum - 1)];
}
Datum
GetIndexValue(HeapTuple tuple,
TupleDesc hTupDesc,
int attOff,
- AttrNumber attrNums[],
+ AttrNumber *attrNums,
FuncIndexInfo *fInfo,
bool *attNull)
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
Assert(StrategyMapIsValid(map));
Assert(StrategyNumberIsValid(strategyNumber));
- return (&map->entry[strategyNumber - 1]);
+ return &map->entry[strategyNumber - 1];
}
/*
}
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);
entry->sk_nargs = entry->sk_func.fn_nargs;
/*
* 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++)
{
- IndexTupleForm iform;
+ Form_pg_index iform;
- iform = (IndexTupleForm) GETSTRUCT(tuple);
+ iform = (Form_pg_index) GETSTRUCT(tuple);
if (!OidIsValid(iform->indkey[attributeIndex]))
{
*
*
* 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
* These functions are stored in pg_amproc. For each operator class
}
int32
-btoid8cmp(Oid a[], Oid b[])
+btoid8cmp(Oid *a, Oid *b)
{
int i;
for (i=0; i < 8; i++)
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Buffer nbuf;
BlockNumber blkno;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
nbuf = InvalidBuffer;
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
_bt_freestack(stack);
_bt_freeskey(itup_scankey);
- return (res);
+ return res;
}
/*
keysz, scankey, stack->bts_btitem,
NULL);
ItemPointerSet(&(res->pointerData), itup_blkno, itup_off);
- return (res);
+ return res;
}
}
else
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), itup_blkno, itup_off);
- return (res);
+ return res;
}
/*
}
/* split's done */
- return (rbuf);
+ return rbuf;
}
/*
if (saferight == maxoff && (maxoff - start) > 1)
saferight = start + (maxoff - start) / 2;
- return (saferight);
+ return saferight;
}
/*
/* write the buffer, but hold our lock */
_bt_wrtnorelbuf(rel, buf);
- return (itup_off);
+ return itup_off;
}
/*
/* no right neighbor? */
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (P_RIGHTMOST(opaque))
- return (true);
+ return true;
/*
* this is a non-rightmost page, so it must have a high key item.
*/
hikey = PageGetItemId(page, P_HIKEY);
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 (_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 (afteritem == (BTItem) NULL)
{
if (opaque->btpo_flags & BTP_LEAF)
- return (false);
+ return false;
if (opaque->btpo_flags & BTP_CHAIN)
- return (true);
+ return true;
if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber))
- return (true);
- return (false);
+ return true;
+ return false;
}
/* damn, have to work for it. i hate that. */
}
}
- return (found);
+ return found;
}
/*
strat = BTGreaterStrategyNumber;
}
- tupDes = RelationGetTupleDescriptor(rel);
+ tupDes = RelationGetDescr(rel);
indexTuple1 = &(item1->bti_itup);
indexTuple2 = &(item2->bti_itup);
if (compare) /* true for one of ">, <, =" */
{
if (strat != BTEqualStrategyNumber)
- return (true);
+ return true;
}
else
/* false for one of ">, <, =" */
{
if (strat == BTEqualStrategyNumber)
- return (false);
+ return false;
/*
* if original strat was "<=, >=" OR "<, >" but some
if (compare) /* item1' and item2' attributes are equal */
continue; /* - try to compare next attributes */
}
- return (false);
+ return false;
}
}
- return (true);
+ return true;
}
/*
/* NULLs are not equal */
if (entry->sk_flags & SK_ISNULL || null)
- return (false);
+ return false;
result = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
if (result != 0)
- return (false);
+ return false;
}
/* by here, the keys are equal */
- return (true);
+ return true;
}
#ifdef NOT_USED
ItemPointerSet(&(res->pointerData), nbknum, P_HIKEY);
- return (res);
+ return res;
}
#endif
*
*
* 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
* Postgres btree pages look like ordinary relation pages. The opaque
*/
_bt_relbuf(rel, metabuf, BT_WRITE);
- return (_bt_getroot(rel, access));
+ return _bt_getroot(rel, access);
}
}
else
/* it happened, try again */
_bt_relbuf(rel, rootbuf, access);
- return (_bt_getroot(rel, access));
+ return _bt_getroot(rel, access);
}
/*
* Return the root block.
*/
- return (rootbuf);
+ return rootbuf;
}
/*
}
/* ref count and lock type are correct */
- return (buf);
+ return buf;
}
/*
item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save;
- return (buf);
+ return buf;
}
/* if the item has just moved right on this page, we're done */
item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save;
- return (buf);
+ return buf;
}
}
}
item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save;
- return (buf);
+ return buf;
}
}
}
*
*
* 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
* This file contains only the public interface routines.
_bt_metapinit(index);
/* get tuple descriptors for heap and index relations */
- htupdesc = RelationGetTupleDescriptor(heap);
- itupdesc = RelationGetTupleDescriptor(index);
+ htupdesc = RelationGetDescr(heap);
+ itupdesc = RelationGetDescr(index);
/* get space for data items that'll appear in the index tuple */
attdata = (Datum *) palloc(natts * sizeof(Datum));
InsertIndexResult res;
/* generate an index tuple */
- itup = index_formtuple(RelationGetTupleDescriptor(rel), datum, nulls);
+ itup = index_formtuple(RelationGetDescr(rel), datum, nulls);
itup->t_tid = *ht_ctid;
/*
* 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);
_bt_adjscans(rel, &(res->pointerData), BT_INSERT);
#endif
- return (res);
+ return res;
}
/*
if (res)
((BTScanOpaque)scan->opaque)->curHeapIptr = res->heap_iptr;
- return ((char *) res);
+ return (char *) res;
}
/*
/* register scan in case we change pages it's using */
_bt_regscan(scan);
- return ((char *) scan);
+ return (char *) scan;
}
/*
*
*
* 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
if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno)
- return (true);
+ return true;
current = &(scan->currentMarkData);
if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno)
- return (true);
+ return true;
- return (false);
+ return false;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
_bt_search(Relation rel, int keysz, ScanKey scankey, Buffer *bufP)
{
*bufP = _bt_getroot(rel, BT_READ);
- return (_bt_searchr(rel, keysz, scankey, bufP, (BTStack) NULL));
+ return _bt_searchr(rel, keysz, scankey, bufP, (BTStack) NULL);
}
/*
page = BufferGetPage(*bufP);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (opaque->btpo_flags & BTP_LEAF)
- return (stack_in);
+ return stack_in;
/*
* Find the appropriate item on the internal page, and get the child
*bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ);
/* okay, all set to move down a level */
- return (_bt_searchr(rel, keysz, scankey, bufP, stack));
+ return _bt_searchr(rel, keysz, scankey, bufP, stack);
}
/*
/* if we're on a rightmost page, we don't need to move right */
if (P_RIGHTMOST(opaque))
- return (buf);
+ return buf;
/* by convention, item 0 on non-rightmost pages is the high key */
hikey = PageGetItemId(page, P_HIKEY);
&& _bt_skeycmp(rel, keysz, scankey, page, hikey,
BTGreaterEqualStrategyNumber));
}
- return (buf);
+ return buf;
}
/*
item = (BTItem) PageGetItem(page, itemid);
indexTuple = &(item->bti_itup);
- tupDes = RelationGetTupleDescriptor(rel);
+ tupDes = RelationGetDescr(rel);
/* see if the comparison is true for all of the key attributes */
for (i = 1; i <= keysz; i++)
if (compare) /* true for one of ">, <, =" */
{
if (strat != BTEqualStrategyNumber)
- return (true);
+ return true;
}
else
/* false for one of ">, <, =" */
{
if (strat == BTEqualStrategyNumber)
- return (false);
+ return false;
/*
* if original strat was "<=, >=" OR "<, >" but some
if (compare) /* key' and item' attributes are equal */
continue; /* - try to compare next attributes */
}
- return (false);
+ return false;
}
}
- return (true);
+ return true;
}
/*
int natts = rel->rd_rel->relnatts;
int result;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
*/
if (PageIsEmpty(page))
- return (low);
+ return low;
if ((!P_RIGHTMOST(opaque) && high <= low))
{
if (high < low ||
(srchtype == BT_DESCENT && !(opaque->btpo_flags & BTP_LEAF)))
- return (low);
+ return low;
/* It's insertion and high == low == 2 */
result = _bt_compare(rel, itupdesc, page, keysz, scankey, low);
if (result > 0)
- return (OffsetNumberNext(low));
- return (low);
+ return OffsetNumberNext(low);
+ return low;
}
while ((high - low) > 1)
* code (natts == keysz). - vadim 04/15/97
*/
if (natts == keysz || opaque->btpo_flags & BTP_LEAF)
- return (mid);
+ return mid;
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (mid == low)
- return (mid);
- return (OffsetNumberPrev(mid));
+ return mid;
+ return OffsetNumberPrev(mid);
}
}
* comments above for multi-column indices.
*/
if (natts == keysz)
- return (mid);
+ return mid;
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (mid == low)
- return (mid);
- return (OffsetNumberPrev(mid));
+ return mid;
+ return OffsetNumberPrev(mid);
}
else if (result > 0)
- return (high);
+ return high;
else
- return (low);
+ return low;
}
else
/* we want the first key >= the scan key */
{
result = _bt_compare(rel, itupdesc, page, keysz, scankey, low);
if (result <= 0)
- return (low);
+ return low;
else
{
if (low == high)
- return (OffsetNumberNext(low));
+ return OffsetNumberNext(low);
result = _bt_compare(rel, itupdesc, page, keysz, scankey, high);
if (result <= 0)
- return (high);
+ return high;
else
- return (OffsetNumberNext(high));
+ return OffsetNumberNext(high);
}
}
}
keysz, scankey, OffsetNumberPrev(offnum)) == 0)
offnum = OffsetNumberPrev(offnum);
- return (offnum);
+ return offnum;
}
/*
if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber))
- return (0);
- return (1);
+ return 0;
+ return 1;
#endif
}
/* if the keys are unequal, return the difference */
if (result != 0)
- return (result);
+ return result;
}
/* by here, the keys are equal */
- return (0);
+ return 0;
}
/*
{
/* step one tuple in the appropriate direction */
if (!_bt_step(scan, &buf, dir))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
/* by here, current is the tuple we want to return */
offnum = ItemPointerGetOffsetNumber(current);
/* remember which buffer we have pinned and locked */
so->btso_curbuf = buf;
- return (res);
+ return res;
}
} while (keysok >= so->numberOfFirstKeys);
so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
/*
scan->scanFromEnd = true;
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 (scan->scanFromEnd)
- return (_bt_endpoint(scan, dir));
+ return _bt_endpoint(scan, dir);
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
current = &(scan->currentItemData);
/*
if (so->keyData[0].sk_flags & SK_ISNULL)
{
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);
ScanKeyEntryInitialize(&skdata, so->keyData[0].sk_flags, 1, proc,
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
maxoff = PageGetMaxOffsetNumber(page);
pop = (BTPageOpaque) PageGetSpecialPointer(page);
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
maxoff = PageGetMaxOffsetNumber(page);
pop = (BTPageOpaque) PageGetSpecialPointer(page);
_bt_relbuf(scan->relation, buf, BT_READ);
so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
break;
_bt_relbuf(scan->relation, buf, BT_READ);
so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
}
else if (result > 0)
else if (keysok >= so->numberOfFirstKeys)
{
so->btso_curbuf = buf;
- return (_bt_next(scan, dir));
+ return _bt_next(scan, dir);
}
else
{
res = (RetrieveIndexResult) NULL;
}
- return (res);
+ return res;
}
/*
_bt_relbuf(rel, *bufP, BT_READ);
ItemPointerSetInvalid(current);
*bufP = so->btso_curbuf = InvalidBuffer;
- return (false);
+ return false;
}
else
{
{
*bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
}
}
_bt_relbuf(rel, *bufP, BT_READ);
*bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
else
{
{
*bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
}
}
so->btso_curbuf = *bufP;
ItemPointerSet(current, blkno, offnum);
- return (true);
+ return true;
}
/*
if (ScanDirectionIsForward(dir) && offnum < maxoff)
{ /* XXX PageIsEmpty? */
ItemPointerSet(current, blkno, OffsetNumberNext(offnum));
- return (true);
+ return true;
}
else if (ScanDirectionIsBackward(dir) && offnum > start)
{
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 (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
- return (false);
+ return false;
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
if (_bt_step(scan, bufP, dir))
{
pfree(svitem);
- return (true);
+ return true;
}
/* try to find our place again */
{
pfree(svitem);
ItemPointerSet(current, blkno, offnum);
- return (false);
+ return false;
}
}
elog(ERROR, "btree synchronization error: concurrent update botched scan");
- return (false);
+ return false;
}
/*
{
ItemPointerSet(current, blkno, maxoff);
if (!_bt_step(scan, &buf, BackwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
_bt_relbuf(rel, buf, BT_READ);
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
if (start > maxoff) /* start == 2 && maxoff == 1 */
{
ItemPointerSet(current, blkno, maxoff);
if (!_bt_step(scan, &buf, ForwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
{
ItemPointerSet(current, blkno, FirstOffsetNumber);
if (!_bt_step(scan, &buf, ForwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
_bt_relbuf(rel, buf, BT_READ);
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
/* Go back ! */
ItemPointerSet(current, blkno, FirstOffsetNumber);
if (!_bt_step(scan, &buf, BackwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
else if (keysok >= so->numberOfFirstKeys)
{
so->btso_curbuf = buf;
- return (_bt_next(scan, dir));
+ return _bt_next(scan, dir);
}
else
{
res = (RetrieveIndexResult) NULL;
}
- return (res);
+ return res;
}
*
*
* 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
*
if (k1->btsk_item == (BTItem) NULL)
{
if (k2->btsk_item == (BTItem) NULL)
- return (0); /* 1 = 2 */
- return (1); /* 1 > 2 */
+ return 0; /* 1 = 2 */
+ return 1; /* 1 > 2 */
}
else if (k2->btsk_item == (BTItem) NULL)
- return (-1); /* 1 < 2 */
+ return -1; /* 1 < 2 */
for (i = 0; i < _bt_nattr; i++)
{
equal_isnull = true;
continue;
}
- return (1); /* NULL ">" NOT_NULL */
+ return 1; /* NULL ">" NOT_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,
k1_datum[i], k2_datum[i]))
- return (1); /* 1 > 2 */
+ return 1; /* 1 > 2 */
else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k2_datum[i], k1_datum[i]))
- return (-1); /* 1 < 2 */
+ return -1; /* 1 < 2 */
}
if (_bt_inspool->isunique && !equal_isnull)
_bt_spooldestroy((void *) _bt_inspool);
elog(ERROR, "Cannot create unique index. Table contains non-unique values");
}
- return (0); /* 1 = 2 */
+ return 0; /* 1 = 2 */
}
static void
{
if (q->btpq_nelem < 1)
{ /* already empty */
- return (-1);
+ return -1;
}
*e = q->btpq_queue[0]; /* struct = */
if (--q->btpq_nelem < 1)
{ /* now empty, don't sift */
- return (0);
+ return 0;
}
q->btpq_queue[0] = q->btpq_queue[q->btpq_nelem]; /* struct = */
_bt_pqsift(q, 0);
- return (0);
+ return 0;
}
static void
/* initialize the buffer */
_bt_tapereset(tape);
- return (tape);
+ return tape;
}
/*
if (tape->bttb_eor)
{
- return (0); /* we are already at End-Of-Run */
+ return 0; /* we are already at End-Of-Run */
}
/*
if (nread != TAPEBLCKSZ)
{
Assert(nread == 0); /* we are at EOF */
- return (0);
+ return 0;
}
Assert(tape->bttb_magic == BTTAPEMAGIC);
NDirectFileRead += TAPEBLCKSZ / BLCKSZ;
- return (1);
+ return 1;
}
/*
BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
- return ((BTItem) NULL);
+ return (BTItem) NULL;
bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz);
- return (bti);
+ return bti;
}
/*
_bt_isortcmpinit(index, btspool);
- return ((void *) btspool);
+ return (void *) btspool;
}
/*
state->btps_level = level;
state->btps_doupper = doupper;
- return ((void *) state);
+ return (void *) state;
}
/*
nbti = _bt_formitem(&(obti->bti_itup));
ItemPointerSet(&(nbti->bti_itup.t_tid), oblkno, P_HIKEY);
- return (nbti);
+ return nbti;
}
/*
state->btps_lastoff = last_off;
state->btps_firstoff = first_off;
- return (last_bti);
+ return last_bti;
}
static void
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Assert(StrategyNumberIsValid(strat));
- return (strat);
+ return strat;
}
bool
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
bits16 flag;
natts = rel->rd_rel->relnatts;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
ScanKeyEntryInitialize(&skey[i], flag, (AttrNumber) (i + 1), proc, arg);
}
- return (skey);
+ return skey;
}
void
#ifndef BTREE_VERSION_1
btitem->bti_oid = newoid();
#endif
- return (btitem);
+ return btitem;
}
#ifdef NOT_USED
so = (BTScanOpaque) scan->opaque;
if (so->numberOfKeys > 0)
- return (index_keytest(itup, RelationGetTupleDescriptor(scan->relation),
+ return (index_keytest(itup, RelationGetDescr(scan->relation),
so->numberOfKeys, so->keyData));
else
- return (true);
+ return true;
}
#endif
so = (BTScanOpaque) scan->opaque;
if (keysz > 0 && so->numberOfKeys >= keysz)
- return (index_keytest(itup, RelationGetTupleDescriptor(scan->relation),
+ return (index_keytest(itup, RelationGetDescr(scan->relation),
keysz, so->keyData));
else
- return (true);
+ return true;
}
#endif
*keysok = 0;
if (keysz == 0)
- return (true);
+ return true;
key = so->keyData;
- tupdesc = RelationGetTupleDescriptor(scan->relation);
+ tupdesc = RelationGetDescr(scan->relation);
IncrIndexProcessed();
/* btree doesn't support 'A is null' clauses, yet */
if (isNull || key[0].sk_flags & SK_ISNULL)
- return (false);
+ return false;
if (key[0].sk_flags & SK_COMMUTE)
{
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- return (false);
+ return false;
keysz -= 1;
key++;
(*keysok)++;
}
- return (true);
+ return true;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* if we have it cached in the scan desc, just return the value */
if ((res = rtscancache(s, dir)) != (RetrieveIndexResult) NULL)
- return (res);
+ return res;
/* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData)))
res = rtnext(s, dir);
else
res = rtfirst(s, dir);
- return (res);
+ return res;
}
static RetrieveIndexResult
ReleaseBuffer(b);
if (so->s_stack == (RTSTACK *) NULL)
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
stk = so->s_stack;
b = ReadBuffer(s->relation, stk->rts_blk);
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b);
- return (res);
+ return res;
}
else
{
ReleaseBuffer(b);
if (so->s_stack == (RTSTACK *) NULL)
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
stk = so->s_stack;
b = ReadBuffer(s->relation, stk->rts_blk);
res = FormRetrieveIndexResult(&(s->currentItemData), &(it->t_tid));
ReleaseBuffer(b);
- return (res);
+ return res;
}
else
{
if (po->flags & F_LEAF)
{
if (index_keytest(it,
- RelationGetTupleDescriptor(s->relation),
+ RelationGetDescr(s->relation),
s->numberOfKeys, s->keyData))
break;
}
else
{
if (index_keytest(it,
- RelationGetTupleDescriptor(s->relation),
+ RelationGetDescr(s->relation),
so->s_internalNKey, so->s_internalKey))
break;
}
n = OffsetNumberNext(n);
}
- return (n);
+ return n;
}
static RetrieveIndexResult
&& ItemPointerIsValid(&(s->currentItemData))))
{
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
ip = rtheapptr(s->relation, &(s->currentItemData));
pfree(ip);
- return (res);
+ return res;
}
/*
else
ItemPointerSetInvalid(ip);
- return (ip);
+ return ip;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
n->low.x = Min(a->low.x, b->low.x);
n->low.y = Min(a->low.y, b->low.y);
- return (n);
+ return n;
}
BOX *
if (n->high.x < n->low.x || n->high.y < n->low.y)
{
pfree(n);
- return ((BOX *) NULL);
+ return (BOX *) NULL;
}
- return (n);
+ return n;
}
void
if (p->boundbox.high.x < p->boundbox.low.x || p->boundbox.high.y < p->boundbox.low.y)
{
pfree(p);
- return ((POLYGON *) NULL);
+ return (POLYGON *) NULL;
}
- return (p);
+ return p;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
/* init the tuple descriptors and get set for a heap scan */
- hd = RelationGetTupleDescriptor(heap);
- id = RelationGetTupleDescriptor(index);
+ hd = RelationGetDescr(heap);
+ id = RelationGetDescr(index);
d = (Datum *) palloc(natts * sizeof(*d));
nulls = (bool *) palloc(natts * sizeof(*nulls));
RTSTATE rtState;
/* generate an index tuple */
- itup = index_formtuple(RelationGetTupleDescriptor(r), datum, nulls);
+ itup = index_formtuple(RelationGetDescr(r), datum, nulls);
itup->t_tid = *ht_ctid;
initRtstate(&rtState, r);
res = rtdoinsert(r, itup, &rtState);
/* XXX two-phase locking -- don't unlock the relation until EOT */
- return (res);
+ return res;
}
static InsertIndexResult
res = dosplit(r, buffer, stack, itup, rtstate);
freestack(stack);
WriteBuffer(buffer); /* don't forget to release buffer! */
- return (res);
+ return res;
}
/* add the item and write the buffer */
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), blk, l);
- return (res);
+ return res;
}
static void
if (newd_size != old_size)
{
- TupleDesc td = RelationGetTupleDescriptor(r);
+ TupleDesc td = RelationGetDescr(r);
if (td->attrs[0]->attlen < 0)
{
pfree(ltup);
pfree(rtup);
- return (res);
+ return res;
}
static void
}
}
- return (which);
+ return which;
}
static int
nospace(Page p, IndexTuple it)
{
- return (PageGetFreeSpace(p) < IndexTupleSize(it));
+ return PageGetFreeSpace(p) < IndexTupleSize(it);
}
void
WriteBuffer(buf);
/* XXX -- two-phase locking, don't release the write lock */
- return ((char *) NULL);
+ return (char *) NULL;
}
static void
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
rtregscan(s);
- return (s);
+ return s;
}
void
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
AttrNumber attnum,
RegProcedure proc)
{
- return (RelationGetStrategy(r, attnum, &RTEvaluationData, proc));
+ return RelationGetStrategy(r, attnum, &RTEvaluationData, proc);
}
#ifdef NOT_USED
RTNStrategies,
attnum);
- return (strategyMap->entry[RTOperMap[procstrat - 1] - 1].sk_procedure);
+ return strategyMap->entry[RTOperMap[procstrat - 1] - 1].sk_procedure;
}
*
*
* 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
* This file contains the high level access-method interface to the
/*
* so lint is happy...
*/
- return (false);
+ return false;
}
/* --------------------------------
*
*
* 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
* Transaction aborts can now occur two ways:
/*
* Shouldn't get here, but lint is not happy with this...
*/
- return (false);
+ return false;
}
/* --------------------------------
bool
CurrentXactInProgress()
{
- return (CurrentTransactionState->state == TRANS_INPROGRESS);
+ return CurrentTransactionState->state == TRANS_INPROGRESS;
}
/* --------------------------------
if (s->blockState == TBLOCK_INPROGRESS
|| s->blockState == TBLOCK_ENDABORT)
- return (true);
+ return true;
- return (false);
+ return false;
}
*
*
* 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
* XXX WARNING
TransactionId
xidin(char *representation)
{
- return (atol(representation));
+ return atol(representation);
}
/* XXX name for catalogs */
sprintf(representation, "%u", transactionId);
- return (representation);
+ return representation;
}
bool
TransactionIdIsLessThan(TransactionId id1, TransactionId id2)
{
- return ((bool) (id1 < id2));
+ return (bool) (id1 < id2);
}
/* ----------------------------------------------------------------
bool
xideq(TransactionId xid1, TransactionId xid2)
{
- return ((bool) (xid1 == xid2));
+ return (bool) (xid1 == xid2);
}
* Copyright (c) 1994, Regents of the University of California
*
* 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 $
*
*-------------------------------------------------------------------------
*/
extern int Int_yyparse(void);
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 int CompHash(char *str, int len);
static hashnode *FindStr(char *str, int length, hashnode *mderef);
struct typmap
{ /* a hack */
Oid am_oid;
- TypeTupleFormData am_typ;
+ FormData_pg_type am_typ;
};
static struct typmap **Typ = (struct typmap **) NULL;
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 */
int numattr; /* number of attributes for cur. rel */
extern int fsyncOff; /* do not fsync the database */
for (i = 0; i < MAXATTR; i++)
{
- attrtypes[i] = (AttributeTupleForm) NULL;
+ attrtypes[i] = (Form_pg_attribute) NULL;
Blanks[i] = ' ';
}
for (i = 0; i < STRTABLESIZE; ++i)
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",
i, at->attname.data, at->attlen, at->attnum,
}
typeoid = gettype(type);
- if (attrtypes[attnum] == (AttributeTupleForm) NULL)
+ if (attrtypes[attnum] == (Form_pg_attribute) NULL)
attrtypes[attnum] = AllocateAttribute();
if (Typ != (struct typmap **) NULL)
{
seenArray[nseen] = id;
nseen++;
}
- return (seenthis);
+ return seenthis;
}
/* ----------------
if (strncmp((*app)->am_typ.typname.data, type, NAMEDATALEN) == 0)
{
Ap = *app;
- return ((*app)->am_oid);
+ return (*app)->am_oid;
}
}
}
for (i = 0; i <= n_types; i++)
{
if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0)
- return (i);
+ return i;
}
if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type);
}
heap_endscan(scan);
heap_close(rel);
- return (gettype(type));
+ return gettype(type);
}
elog(ERROR, "Error: unknown type '%s'.\n", type);
err_out();
* AllocateAttribute
* ----------------
*/
-static AttributeTupleForm /* XXX */
+static Form_pg_attribute /* XXX */
AllocateAttribute()
{
- AttributeTupleForm attribute =
- (AttributeTupleForm) malloc(ATTRIBUTE_TUPLE_SIZE);
+ Form_pg_attribute attribute =
+ (Form_pg_attribute) malloc(ATTRIBUTE_TUPLE_SIZE);
if (!PointerIsValid(attribute))
elog(FATAL, "AllocateAttribute: malloc failed");
MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE);
- return (attribute);
+ return attribute;
}
/* ----------------
node = FindStr(str, len, 0);
if (node)
- return (node->strnum);
+ return node->strnum;
else
{
node = AddStr(str, len, 0);
- return (node->strnum);
+ return node->strnum;
}
}
char *
LexIDStr(int ident_num)
{
- return (strtable[ident_num]);
+ return strtable[ident_num];
}
result = (NUM * str[0] + NUMSQR * str[len - 1] + NUMCUBE * str[(len - 1) / 2]);
- return (result % HASHTABLESIZE);
+ return result % HASHTABLESIZE;
}
*/
if (!strcmp(str, strtable[node->strnum]))
{
- return (node); /* no need to check */
+ return node; /* no need to check */
}
else
node = node->next;
}
/* Couldn't find it in the list */
- return (NULL);
+ return NULL;
}
/* ----------------
}
trail->next = newnode;
}
- return (newnode);
+ return newnode;
}
*
*
* 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
* See acl.h.
if (!heap_attisnull(tuple, Anum_pg_class_relacl))
old_acl = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl,
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
(bool *) NULL);
if (!old_acl || ACL_NUM(old_acl) < 1)
{
id = ((Form_pg_group) GETSTRUCT(tuple))->grosysid;
else
elog(ERROR, "non-existent group \"%s\"", groname);
- return (id);
+ return id;
}
char *
name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data;
else
elog(NOTICE, "get_groname: group %d not found", grosysid);
- return (name);
+ return name;
}
static int32
{
elog(NOTICE, "in_group: could not open \"%s\"??",
GroupRelationName);
- return (0);
+ return 0;
}
tuple = SearchSysCacheTuple(GROSYSID,
ObjectIdGetDatum(gid),
{
tmp = (IdList *) heap_getattr(tuple,
Anum_pg_group_grolist,
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
(bool *) NULL);
/* XXX make me a function */
num = IDLIST_NUM(tmp);
else
elog(NOTICE, "in_group: group %d not found", gid);
heap_close(relation);
- return (found);
+ return found;
}
/*
elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode);
#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;
elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode);
#endif
- return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV);
+ return (aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV;
}
}
break;
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: using world=%d", aidat->ai_mode);
#endif
- return ((aidat->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV);
+ return (aidat->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV;
}
int32
relation = heap_openr(RelationRelationName);
tmp = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl,
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
(bool *) NULL);
acl = makeacl(ACL_NUM(tmp));
memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp));
relation = heap_openr(RelationRelationName);
ownerId = (int4) heap_getattr(tuple,
Anum_pg_class_relowner,
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
(bool *) NULL);
acl = aclownerdefault(relname, (AclId)ownerId);
}
{
tmp = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl,
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
(bool *) NULL);
acl = makeacl(ACL_NUM(tmp));
memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp));
result = aclcheck(relname, acl, id, (AclIdType) ACL_IDTYPE_UID, mode);
if (acl)
pfree(acl);
- return (result);
+ return result;
}
int32
elog(DEBUG, "pg_ownercheck: user \"%s\" is superuser",
usename);
#endif
- return (1);
+ return 1;
}
tuple = SearchSysCacheTuple(cacheid, PointerGetDatum(value),
if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_ownercheck: operator %ld not found",
PointerGetDatum(value));
- owner_id = ((OperatorTupleForm) GETSTRUCT(tuple))->oprowner;
+ owner_id = ((Form_pg_operator) GETSTRUCT(tuple))->oprowner;
break;
case PRONAME:
if (!HeapTupleIsValid(tuple))
if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_ownercheck: type \"%s\" not found",
value);
- owner_id = ((TypeTupleForm) GETSTRUCT(tuple))->typowner;
+ owner_id = ((Form_pg_type) GETSTRUCT(tuple))->typowner;
break;
default:
elog(ERROR, "pg_ownercheck: invalid cache id: %d",
break;
}
- return (user_id == owner_id);
+ return user_id == owner_id;
}
int32
elog(DEBUG, "pg_ownercheck: user \"%s\" is superuser",
usename);
#endif
- return (1);
+ return 1;
}
tuple = SearchSysCacheTuple(PRONAME,
owner_id = ((Form_pg_proc) GETSTRUCT(tuple))->proowner;
- return (user_id == owner_id);
+ return user_id == owner_id;
}
int32
elog(DEBUG, "pg_aggr_ownercheck: user \"%s\" is superuser",
usename);
#endif
- return (1);
+ return 1;
}
tuple = SearchSysCacheTuple(AGGNAME,
owner_id = ((Form_pg_aggregate) GETSTRUCT(tuple))->aggowner;
- return (user_id == owner_id);
+ return user_id == owner_id;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* Perhaps this should be in-line code in relopen().
*/
char *
-relpath(char relname[])
+relpath(char *relname)
{
char *path;
{
path = (char *) palloc(strlen(DataDir) + sizeof(NameData) + 2);
sprintf(path, "%s/%s", DataDir, relname);
- return (path);
+ return path;
}
- return (relname);
+ return relname;
}
#ifdef NOT_USED
* XXX this is way bogus. -- pma
*/
bool
-issystem(char relname[])
+issystem(char *relname)
{
if (relname[0] && relname[1] && relname[2])
return (relname[0] == 'p' &&
void
fillatt(TupleDesc tupleDesc)
{
- AttributeTupleForm *attributeP;
- TypeTupleForm typp;
+ Form_pg_attribute *attributeP;
+ Form_pg_type typp;
HeapTuple tuple;
int i;
int natts = tupleDesc->natts;
- AttributeTupleForm *att = tupleDesc->attrs;
+ Form_pg_attribute *att = tupleDesc->attrs;
if (natts < 0 || natts > MaxHeapAttributeNumber)
elog(ERROR, "fillatt: %d attributes is too large", natts);
*/
if (!(*attributeP)->attisset)
{
- typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */
+ typp = (Form_pg_type) GETSTRUCT(tuple); /* XXX */
(*attributeP)->attlen = typp->typlen;
(*attributeP)->attbyval = typp->typbyval;
}
*
*
* 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
* heap_create() - Create an uncataloged heap relation
static void DeletePgAttributeTuples(Relation rel);
static void DeletePgRelationTuple(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 RelationRemoveInheritance(Relation relation);
static void RemoveFromTempRelList(Relation r);
MaxCommandIdAttributeNumber, 0, -1, -1, '\001', '\0', 'i', '\0', '\0'
};
-static AttributeTupleForm HeapAtt[] =
+static Form_pg_attribute HeapAtt[] =
{&a1, &a2, &a3, &a4, &a5, &a6};
/* ----------------------------------------------------------------
int isTemp = 0;
int natts = tupDesc->natts;
-/* AttributeTupleForm *att = tupDesc->attrs; */
+/* Form_pg_attribute *att = tupDesc->attrs; */
extern GlobalMemory CacheCxt;
MemoryContext oldcxt;
if (isTemp)
AddToTempRelList(rel);
- return (rel);
+ return rel;
}
* --------------------------------
*/
static int
-RelationAlreadyExists(Relation pg_class_desc, char relname[])
+RelationAlreadyExists(Relation pg_class_desc, char *relname)
{
ScanKeyData key;
HeapScanDesc pg_class_scan;
AddNewAttributeTuples(Oid new_rel_oid,
TupleDesc tupdesc)
{
- AttributeTupleForm *dpp;
+ Form_pg_attribute *dpp;
unsigned i;
HeapTuple tup;
Relation rel;
*/
Assert(rel);
Assert(rel->rd_rel);
- hasindex = RelationGetRelationTupleForm(rel)->relhasindex;
+ hasindex = RelationGetForm(rel)->relhasindex;
if (hasindex)
CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs);
heap_close(catalogRelation);
elog(ERROR, "relation <%d> inherits \"%s\"",
- ((InheritsTupleForm) GETSTRUCT(tuple))->inhrel,
+ ((Form_pg_inherits) GETSTRUCT(tuple))->inhrel,
RelationGetRelationName(relation));
}
&entry);
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_close(indexRelation);
if (HeapTupleIsValid(atttup))
{
- Oid relid = ((AttributeTupleForm) GETSTRUCT(atttup))->attrelid;
+ Oid relid = ((Form_pg_attribute) GETSTRUCT(atttup))->attrelid;
heap_endscan(pg_type_scan);
heap_close(pg_type_desc);
{
char str[MAX_PARSE_BUFFER];
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;
Query *query;
List *planTree_list;
*
*
* 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
static TupleDesc
ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
List *attributeList,
- int numatts, AttrNumber attNums[]);
+ int numatts, AttrNumber *attNums);
static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
static Oid UpdateRelationRelation(Relation indexRelation);
static void
UpdateIndexRelation(Oid indexoid, Oid heapoid,
FuncIndexInfo *funcInfo, int natts,
- AttrNumber attNums[], Oid classOids[], Node *predicate,
+ AttrNumber *attNums, Oid *classOids, Node *predicate,
List *attributeList, bool islossy, bool unique);
static void
DefaultBuild(Relation heapRelation, Relation indexRelation,
- int numberOfAttributes, AttrNumber attributeNumber[],
+ int numberOfAttributes, AttrNumber *attributeNumber,
IndexStrategy indexStrategy, uint16 parameterCount,
- Datum parameter[], FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
+ Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
/* ----------------------------------------------------------------
* sysatts is a structure containing attribute tuple forms
* Allocate and zero a tuple descriptor.
*/
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);
/*
/*
* 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]->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]->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
*/
namestrcpy(&funcTupDesc->attrs[0]->attname, funcname);
- return (funcTupDesc);
+ return funcTupDesc;
}
/* ----------------------------------------------------------------
Relation heapRelation,
List *attributeList,
int numatts,
- AttrNumber attNums[])
+ AttrNumber *attNums)
{
TupleDesc heapTupDesc;
TupleDesc indexTupDesc;
TypeName *IndexKeyType;
AttrNumber atnum; /* attributeNumber[attributeOffset] */
AttrNumber atind;
- int natts; /* RelationTupleForm->relnatts */
+ int natts; /* Form_pg_class->relnatts */
char *from; /* used to simplify memcpy below */
char *to; /* used to simplify memcpy below */
int i;
* allocate the new tuple descriptor
* ----------------
*/
- natts = RelationGetRelationTupleForm(heapRelation)->relnatts;
+ natts = RelationGetForm(heapRelation)->relnatts;
indexTupDesc = CreateTemplateTupleDesc(numatts);
else
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
* here we are indexing on a normal attribute (1...n)
* ----------------
*/
- heapTupDesc = RelationGetTupleDescriptor(heapRelation);
+ heapTupDesc = RelationGetDescr(heapRelation);
atind = AttrNumberGetAttrOffset(atnum);
from = (char *) (heapTupDesc->attrs[atind]);
to = (char *) (indexTupDesc->attrs[i]);
memcpy(to, from, ATTRIBUTE_TUPLE_SIZE);
- ((AttributeTupleForm) to)->attnum = i + 1;
+ ((Form_pg_attribute) to)->attnum = i + 1;
- ((AttributeTupleForm) to)->attnotnull = false;
- ((AttributeTupleForm) to)->atthasdef = false;
- ((AttributeTupleForm) to)->attcacheoff = -1;
- ((AttributeTupleForm) to)->atttypmod = -1;
- ((AttributeTupleForm) to)->attalign = 'i';
+ ((Form_pg_attribute) to)->attnotnull = false;
+ ((Form_pg_attribute) to)->atthasdef = false;
+ ((Form_pg_attribute) to)->attcacheoff = -1;
+ ((Form_pg_attribute) to)->atttypmod = -1;
+ ((Form_pg_attribute) to)->attalign = 'i';
/*
* if the keytype is defined, we need to change the tuple form's
if (!HeapTupleIsValid(tup))
elog(ERROR, "create index: type '%s' undefined",
IndexKeyType->name);
- ((AttributeTupleForm) to)->atttypid = tup->t_oid;
- ((AttributeTupleForm) to)->attbyval =
- ((TypeTupleForm) GETSTRUCT(tup))->typbyval;
- ((AttributeTupleForm) to)->attlen =
- ((TypeTupleForm) GETSTRUCT(tup))->typlen;
- ((AttributeTupleForm) to)->attalign =
- ((TypeTupleForm) GETSTRUCT(tup))->typalign;
- ((AttributeTupleForm) to)->atttypmod = IndexKeyType->typmod;
+ ((Form_pg_attribute) to)->atttypid = tup->t_oid;
+ ((Form_pg_attribute) to)->attbyval =
+ ((Form_pg_type) GETSTRUCT(tup))->typbyval;
+ ((Form_pg_attribute) to)->attlen =
+ ((Form_pg_type) GETSTRUCT(tup))->typlen;
+ ((Form_pg_attribute) to)->attalign =
+ ((Form_pg_type) GETSTRUCT(tup))->typalign;
+ ((Form_pg_attribute) to)->atttypmod = IndexKeyType->typmod;
}
* all set.
* ----------------
*/
- ((AttributeTupleForm) to)->attrelid = heapoid;
+ ((Form_pg_attribute) to)->attrelid = heapoid;
}
return indexTupDesc;
}
/* ----------------------------------------------------------------
- * AccessMethodObjectIdGetAccessMethodTupleForm --
+ * AccessMethodObjectIdGetForm --
* Returns the formated access method tuple given its object identifier.
*
* XXX ADD INDEXING
* ----------------------------------------------------------------
*/
Form_pg_am
-AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
+AccessMethodObjectIdGetForm(Oid accessMethodObjectId)
{
Relation pg_am_desc;
HeapScanDesc pg_am_scan;
{
heap_endscan(pg_am_scan);
heap_close(pg_am_desc);
- return (NULL);
+ return NULL;
}
/* ----------------
heap_endscan(pg_am_scan);
heap_close(pg_am_desc);
- return (form);
+ return form;
}
/* ----------------------------------------------------------------
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
indexRelation->rd_am =
- AccessMethodObjectIdGetAccessMethodTupleForm(amoid);
+ AccessMethodObjectIdGetForm(amoid);
MemoryContextSwitchTo(oldcxt);
pfree(tuple);
heap_close(pg_class);
- return (tupleOid);
+ return tupleOid;
}
/* ----------------------------------------------------------------
TupleDesc tupleDescriptor;
int i;
- tupleDescriptor = RelationGetTupleDescriptor(indexRelation);
+ tupleDescriptor = RelationGetDescr(indexRelation);
for (i = 0; i < numatts; i += 1)
tupleDescriptor->attrs[i]->attrelid = indexoid;
pg_attribute = heap_openr(AttributeRelationName);
/* ----------------
- * initialize null[], replace[] and value[]
+ * initialize *null, *replace and *value
* ----------------
*/
MemSet(nullv, ' ', Natts_pg_attribute);
* descriptor to form the remaining attribute tuples.
* ----------------
*/
- indexTupDesc = RelationGetTupleDescriptor(indexRelation);
+ indexTupDesc = RelationGetDescr(indexRelation);
for (i = 1; i < numatts; i += 1)
{
Oid heapoid,
FuncIndexInfo *funcInfo,
int natts,
- AttrNumber attNums[],
- Oid classOids[],
+ AttrNumber *attNums,
+ Oid *classOids,
Node *predicate,
List *attributeList,
bool islossy,
bool unique)
{
- IndexTupleForm indexForm;
+ Form_pg_index indexForm;
IndexElem *IndexKey;
char *predString;
text *predText;
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
* ----------------
*/
predText = (text *) fmgr(F_TEXTIN, "");
predLen = VARSIZE(predText);
itupLen = predLen + sizeof(FormData_pg_index);
- indexForm = (IndexTupleForm) palloc(itupLen);
+ indexForm = (Form_pg_index) palloc(itupLen);
memmove((char *) &indexForm->indpred, (char *) predText, predLen);
List *attributeList,
Oid accessMethodObjectId,
int numatts,
- AttrNumber attNums[],
- Oid classObjectId[],
+ AttrNumber *attNums,
+ Oid *classObjectId,
uint16 parameterCount,
Datum *parameter,
Node *predicate,
*/
void
FormIndexDatum(int numberOfAttributes,
- AttrNumber attributeNumber[],
+ AttrNumber *attributeNumber,
HeapTuple heapTuple,
TupleDesc heapDescriptor,
Datum *datum,
DefaultBuild(Relation heapRelation,
Relation indexRelation,
int numberOfAttributes,
- AttrNumber attributeNumber[],
+ AttrNumber *attributeNumber,
IndexStrategy indexStrategy, /* not used */
uint16 parameterCount, /* not used */
- Datum parameter[], /* not used */
+ Datum *parameter, /* not used */
FuncIndexInfoPtr funcInfo,
PredInfo *predInfo)
{
* how to form the index tuples..
* ----------------
*/
- heapDescriptor = RelationGetTupleDescriptor(heapRelation);
- indexDescriptor = RelationGetTupleDescriptor(indexRelation);
+ heapDescriptor = RelationGetDescr(heapRelation);
+ indexDescriptor = RelationGetDescr(indexRelation);
/* ----------------
* datum and null are arrays in which we collect the index attributes
index_build(Relation heapRelation,
Relation indexRelation,
int numberOfAttributes,
- AttrNumber attributeNumber[],
+ AttrNumber *attributeNumber,
uint16 parameterCount,
Datum *parameter,
FuncIndexInfo *funcInfo,
IndexIsUnique(Oid indexId)
{
HeapTuple tuple;
- IndexTupleForm index;
+ Form_pg_index index;
tuple = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(indexId),
elog(ERROR, "IndexIsUnique: can't find index id %d",
indexId);
}
- index = (IndexTupleForm) GETSTRUCT(tuple);
+ index = (Form_pg_index) GETSTRUCT(tuple);
Assert(index->indexrelid == indexId);
return index->indisunique;
ScanKeyData skey[1];
HeapScanDesc scandesc;
HeapTuple tuple;
- IndexTupleForm index;
+ Form_pg_index index;
bool isunique;
pg_index = heap_openr(IndexRelationName);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "IndexIsUniqueNoCache: can't find index id %d", indexId);
- index = (IndexTupleForm) GETSTRUCT(tuple);
+ index = (Form_pg_index) GETSTRUCT(tuple);
Assert(index->indexrelid == indexId);
isunique = index->indisunique;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* associated with them.
*/
void
-CatalogOpenIndices(int nIndices, char *names[], Relation idescs[])
+CatalogOpenIndices(int nIndices, char **names, Relation *idescs)
{
int i;
{
HeapTuple pgIndexTup;
TupleDesc heapDescriptor;
- IndexTupleForm pgIndexP;
+ Form_pg_index pgIndexP;
Datum datum;
int natts;
AttrNumber *attnumP;
char nulls[INDEX_MAX_KEYS];
int i;
- heapDescriptor = RelationGetTupleDescriptor(heapRelation);
+ heapDescriptor = RelationGetDescr(heapRelation);
for (i = 0; i < nIndices; i++)
{
TupleDesc indexDescriptor;
InsertIndexResult indexRes;
- indexDescriptor = RelationGetTupleDescriptor(idescs[i]);
+ indexDescriptor = RelationGetDescr(idescs[i]);
pgIndexTup = SearchSysCacheTupleCopy(INDEXRELID,
ObjectIdGetDatum(idescs[i]->rd_id),
0, 0, 0);
Assert(pgIndexTup);
- pgIndexP = (IndexTupleForm) GETSTRUCT(pgIndexTup);
+ pgIndexP = (Form_pg_index) GETSTRUCT(pgIndexTup);
/*
* Compute the number of attributes we are indexing upon.
for (i = 0; IndexedCatalogNames[i] != NULL; i++)
{
if (strcmp(IndexedCatalogNames[i], catName) == 0)
- return (true);
+ return true;
}
- return (false);
+ return false;
}
pg_class = heap_openr(RelationRelationName);
}
pgRelP = (Form_pg_class) GETSTRUCT(htup);
- return (pgRelP->relhasindex);
+ return pgRelP->relhasindex;
}
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* NULL
*/
textInitVal = (text *) fastgetattr(tup, initValAttno,
- RelationGetTupleDescriptor(aggRel),
+ RelationGetDescr(aggRel),
isNull);
if (!PointerIsValid(textInitVal))
*isNull = true;
if (*isNull)
{
heap_close(aggRel);
- return ((char *) NULL);
+ return (char *) NULL;
}
strInitVal = textout(textInitVal);
heap_close(aggRel);
pfree(strInitVal);
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);
- return (initVal);
+ return initVal;
}
*
*
* 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
* these routines moved here from commands/define.c and somewhat cleaned up.
TupleDesc tupDesc;
/* ----------------
- * initialize our nulls[] and values[] arrays
+ * initialize our *nulls and *values arrays
* ----------------
*/
for (i = 0; i < Natts_pg_operator; ++i)
}
/* ----------------
- * initialize values[] with the type name and
+ * initialize *values with the type name and
* ----------------
*/
i = 0;
{
if (HeapTupleIsValid(tup))
{
- OperatorTupleForm t;
+ Form_pg_operator t;
- t = (OperatorTupleForm) GETSTRUCT(tup);
+ t = (Form_pg_operator) GETSTRUCT(tup);
if (!OidIsValid(t->oprcom)
|| !OidIsValid(t->oprnegate))
{
/* if commutator and negator are different, do two updates */
if (HeapTupleIsValid(tup) &&
- !(OidIsValid(((OperatorTupleForm) GETSTRUCT(tup))->oprcom)))
+ !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprcom)))
{
values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
replaces[Anum_pg_operator_oprcom - 1] = 'r';
tup = heap_getnext(pg_operator_scan, 0);
if (HeapTupleIsValid(tup) &&
- !(OidIsValid(((OperatorTupleForm) GETSTRUCT(tup))->oprnegate)))
+ !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate)))
{
values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
replaces[Anum_pg_operator_oprnegate - 1] = 'r';
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
heap_insert(rel, tup);
- if (RelationGetRelationTupleForm(rel)->relhasindex)
+ if (RelationGetForm(rel)->relhasindex)
{
Relation idescs[Num_pg_proc_indices];
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------
*/
heap_endscan(scan);
- *defined = (bool) ((TypeTupleForm) GETSTRUCT(tup))->typisdefined;
+ *defined = (bool) ((Form_pg_type) GETSTRUCT(tup))->typisdefined;
return tup->t_oid;
}
TupleDesc tupDesc;
/* ----------------
- * initialize our nulls[] and values[] arrays
+ * initialize our *nulls and *values arrays
* ----------------
*/
for (i = 0; i < Natts_pg_type; ++i)
}
/* ----------------
- * initialize values[] with the type name and
+ * initialize *values with the type name and
* ----------------
*/
i = 0;
heap_insert(pg_type_desc, tup);
typoid = tup->t_oid;
- if (RelationGetRelationTupleForm(pg_type_desc)->relhasindex)
+ if (RelationGetForm(pg_type_desc)->relhasindex)
{
Relation idescs[Num_pg_type_indices];
internalSize = -1;
/* ----------------
- * initialize the values[] information
+ * initialize the *values information
* ----------------
*/
i = 0;
*/
heap_endscan(pg_type_scan);
- if (RelationGetRelationTupleForm(pg_type_desc)->relhasindex)
+ if (RelationGetForm(pg_type_desc)->relhasindex)
{
Relation idescs[Num_pg_type_indices];
elog(ERROR, "TypeRename: type %s already defined", newTypeName);
}
- namestrcpy(&(((TypeTupleForm) GETSTRUCT(oldtup))->typname), newTypeName);
+ namestrcpy(&(((Form_pg_type) GETSTRUCT(oldtup))->typname), newTypeName);
setheapoverride(true);
heap_replace(pg_type_desc, &oldtup->t_ctid, oldtup);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
PointerGetDatum(notifyName));
lRel = heap_openr(ListenerRelationName);
- tdesc = RelationGetTupleDescriptor(lRel);
+ tdesc = RelationGetDescr(lRel);
RelationSetLockForWrite(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
- tdesc = RelationGetTupleDescriptor(lRel);
+ tdesc = RelationGetDescr(lRel);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{
RelationSetLockForWrite(lDesc);
/* is someone already listening. One listener per relation */
- tdesc = RelationGetTupleDescriptor(lDesc);
+ tdesc = RelationGetDescr(lDesc);
scan = heap_beginscan(lDesc, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{
Int32GetDatum(MyProcPid));
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
- tdesc = RelationGetTupleDescriptor(lRel);
+ tdesc = RelationGetDescr(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
Int32GetDatum(MyProcPid));
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
- tdesc = RelationGetTupleDescriptor(lRel);
+ tdesc = RelationGetDescr(lRel);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 2, key);
nulls[0] = nulls[1] = nulls[2] = ' ';
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*
*/
void
-cluster(char oldrelname[], char oldindexname[])
+cluster(char *oldrelname, char *oldindexname)
{
Oid OIDOldHeap,
OIDOldIndex,
sprintf(NewName, "temp_%x", OIDOldHeap);
OldHeap = heap_open(OIDOldHeap);
- OldHeapDesc = RelationGetTupleDescriptor(OldHeap);
+ OldHeapDesc = RelationGetDescr(OldHeap);
/*
* Need to make a copy of the tuple descriptor,
HeapTuple Old_pg_index_Tuple,
Old_pg_index_relation_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_proc pg_proc_Form;
char *NewIndexName;
0, 0, 0);
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 =
SearchSysCacheTuple(RELOID,
*
*
* 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
* The PortalExecutorHeapMemory crap needs to be eliminated
bool inherits,
ColumnDef *colDef)
{
- Relation relrdesc,
+ Relation rel,
attrdesc;
HeapTuple reltup;
HeapTuple attributeTuple;
- AttributeTupleForm attribute;
+ Form_pg_attribute attribute;
FormData_pg_attribute attributeD;
int i;
int minattnum,
List *child,
*children;
- relrdesc = heap_openr(relationName);
- if (!RelationIsValid(relrdesc))
+ rel = heap_openr(relationName);
+ if (!RelationIsValid(rel))
{
elog(ERROR, "PerformAddAttribute: unknown relation: \"%s\"",
relationName);
}
- myrelid = RelationGetRelid(relrdesc);
- heap_close(relrdesc);
+ myrelid = RelationGetRelid(rel);
+ heap_close(rel);
/* this routine is actually in the planner */
children = find_all_inheritors(lconsi(myrelid, NIL), NIL);
childrelid = lfirsti(child);
if (childrelid == myrelid)
continue;
- relrdesc = heap_open(childrelid);
- if (!RelationIsValid(relrdesc))
+ rel = heap_open(childrelid);
+ if (!RelationIsValid(rel))
{
elog(ERROR, "PerformAddAttribute: can't find catalog entry for inheriting class with oid %d",
childrelid);
}
- PerformAddAttribute((relrdesc->rd_rel->relname).data,
+ PerformAddAttribute((rel->rd_rel->relname).data,
userName, false, colDef);
- heap_close(relrdesc);
+ heap_close(rel);
}
}
}
- relrdesc = heap_openr(RelationRelationName);
+ rel = heap_openr(RelationRelationName);
reltup = SearchSysCacheTupleCopy(RELNAME,
PointerGetDatum(relationName),
if (!HeapTupleIsValid(reltup))
{
- heap_close(relrdesc);
+ heap_close(rel);
elog(ERROR, "PerformAddAttribute: relation \"%s\" not found",
relationName);
}
if (maxatts > MaxHeapAttributeNumber)
{
pfree(reltup);
- heap_close(relrdesc);
+ heap_close(rel);
elog(ERROR, "PerformAddAttribute: relations limited to %d attributes",
MaxHeapAttributeNumber);
}
attrdesc = heap_openr(AttributeRelationName);
Assert(attrdesc);
- Assert(RelationGetRelationTupleForm(attrdesc));
+ Assert(RelationGetForm(attrdesc));
/*
* Open all (if any) pg_attribute indices
*/
- hasindex = RelationGetRelationTupleForm(attrdesc)->relhasindex;
+ hasindex = RelationGetForm(attrdesc)->relhasindex;
if (hasindex)
CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs);
sizeof attributeD,
(char *) &attributeD);
- attribute = (AttributeTupleForm) GETSTRUCT(attributeTuple);
+ attribute = (Form_pg_attribute) GETSTRUCT(attributeTuple);
i = 1 + minattnum;
{
HeapTuple typeTuple;
- TypeTupleForm form;
+ Form_pg_type form;
char *typename;
int attnelems;
if (HeapTupleIsValid(tup))
{
heap_close(attrdesc);
- heap_close(relrdesc);
+ heap_close(rel);
elog(ERROR, "PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"",
colDef->colname, relationName);
}
typeTuple = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(typename),
0, 0, 0);
- form = (TypeTupleForm) GETSTRUCT(typeTuple);
+ form = (Form_pg_type) GETSTRUCT(typeTuple);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "Add: type \"%s\" nonexistent", typename);
heap_close(attrdesc);
((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 */
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);
pfree(reltup);
- heap_close(relrdesc);
+ heap_close(rel);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
int32 attr_count,
i;
- AttributeTupleForm *attr;
+ Form_pg_attribute *attr;
FmgrInfo *out_functions;
Oid out_func_oid;
Oid *elements;
{
HeapTuple tuple;
AttrNumber attr_count;
- AttributeTupleForm *attr;
+ Form_pg_attribute *attr;
FmgrInfo *in_functions;
int i;
Oid in_func_oid;
**finfoP = NULL;
TupleDesc *itupdescArr;
HeapTuple pgIndexTup;
- IndexTupleForm *pgIndexP = NULL;
+ Form_pg_index *pgIndexP = NULL;
int *indexNatts = NULL;
char *predString;
Node **indexPred = NULL;
Oid loaded_oid;
bool skip_tuple = false;
- tupDesc = RelationGetTupleDescriptor(rel);
+ tupDesc = RelationGetDescr(rel);
attr = tupDesc->attrs;
attr_count = tupDesc->natts;
itupdescArr =
(TupleDesc *) palloc(n_indices * sizeof(TupleDesc));
pgIndexP =
- (IndexTupleForm *) palloc(n_indices * sizeof(IndexTupleForm));
+ (Form_pg_index *) palloc(n_indices * sizeof(Form_pg_index));
indexNatts = (int *) palloc(n_indices * sizeof(int));
finfo = (FuncIndexInfo *) palloc(n_indices * sizeof(FuncIndexInfo));
finfoP = (FuncIndexInfo **) palloc(n_indices * sizeof(FuncIndexInfo *));
econtext = NULL;
for (i = 0; i < n_indices; i++)
{
- itupdescArr[i] = RelationGetTupleDescriptor(index_rels[i]);
+ itupdescArr[i] = RelationGetDescr(index_rels[i]);
pgIndexTup =
SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
0, 0, 0);
Assert(pgIndexTup);
- pgIndexP[i] = (IndexTupleForm) GETSTRUCT(pgIndexTup);
+ pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup);
for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber;
attnumP++, natts++);
slot = ExecAllocTableSlot(tupleTable);
econtext = makeNode(ExprContext);
econtext->ecxt_scantuple = slot;
- rtupdesc = RelationGetTupleDescriptor(rel);
+ rtupdesc = RelationGetDescr(rel);
slot->ttc_tupleDescriptor = rtupdesc;
/*
0, 0, 0);
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);
- return (InvalidOid);
+ return InvalidOid;
}
static Oid
0, 0, 0);
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);
- return (InvalidOid);
+ return InvalidOid;
}
static Oid
0, 0, 0);
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);
- return (InvalidOid);
+ return InvalidOid;
}
static Oid
0, 0, 0);
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);
- return (InvalidOid);
+ return InvalidOid;
}
/*
pg_index_rel = heap_openr(IndexRelationName);
scandesc = heap_beginscan(pg_index_rel, 0, SnapshotNow, 0, NULL);
- tupDesc = RelationGetTupleDescriptor(pg_index_rel);
+ tupDesc = RelationGetDescr(pg_index_rel);
*n_indices = 0;
if (*newline)
{
*isnull = (bool) true;
- return (NULL);
+ return NULL;
}
#endif
*isnull = (bool) false; /* set default */
if (feof(fp))
- return (NULL);
+ return NULL;
while (!done)
{
c = getc(fp);
if (feof(fp))
- return (NULL);
+ return NULL;
else if (c == '\\')
{
c = getc(fp);
if (feof(fp))
- return (NULL);
+ return NULL;
switch (c)
{
case '0':
else
{
if (feof(fp))
- return (NULL);
+ return NULL;
ungetc(c, fp);
}
}
else
{
if (feof(fp))
- return (NULL);
+ return NULL;
ungetc(c, fp);
}
c = val & 0377;
c = getc(fp);
if (c != '\n')
elog(ERROR, "CopyReadAttribute - end of record marker corrupted. line: %d", lineno);
- return (NULL);
+ return NULL;
break;
}
}
for(j=0;j<mblen;j++) {
c = getc(fp);
if (feof(fp))
- return (NULL);
+ return NULL;
attribute[i++] = c;
}
#endif
#ifdef MULTIBYTE
return(pg_client_to_server((unsigned char*)attribute, strlen(attribute)));
#else
- return (&attribute[0]);
+ return &attribute[0];
#endif
}
while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0)))
i++;
heap_endscan(scandesc);
- return (i);
+ return i;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
if (relation->rd_rel->relkind == 'S')
elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name);
- tupleDesc = RelationGetTupleDescriptor(relation);
+ tupleDesc = RelationGetDescr(relation);
constr = tupleDesc->constr;
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 *attributeType;
HeapTuple tuple;
0, 0, 0);
AssertState(HeapTupleIsValid(tuple));
attributeType =
- (((TypeTupleForm) GETSTRUCT(tuple))->typname).data;
+ (((Form_pg_type) GETSTRUCT(tuple))->typname).data;
/*
* check validity
*/
schema = nconc(inhSchema, schema);
*supconstr = constraints;
- return (schema);
+ return schema;
}
/*
* ----------------
*/
relation = heap_openr(InheritsRelationName);
- desc = RelationGetTupleDescriptor(relation);
+ desc = RelationGetDescr(relation);
seqNumber = 1;
idList = NIL;
break;
lnext(current) =
- lconsi(((InheritsTupleForm)
+ lconsi(((Form_pg_inherits)
GETSTRUCT(tuple))->inhparent,
NIL);
* ----------------
*/
relation = heap_openr(InheritancePrecidenceListRelationName);
- desc = RelationGetTupleDescriptor(relation);
+ desc = RelationGetDescr(relation);
seqNumber = 1;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
dbtup = tup;
heap_endscan(scan);
- return (dbtup);
+ return dbtup;
}
/*
{
dbowner = (int4) heap_getattr(dbtup,
Anum_pg_database_datdba,
- RelationGetTupleDescriptor(dbrel),
+ RelationGetDescr(dbrel),
(char *) NULL);
*dbIdP = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup,
Anum_pg_database_datpath,
- RelationGetTupleDescriptor(dbrel),
+ RelationGetDescr(dbrel),
(char *) NULL);
strncpy(path, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ));
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
HeapTuple tuple;
FuncIndexInfo fInfo;
FuncIndexInfo *funcInfo = NULL;
- IndexTupleForm index;
+ Form_pg_index index;
Node *oldPred = NULL;
List *cnfPred = NULL;
PredInfo *predInfo;
/*
* Extract info from the pg_index tuple
*/
- index = (IndexTupleForm) GETSTRUCT(tuple);
+ index = (Form_pg_index) GETSTRUCT(tuple);
Assert(index->indexrelid == indexId);
relationId = index->indrelid;
indproc = index->indproc;
{
List *rest;
HeapTuple tuple;
- AttributeTupleForm att;
+ Form_pg_attribute att;
tuple = SearchSysCacheTuple(CLANAME,
PointerGetDatum(funcIndex->class),
"DefineIndex: attribute \"%s\" not found",
arg);
}
- att = (AttributeTupleForm) GETSTRUCT(tuple);
+ att = (Form_pg_attribute) GETSTRUCT(tuple);
*attNumP++ = att->attnum;
*argTypes++ = att->atttypid;
}
for (rest = attList; rest != NIL; rest = lnext(rest))
{
IndexElem *attribute;
- AttributeTupleForm attform;
+ Form_pg_attribute attform;
attribute = lfirst(rest);
attribute->name);
}
- attform = (AttributeTupleForm) GETSTRUCT(atttuple);
+ attform = (Form_pg_attribute) GETSTRUCT(atttuple);
*attNumP++ = attform->attnum;
/* we want the type so we can set the proper alignment, etc. */
attribute->name);
/* we just set the type name because that is all we need */
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)
*
*
* 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
* The "DefineFoo" routines take the parse tree and pick out the
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)
{
{
if (nodeTag(def->arg) != T_String)
elog(ERROR, "Define: \"%s\" = what?", def->defname);
- return (strVal(def->arg));
+ return strVal(def->arg);
}
static int
defGetTypeLength(DefElem *def)
{
if (nodeTag(def->arg) == T_Integer)
- return (intVal(def->arg));
+ return intVal(def->arg);
else if (nodeTag(def->arg) == T_String &&
!strcasecmp(strVal(def->arg), "variable"))
return -1; /* variable length */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
this code is very similar to ProcedureDefine() in pg_proc.c
*/
static int
-getParamTypes(TgElement * elem, Oid typev[])
+getParamTypes(TgElement * elem, Oid *typev)
{
/* this code is similar to ProcedureDefine() */
int16 parameterCount;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
scan = heap_beginscan(rel, 0, SnapshotNow, 1, key);
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 = optr->next;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (!HeapTupleIsValid(oldatttup))
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);
newatttup = SearchSysCacheTuple(ATTNAME,
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
}
- StrNCpy((((AttributeTupleForm) (GETSTRUCT(oldatttup)))->attname.data),
+ StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
newattname, NAMEDATALEN);
attrelation = heap_openr(AttributeRelationName);
char is_called;
} FormData_pg_sequence;
-typedef FormData_pg_sequence *SequenceTupleForm;
+typedef FormData_pg_sequence *Form_pg_sequence;
typedef struct sequence_magic
{
static SeqTable seqtab = NULL;
static SeqTable init_sequence(char *caller, char *name);
-static SequenceTupleForm read_info(char *caller, SeqTable elm, Buffer *buf);
-static void init_params(CreateSeqStmt *seq, SequenceTupleForm new);
+static Form_pg_sequence read_info(char *caller, SeqTable elm, Buffer *buf);
+static void init_params(CreateSeqStmt *seq, Form_pg_sequence new);
static int get_param(DefElem *def);
/*
init_params(seq, &new);
/*
- * Create relation (and fill null[] & value[])
+ * Create relation (and fill *null & *value)
*/
stmt->tableElts = NIL;
for (i = SEQ_COL_FIRSTCOL; i <= SEQ_COL_LASTCOL; i++)
RelationSetLockForWrite(rel);
- tupDesc = RelationGetTupleDescriptor(rel);
+ tupDesc = RelationGetDescr(rel);
Assert(RelationGetNumberOfBlocks(rel) == 0);
buf = ReadBuffer(rel, P_NEW);
char *seqname = textout(seqin);
SeqTable elm;
Buffer buf;
- SequenceTupleForm seq;
+ Form_pg_sequence seq;
ItemPointerData iptr;
int4 incby,
maxv,
if (elm->last != elm->cached) /* some numbers were cached */
{
elm->last += elm->increment;
- return (elm->last);
+ return elm->last;
}
seq = read_info("nextval", elm, &buf); /* lock page and read
ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationUnsetSingleWLockPage(elm->rel, &iptr);
- return (result);
+ return result;
}
result = elm->last;
- return (result);
+ return result;
}
char *seqname = textout(seqin);
SeqTable elm;
Buffer buf;
- SequenceTupleForm seq;
+ Form_pg_sequence seq;
ItemPointerData iptr;
#ifndef NO_SECURITY
ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationUnsetSingleWLockPage (elm->rel, &iptr);
- return (next);
+ return next;
}
-static SequenceTupleForm
+static Form_pg_sequence
read_info(char *caller, SeqTable elm, Buffer *buf)
{
ItemPointerData iptr;
ItemId lp;
HeapTuple tuple;
sequence_magic *sm;
- SequenceTupleForm seq;
+ Form_pg_sequence seq;
ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationSetSingleWLockPage(elm->rel, &iptr);
Assert(ItemIdIsUsed(lp));
tuple = (HeapTuple) PageGetItem((Page) page, lp);
- seq = (SequenceTupleForm) GETSTRUCT(tuple);
+ seq = (Form_pg_sequence) GETSTRUCT(tuple);
elm->increment = seq->increment_by;
- return (seq);
+ return seq;
}
/* found */
{
if (elm->rel != (Relation) NULL) /* already opened */
- return (elm);
+ return elm;
temp = elm;
}
priv->next = elm;
}
- return (elm);
+ return elm;
}
static void
-init_params(CreateSeqStmt *seq, SequenceTupleForm new)
+init_params(CreateSeqStmt *seq, Form_pg_sequence new)
{
DefElem *last_value = NULL;
DefElem *increment_by = NULL;
elog(ERROR, "DefineSequence: \"%s\" value unspecified", def->defname);
if (nodeTag(def->arg) == T_Integer)
- return (intVal(def->arg));
+ return intVal(def->arg);
elog(ERROR, "DefineSequence: \"%s\" is to be integer", def->defname);
- return (-1);
+ return -1;
}
Relation tgrel;
HeapScanDesc tgscan;
ScanKeyData key;
- Relation relrdesc;
+ Relation pgrel;
HeapTuple tuple;
Relation idescs[Num_pg_trigger_indices];
Relation ridescs[Num_pg_class_indices];
if (!HeapTupleIsValid(tuple))
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;
- RelationInvalidateHeapTuple(relrdesc, tuple);
- heap_replace(relrdesc, &tuple->t_ctid, tuple);
+ RelationInvalidateHeapTuple(pgrel, tuple);
+ heap_replace(pgrel, &tuple->t_ctid, tuple);
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);
pfree(tuple);
- heap_close(relrdesc);
+ heap_close(pgrel);
CommandCounterIncrement();
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
Relation tgrel;
HeapScanDesc tgscan;
ScanKeyData key;
- Relation relrdesc;
+ Relation pgrel;
HeapTuple tuple;
Relation ridescs[Num_pg_class_indices];
MemoryContext oldcxt;
elog(ERROR, "DropTrigger: relation %s not found in pg_class", stmt->relname);
/* update pg_class */
- relrdesc = heap_openr(RelationRelationName);
+ pgrel = heap_openr(RelationRelationName);
((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found;
- RelationInvalidateHeapTuple(relrdesc, tuple);
- heap_replace(relrdesc, &tuple->t_ctid, tuple);
+ RelationInvalidateHeapTuple(pgrel, tuple);
+ heap_replace(pgrel, &tuple->t_ctid, tuple);
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);
pfree(tuple);
- heap_close(relrdesc);
+ heap_close(pgrel);
CommandCounterIncrement();
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
}
CurrentTriggerData = NULL;
pfree(SaveTriggerData);
- return (newtuple);
+ return newtuple;
}
void
trigtuple = GetTupleForTrigger(rel, tupleid, true);
if (trigtuple == NULL)
- return (false);
+ return false;
SaveTriggerData = (TriggerData *) palloc(sizeof(TriggerData));
SaveTriggerData->tg_event =
pfree(SaveTriggerData);
pfree(trigtuple);
- return ((newtuple == NULL) ? false : true);
+ return (newtuple == NULL) ? false : true;
}
void
trigtuple = GetTupleForTrigger(rel, tupleid, true);
if (trigtuple == NULL)
- return (NULL);
+ return NULL;
SaveTriggerData = (TriggerData *) palloc(sizeof(TriggerData));
SaveTriggerData->tg_event =
CurrentTriggerData = NULL;
pfree(SaveTriggerData);
pfree(trigtuple);
- return (newtuple);
+ return newtuple;
}
void
{
elog(NOTICE, "GetTupleForTrigger: Non-functional delete/update");
ReleaseBuffer(b);
- return (NULL);
+ return NULL;
}
HeapTupleSatisfies(lp, relation, b, dp,
tuple = heap_copytuple(tuple);
ReleaseBuffer(b);
- return (tuple);
+ return tuple;
}
* exist.
*/
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
* Scan the pg_shadow relation to be certain the user exists.
*/
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
* message.
*/
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
* owned by usesysid. Then drop them.
*/
pg_rel = heap_openr(DatabaseRelationName);
- pg_dsc = RelationGetTupleDescriptor(pg_rel);
+ pg_dsc = RelationGetDescr(pg_rel);
scan = heap_beginscan(pg_rel, false, SnapshotNow, 0, NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
static void vc_vaconeind(VPageList vpl, 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_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_delhilowstats(Oid relid, int attcnt, int *attnums);
static void vc_setpagelock(Relation rel, BlockNumber blkno);
vrl = cur = (VRelList) NULL;
rel = heap_openr(RelationRelationName);
- tupdesc = RelationGetTupleDescriptor(rel);
+ tupdesc = RelationGetDescr(rel);
scan = heap_beginscan(rel, false, SnapshotNow, 1, &key);
CommitTransactionCommand();
- return (vrl);
+ return vrl;
}
/*
StartTransactionCommand();
rel = heap_openr(RelationRelationName);
- tupdesc = RelationGetTupleDescriptor(rel);
+ tupdesc = RelationGetDescr(rel);
/*
* Race condition -- if the pg_class tuple has gone away since the
{
int attr_cnt,
*attnums = NULL;
- AttributeTupleForm *attr;
+ Form_pg_attribute *attr;
attr_cnt = onerel->rd_att->natts;
attr = onerel->rd_att->attrs;
for (i = 0; i < attr_cnt; i++)
{
Operator func_operator;
- OperatorTupleForm pgopform;
+ Form_pg_operator pgopform;
VacAttrStats *stats;
stats = &vacrelstats->vacattrstats[i];
func_operator = oper("=", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
+ pgopform = (Form_pg_operator) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpeq));
}
else
func_operator = oper("<", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
+ pgopform = (Form_pg_operator) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmplt));
}
else
func_operator = oper(">", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
+ pgopform = (Form_pg_operator) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpgt));
}
else
ObjectIdGetDatum(stats->attr->atttypid),
0, 0, 0);
if (HeapTupleIsValid(typetuple))
- stats->outfunc = ((TypeTupleForm) GETSTRUCT(typetuple))->typoutput;
+ stats->outfunc = ((Form_pg_type) GETSTRUCT(typetuple))->typoutput;
else
stats->outfunc = InvalidOid;
}
if (Irel != (Relation *) NULL) /* preparation for index' inserts */
{
vc_mkindesc(onerel, nindices, Irel, &Idesc);
- tupdesc = RelationGetTupleDescriptor(onerel);
+ tupdesc = RelationGetDescr(onerel);
idatum = (Datum *) palloc(INDEX_MAX_KEYS * sizeof(*idatum));
inulls = (char *) palloc(INDEX_MAX_KEYS * sizeof(*inulls));
}
vc_cmp_blk);
if (vpp == (VPageDescr *) NULL)
- return ((VPageDescr) NULL);
+ return (VPageDescr) NULL;
vp = *vpp;
/* ok - we are on true page */
if (vp->vpd_offsets_free == 0)
{ /* this is EmptyPage !!! */
- return (vp);
+ return vp;
}
voff = (OffsetNumber *) vc_find_eq((char *) (vp->vpd_offsets),
vc_cmp_offno);
if (voff == (OffsetNumber *) NULL)
- return ((VPageDescr) NULL);
+ return (VPageDescr) NULL;
- return (vp);
+ return vp;
} /* vc_tidreapped */
*
*/
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)
*bucket = value;
stup;
Form_pg_class pgcform;
ScanKeyData askey;
- AttributeTupleForm attp;
+ Form_pg_attribute attp;
Buffer buffer;
/*
Datum values[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, */
/* they are unique anyway */
continue;
{
res = compar(bot, elm);
if (res > 0)
- return (NULL);
+ return NULL;
if (res == 0)
- return (bot);
+ return bot;
first_move = false;
}
if (last_move == true)
{
res = compar(elm, bot + last * size);
if (res > 0)
- return (NULL);
+ return NULL;
if (res == 0)
- return (bot + last * size);
+ return bot + last * size;
last_move = false;
}
res = compar(elm, bot + celm * size);
if (res == 0)
- return (bot + celm * size);
+ return bot + celm * size;
if (res < 0)
{
if (celm == 0)
- return (NULL);
+ return NULL;
last = celm - 1;
celm = celm / 2;
last_move = true;
}
if (celm == last)
- return (NULL);
+ return NULL;
last = last - celm - 1;
bot = bot + (celm + 1) * size;
rblk = (*((VPageDescr *) right))->vpd_blkno;
if (lblk < rblk)
- return (-1);
+ return -1;
if (lblk == rblk)
- return (0);
- return (1);
+ return 0;
+ return 1;
} /* vc_cmp_blk */
{
if (*(OffsetNumber *) left < *(OffsetNumber *) right)
- return (-1);
+ return -1;
if (*(OffsetNumber *) left == *(OffsetNumber *) right)
- return (0);
- return (1);
+ return 0;
+ return 1;
} /* vc_cmp_offno */
/* prepare a heap scan on the pg_index relation */
pgindex = heap_openr(IndexRelationName);
- tupdesc = RelationGetTupleDescriptor(pgindex);
+ tupdesc = RelationGetDescr(pgindex);
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_index_indrelid,
F_OIDEQ,
0, 0, 0);
Assert(cachetuple);
/* 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;
*attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS;
attnumP++, natts++);
len = DOUBLEALIGN(len);
if (len > vpd->vpd_free)
- return (false);
+ return false;
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 */
if (len <= vpd->vpd_free - sizeof(ItemIdData))
- return (true);
+ return true;
- return (false);
+ return false;
} /* vc_enough_space */
* Routines for handling of 'SET var TO',
* '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 $
*
*/
/* end of string? */
if (!(*str))
{
- return (str);
+ return str;
/* delimiter? */
}
else if (*str == ',')
{
- return (++str);
+ return ++str;
}
else if ((val == NULL) || (*str != '='))
str++;
if (!(*str))
- return (NULL);
+ return NULL;
if (*str == ',')
- return (++str);
+ return ++str;
elog(ERROR, "Syntax error near (%s)", str);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (funcIsDone)
{
set_fj_initialized(fjNode, false);
- return (true);
+ return true;
}
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
junkfilter->jf_cleanTupType = cleanTupType;
junkfilter->jf_cleanMap = cleanMap;
- return (junkfilter);
+ return junkfilter;
}
if (resno == InvalidAttrNumber)
{
/* Ooops! We couldn't find this attribute... */
- return (false);
+ return false;
}
/* ---------------------
pfree(nulls);
}
- return (cleanTuple);
+ return cleanTuple;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* Total hack. I'm ignoring any accessor functions for
- * Relation, RelationTupleForm, NameData. Assuming that
+ * Relation, RelationForm, NameData. Assuming that
* NameData.data has offset 0.
*/
case CMD_NOTIFY:
pfree(econtext);
if (repl == NULL)
- return (tuple);
+ return tuple;
newtuple = heap_modifytuple(tuple, rel, replValue, replNull, repl);
pfree(replNull);
pfree(replValue);
- return (newtuple);
+ return newtuple;
}
pfree(qual);
if (!res)
- return (check[i].ccname);
+ return check[i].ccname;
}
pfree(slot);
pfree(rtlist);
pfree(econtext);
- return ((char *) NULL);
+ return (char *) NULL;
}
elog(ERROR, "%s: rejected due to CHECK constraint %s", caller, failed);
}
- return (newtuple);
+ return newtuple;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
if (result == FALSE)
- return (FALSE);
+ return FALSE;
}
switch (nodeTag(node))
{
result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
if (result == FALSE)
- return (FALSE);
+ return FALSE;
}
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
ExecSetParamPlan(prm->execPlan);
Assert(prm->execPlan == NULL);
*isNull = prm->isnull;
- return (prm->value);
+ return prm->value;
}
thisParameterName = expression->paramname;
tle, tup, isNull);
return value;
}
- return (paramList->value);
+ return paramList->value;
}
AttrNumber attrno,
bool *isNull)
{
- return (GetAttributeByNum(slot, attrno, isNull));
+ return GetAttributeByNum(slot, attrno, isNull);
}
#endif
char *
att_by_name(TupleTableSlot *slot, char *attname, bool *isNull)
{
- return (GetAttributeByName(slot, attname, isNull));
+ return GetAttributeByName(slot, attname, isNull);
}
#endif
if (fcache->nullVect[i] == true)
*isNull = true;
- return ((Datum) fmgr_c(&fcache->func, (FmgrValues *) argV, isNull));
+ return (Datum) fmgr_c(&fcache->func, (FmgrValues *) argV, isNull);
}
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
while (i < natts)
{
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));
i++;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "utils/mcxt.h"
static void
-ExecGetIndexKeyInfo(IndexTupleForm indexTuple, int *numAttsOutP,
+ExecGetIndexKeyInfo(Form_pg_index indexTuple, int *numAttsOutP,
AttrNumber **attsOutP, FuncIndexInfoPtr fInfoP);
/* ----------------------------------------------------------------
bool attbyVal,
char attalign)
{
- AttributeTupleForm att;
+ Form_pg_attribute att;
/* ----------------
* get attribute pointer and preform a sanity check..
* ----------------------------------------------------------------
*/
static void
-ExecGetIndexKeyInfo(IndexTupleForm indexTuple,
+ExecGetIndexKeyInfo(Form_pg_index indexTuple,
int *numAttsOutP,
AttrNumber **attsOutP,
FuncIndexInfoPtr fInfoP)
HeapScanDesc indexSd;
ScanKeyData key;
HeapTuple tuple;
- IndexTupleForm indexStruct;
+ Form_pg_index indexStruct;
Oid indexOid;
List *oidList;
List *nkeyList;
* first get the oid of the index relation from the tuple
* ----------------
*/
- indexStruct = (IndexTupleForm) GETSTRUCT(tuple);
+ indexStruct = (Form_pg_index) GETSTRUCT(tuple);
indexOid = indexStruct->indexrelid;
/* ----------------
* how to form the index tuples..
* ----------------
*/
- heapDescriptor = RelationGetTupleDescriptor(heapRelation);
- indexDescriptor = RelationGetTupleDescriptor(indexRelation);
+ heapDescriptor = RelationGetDescr(heapRelation);
+ indexDescriptor = RelationGetDescr(indexRelation);
/* ----------------
* FormIndexDatum fills in its datum and null parameters
fInfoP = indexInfo->ii_FuncIndexInfo;
datum = (Datum *) palloc(numberOfAttributes * sizeof *datum);
nulls = (char *) palloc(numberOfAttributes * sizeof *nulls);
- heapDescriptor = (TupleDesc) RelationGetTupleDescriptor(heapRelation);
+ heapDescriptor = (TupleDesc) RelationGetDescr(heapRelation);
FormIndexDatum(numberOfAttributes, /* num attributes */
keyAttributeNumbers, /* array of att nums to
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
while (i < oldTuple->t_natts)
{
funcTd->attrs[i] =
- (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove(funcTd->attrs[i],
resultTd->attrs[i],
ATTRIBUTE_TUPLE_SIZE);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
bucket->firstotuple = bucket->lastotuple = -1;
bucket = (HashBucket) LONGALIGN(((char *) bucket + bucketsize));
}
- return (hashtable);
+ return hashtable;
}
/* ----------------------------------------------------------------
printf("hash(%d) = %d\n", keyval, bucketno);
#endif
- return (bucketno);
+ return bucketno;
}
/* ----------------------------------------------------------------
h = h * PRIME1 ^ (*k++);
h %= PRIME2;
- return (h);
+ return h;
}
/* ----------------------------------------------------------------
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
node->hashdone = true;
}
else if (hashtable == NULL)
- return (NULL);
+ return NULL;
nbatch = hashtable->nbatch;
outerbatches = hjstate->hj_OuterBatches;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* get the scan type from the relation descriptor.
* ----------------
*/
- ExecAssignScanType(scanstate, RelationGetTupleDescriptor(currentRelation));
+ ExecAssignScanType(scanstate, RelationGetDescr(currentRelation));
ExecAssignResultTypeFromTL((Plan *) node, &scanstate->cstate);
/* ----------------
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
matstate->csstate.css_currentScanDesc = currentScanDesc;
ExecAssignScanType(&matstate->csstate,
- RelationGetTupleDescriptor(currentRelation));
+ RelationGetDescr(currentRelation));
/* ----------------
* finally set the sorted flag to true
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
scanstate->css_currentScanDesc = currentScanDesc;
ExecAssignScanType(scanstate,
- RelationGetTupleDescriptor(currentRelation));
+ RelationGetDescr(currentRelation));
}
else
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
heapTuple = psort_grabtuple(node, &should_free);
- return (ExecStoreTuple(heapTuple, slot, InvalidBuffer, should_free));
+ return ExecStoreTuple(heapTuple, slot, InvalidBuffer, should_free);
}
/* ----------------------------------------------------------------
if (sublink->subLinkType == EXPR_SUBLINK && found)
{
elog(ERROR, "ExecSubPlan: more than one tuple returned by expression subselect");
- return ((Datum) false);
+ return (Datum) false;
}
if (sublink->subLinkType == EXISTS_SUBLINK)
- return ((Datum) true);
+ return (Datum) true;
found = true;
}
if (!found && sublink->subLinkType == ALL_SUBLINK)
- return ((Datum) true);
+ return (Datum) true;
- return ((Datum) result);
+ return (Datum) result;
}
/* ----------------------------------------------------------------
sp_estate->es_refcount = estate->es_refcount;
if (!ExecInitNode(node->plan, sp_estate, NULL))
- return (false);
+ return false;
node->shutdown = true;
*/
}
- return (true);
+ return true;
}
/* ----------------------------------------------------------------
* ExecEndTee
*
* 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 $
*
*-------------------------------------------------------------------------
*/
IncrBufferRefCount(scanDesc->rs_cbuf);
slot = teeState->cstate.cs_ResultTupleSlot;
- slot->ttc_tupleDescriptor = RelationGetTupleDescriptor(bufferRel);
+ slot->ttc_tupleDescriptor = RelationGetDescr(bufferRel);
result = ExecStoreTuple(heapTuple, /* tuple to store */
slot, /* slot to store in */
* to _SPI_connected
*/
if (_SPI_curid != _SPI_connected)
- return (SPI_ERROR_CONNECT);
+ return SPI_ERROR_CONNECT;
if (_SPI_stack == NULL)
{
_SPI_current->savedId = GetScanCommandId();
SetScanCommandId(GetCurrentCommandId());
- return (SPI_OK_CONNECT);
+ return SPI_OK_CONNECT;
}
res = _SPI_begin_call(false); /* live in procedure memory */
if (res < 0)
- return (res);
+ return res;
/* Restore memory context as it was before procedure call */
MemoryContextSwitchTo(_SPI_current->savedcxt);
_SPI_current = &(_SPI_stack[_SPI_connected]);
}
- return (SPI_OK_FINISH);
+ return SPI_OK_FINISH;
}
int res;
if (src == NULL || tcount < 0)
- return (SPI_ERROR_ARGUMENT);
+ return SPI_ERROR_ARGUMENT;
res = _SPI_begin_call(true);
if (res < 0)
- return (res);
+ return res;
res = _SPI_execute(src, tcount, NULL);
_SPI_end_call(true);
- return (res);
+ return res;
}
int
int res;
if (plan == NULL || tcount < 0)
- return (SPI_ERROR_ARGUMENT);
+ return SPI_ERROR_ARGUMENT;
if (((_SPI_plan *) plan)->nargs > 0 && Values == NULL)
- return (SPI_ERROR_PARAM);
+ return SPI_ERROR_PARAM;
res = _SPI_begin_call(true);
if (res < 0)
- return (res);
+ return res;
/* copy plan to current (executor) context */
plan = (void *) _SPI_copy_plan(plan, _SPI_CPLAN_CURCXT);
res = _SPI_execute_plan((_SPI_plan *) plan, Values, Nulls, tcount);
_SPI_end_call(true);
- return (res);
+ return res;
}
void *
if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL))
{
SPI_result = SPI_ERROR_ARGUMENT;
- return (NULL);
+ return NULL;
}
SPI_result = _SPI_begin_call(true);
if (SPI_result < 0)
- return (NULL);
+ return NULL;
plan = (_SPI_plan *) palloc(sizeof(_SPI_plan)); /* Executor context */
plan->argtypes = argtypes;
_SPI_end_call(true);
- return ((void *) plan);
+ return (void *) plan;
}
if (plan == NULL)
{
SPI_result = SPI_ERROR_ARGUMENT;
- return (NULL);
+ return NULL;
}
SPI_result = _SPI_begin_call(false); /* don't change context */
if (SPI_result < 0)
- return (NULL);
+ return NULL;
newplan = _SPI_copy_plan((_SPI_plan *) plan, _SPI_CPLAN_TOPCXT);
_SPI_curid--;
SPI_result = 0;
- return ((void *) newplan);
+ return (void *) newplan;
}
if (tuple == NULL)
{
SPI_result = SPI_ERROR_ARGUMENT;
- return (NULL);
+ return NULL;
}
if (_SPI_curid + 1 == _SPI_connected) /* connected */
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
- return (ctuple);
+ return ctuple;
}
HeapTuple
if (rel == NULL || tuple == NULL || natts <= 0 || attnum == NULL || Values == NULL)
{
SPI_result = SPI_ERROR_ARGUMENT;
- return (NULL);
+ return NULL;
}
if (_SPI_curid + 1 == _SPI_connected) /* connected */
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);
infomask = mtuple->t_infomask;
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
- return (mtuple);
+ return mtuple;
}
int
for (res = 0; res < tupdesc->natts; res++)
{
if (strcasecmp(tupdesc->attrs[res]->attname.data, fname) == 0)
- return (res + 1);
+ return res + 1;
}
- return (SPI_ERROR_NOATTRIBUTE);
+ return SPI_ERROR_NOATTRIBUTE;
}
char *
if (tupdesc->natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
- return (NULL);
+ return NULL;
}
- return (nameout(&(tupdesc->attrs[fnumber - 1]->attname)));
+ return nameout(&(tupdesc->attrs[fnumber - 1]->attname));
}
char *
if (tuple->t_natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
- return (NULL);
+ return NULL;
}
val = heap_getattr(tuple, fnumber, tupdesc, &isnull);
if (isnull)
- return (NULL);
+ return NULL;
foutoid = typtoout((Oid) tupdesc->attrs[fnumber - 1]->atttypid);
if (!OidIsValid(foutoid))
{
SPI_result = SPI_ERROR_NOOUTFUNC;
- return (NULL);
+ return NULL;
}
return (fmgr(foutoid, val,
if (tuple->t_natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
- return ((Datum) NULL);
+ return (Datum) NULL;
}
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
- return (val);
+ return val;
}
char *
if (tupdesc->natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
- return (NULL);
+ return NULL;
}
typeTuple = SearchSysCacheTuple(TYPOID,
if (!HeapTupleIsValid(typeTuple))
{
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
if (tupdesc->natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
- return (InvalidOid);
+ return InvalidOid;
}
- return (tupdesc->attrs[fnumber - 1]->atttypid);
+ return tupdesc->attrs[fnumber - 1]->atttypid;
}
char *
SPI_getrelname(Relation rel)
{
- return (pstrdup(rel->rd_rel->relname.data));
+ return pstrdup(rel->rd_rel->relname.data);
}
void *
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
- return (pointer);
+ return pointer;
}
void *
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
- return (pointer);
+ return pointer;
}
void
CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt);
if (stmt->filename == NULL)
- return (SPI_ERROR_COPY);
+ return SPI_ERROR_COPY;
}
else if (nodeTag(queryTree->utilityStmt) == T_ClosePortalStmt ||
nodeTag(queryTree->utilityStmt) == T_FetchStmt)
- return (SPI_ERROR_CURSOR);
+ return SPI_ERROR_CURSOR;
else if (nodeTag(queryTree->utilityStmt) == T_TransactionStmt)
- return (SPI_ERROR_TRANSACTION);
+ return SPI_ERROR_TRANSACTION;
res = SPI_OK_UTILITY;
if (plan == NULL)
{
if (i < qlen - 1)
CommandCounterIncrement();
else
- return (res);
+ return res;
}
else if (i >= qlen - 1)
break;
state = CreateExecutorState();
res = _SPI_pquery(qdesc, state, (i < qlen - 1) ? 0 : tcount);
if (res < 0 || i >= qlen - 1)
- return (res);
+ return res;
CommandCounterIncrement();
}
else
(i < qlen - 1) ? None : SPI);
res = _SPI_pquery(qdesc, NULL, (i < qlen - 1) ? 0 : tcount);
if (res < 0)
- return (res);
+ return res;
if (i >= qlen - 1)
break;
}
plan->qtlist = queryTree_list;
plan->ptlist = ptlist;
- return (res);
+ return res;
}
if (i < qlen - 1)
CommandCounterIncrement();
else
- return (SPI_OK_UTILITY);
+ return SPI_OK_UTILITY;
}
else
{
state->es_param_list_info = NULL;
res = _SPI_pquery(qdesc, state, (i < qlen - 1) ? 0 : tcount);
if (res < 0 || i >= qlen - 1)
- return (res);
+ return res;
CommandCounterIncrement();
}
}
- return (res);
+ return res;
}
intoName = parseTree->into;
parseTree->isBinary = false; /* */
- return (SPI_ERROR_CURSOR);
+ return SPI_ERROR_CURSOR;
}
else if (parseTree->into != NULL) /* select into table */
res = SPI_OK_UPDATE;
break;
default:
- return (SPI_ERROR_OPUNKNOWN);
+ return SPI_ERROR_OPUNKNOWN;
}
if (state == NULL) /* plan preparation */
- return (res);
+ return res;
#ifdef SPI_EXECUTOR_STATS
if (ShowExecutorStats)
ResetUsage();
state,
tupdesc,
None);
- return (SPI_OK_CURSOR);
+ return SPI_OK_CURSOR;
}
ExecutorRun(queryDesc, state, EXEC_FOR, tcount);
}
queryDesc->dest = dest;
- return (res);
+ return res;
}
phmem = PortalGetHeapMemory(_SPI_current->portal);
oldcxt = MemoryContextSwitchTo((MemoryContext) phmem);
- return (oldcxt);
+ return oldcxt;
}
pvmem = PortalGetVariableMemory(_SPI_current->portal);
oldcxt = MemoryContextSwitchTo((MemoryContext) pvmem);
- return (oldcxt);
+ return oldcxt;
}
_SPI_begin_call(bool execmem)
{
if (_SPI_curid + 1 != _SPI_connected)
- return (SPI_ERROR_UNCONNECTED);
+ return SPI_ERROR_UNCONNECTED;
_SPI_curid++;
if (_SPI_current != &(_SPI_stack[_SPI_curid]))
elog(FATAL, "SPI: stack corrupted");
StartPortalAllocMode(DefaultAllocMode, 0);
}
- return (0);
+ return 0;
}
static int
_SPI_procmem();
}
- return (0);
+ return 0;
}
static bool
failed = true;
}
- return (failed);
+ return failed;
}
static _SPI_plan *
if (location != _SPI_CPLAN_CURCXT)
MemoryContextSwitchTo(oldcxt);
- return (newplan);
+ return newplan;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Dlelem *
DLGetHead(Dllist *l)
{
- return (l ? l->dll_head : 0);
+ return l ? l->dll_head : 0;
}
/* get the value stored in the first element */
{
Dlelem *e = DLGetHead(l);
- return (e ? e->dle_val : 0);
+ return e ? e->dle_val : 0;
}
#endif
Dlelem *
DLGetTail(Dllist *l)
{
- return (l ? l->dll_tail : 0);
+ return l ? l->dll_tail : 0;
}
/* get the value stored in the first element */
{
Dlelem *e = DLGetTail(l);
- return (e ? e->dle_val : 0);
+ return e ? e->dle_val : 0;
}
#endif
Dlelem *
DLGetPred(Dlelem *e) /* get predecessor */
{
- return (e ? e->dle_prev : 0);
+ return e ? e->dle_prev : 0;
}
Dlelem *
DLGetSucc(Dlelem *e) /* get successor */
{
- return (e ? e->dle_next : 0);
+ return e ? e->dle_next : 0;
}
void
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top))
- return (NULL);
+ return NULL;
pointer = FixedStackGetItemBase(stack, stack->top);
stack->top = stack->top->next;
- return (pointer);
+ return pointer;
}
void
for (next = stack->top; FixedItemIsValid(next); next = next->next)
{
if (next == item)
- return (true);
+ return true;
}
- return (false);
+ return false;
}
#endif
AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top))
- return (NULL);
+ return NULL;
- return (FixedStackGetItemBase(stack, stack->top));
+ return FixedStackGetItemBase(stack, stack->top);
}
Pointer
item = FixedStackGetItem(stack, pointer)->next;
if (!PointerIsValid(item))
- return (NULL);
+ return NULL;
- return (FixedStackGetItemBase(stack, item));
+ return FixedStackGetItemBase(stack, item);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* find size of list */
num = length(the_list);
if (num < 2)
- return (copyObject(the_list));
+ return copyObject(the_list);
/* copy elements of the list into an array */
nodearray = (List **) palloc(num * sizeof(List *));
for (i = num - 1; i >= 0; i--)
output = lcons(nodearray[i], output);
- return (output);
+ return output;
}
#endif
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
res->data[0] = '\0';
- return (res);
+ return res;
}
/*---------------------------------------------------------------------
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
krb_err_txt[status]);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (strncmp(version, PG_KRB4_VERSION, KRB_SENDAUTH_VLEN))
{
PG_KRB4_VERSION);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (strncmp(port->user, auth_data.pname, SM_USER))
{
auth_data.pname);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
- return (STATUS_OK);
+ return STATUS_OK;
}
#else
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
#endif /* KRB4 */
if ((p = strchr(aname, '/')) || (p = strchr(aname, '@')))
*p = '\0';
- return (aname);
+ return aname;
}
/*
"pg_krb5_recvauth: Kerberos error %d in krb5_parse_name\n",
code);
com_err("pg_krb5_recvauth", code, "in krb5_parse_name");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/*
code);
com_err("pg_krb5_recvauth", code, "in krb5_recvauth");
krb5_free_principal(server);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
krb5_free_principal(server);
code);
com_err("pg_krb5_recvauth", code, "in krb5_unparse_name");
krb5_free_principal(client);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
krb5_free_principal(client);
if (!kusername)
"pg_krb5_recvauth: could not decode username\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
kusername = pg_an_to_ln(kusername);
if (strncmp(username, kusername, SM_USER))
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
pfree(kusername);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
pfree(kusername);
- return (STATUS_OK);
+ return STATUS_OK;
}
#else
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
#endif /* KRB5 */
auth_failed(port);
}
- return (STATUS_OK); /* don't close the connection yet */
+ return STATUS_OK; /* don't close the connection yet */
}
else
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 */
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Dlelem *elt;
elt = DLGetTail(be_portalstack);
- return (elt ? (PortalEntry *) DLE_VAL(elt) : NULL);
+ return elt ? (PortalEntry *) DLE_VAL(elt) : NULL;
}
/* ----------------
PortalBuffer *portal;
GroupBuffer *group;
int i;
- AttributeTupleForm *attrs = tupDesc->attrs;
+ Form_pg_attribute *attrs = tupDesc->attrs;
/* ----------------
* add a new portal group to the portal
*
*
* 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
* This should be moved to a more appropriate place. It is here
int
lo_unlink(Oid lobjId)
{
- return (inv_destroy(lobjId));
+ return inv_destroy(lobjId);
}
/*****************************************************************************
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
return pqtest_PQexec(q);
break;
}
- return (0);
+ return 0;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
static bool
isblank(const char c)
{
- return (c == ' ' || c == 9 /* tab */ );
+ return c == ' ' || c == 9 /* tab */ ;
}
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)
{
/*--------------------------------------------------------------------------
static void
-process_hba_record(FILE *file, SockAddr *raddr, const char user[],
- const char database[], bool *matches_p, bool *error_p,
- UserAuth *userauth_p, char auth_arg[])
+process_hba_record(FILE *file, SockAddr *raddr, const char *user,
+ const char *database, bool *matches_p, bool *error_p,
+ UserAuth *userauth_p, char *auth_arg)
{
/*---------------------------------------------------------------------------
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"
- to a database named "database[]". If so, return *matches_p true
- and *userauth_p and auth_arg[] as the values from the entry.
+ to a database named "*database". If so, return *matches_p true
+ 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,
return *error_p true, after issuing a message to stderr. If no error,
leave *error_p as it was.
static void
-process_open_config_file(FILE *file, SockAddr *raddr, const char user[],
- const char database[], bool *host_ok_p,
- UserAuth *userauth_p, char auth_arg[])
+process_open_config_file(FILE *file, SockAddr *raddr, const char *user,
+ const char *database, bool *host_ok_p,
+ UserAuth *userauth_p, char *auth_arg)
{
/*---------------------------------------------------------------------------
This function does the same thing as find_hba_entry, only with
static void
-find_hba_entry(SockAddr *raddr, const char user[], const char database[],
- bool *host_ok_p, UserAuth *userauth_p, char auth_arg[])
+find_hba_entry(SockAddr *raddr, const char *user, const char *database,
+ bool *host_ok_p, UserAuth *userauth_p, char *auth_arg)
{
/*--------------------------------------------------------------------------
Read the config file and find an entry that allows connection from
static void
-interpret_ident_response(char ident_response[],
- bool *error_p, char ident_username[])
+interpret_ident_response(char *ident_response,
+ 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
- *error_p == false and the username as ident_username[]. If it's anything
- else, return *error_p == true and ident_username[] undefined.
+ *error_p == false and the username as *ident_username. If it's anything
+ 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];
{
/* We're positioned to colon before response type field */
char response_type[80];
- int i; /* Index into response_type[] */
+ int i; /* Index into *response_type */
cursor++; /* Go over colon */
while (isblank(*cursor))
*error_p = true;
else
{
- int i; /* Index into ident_username[] */
+ int i; /* Index into *ident_username */
cursor++; /* Go over colon */
while (isblank(*cursor))
static void
ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
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
owns the tcp connection from his port "remote_port" to port
"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.
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;
static void
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
static void
verify_against_open_usermap(FILE *file,
- const char pguser[],
- const char ident_username[],
- const char usermap_name[],
+ const char *pguser,
+ const char *ident_username,
+ const char *usermap_name,
bool *checks_out_p)
{
/*--------------------------------------------------------------------------
static void
-verify_against_usermap(const char pguser[],
- const char ident_username[],
- const char usermap_name[],
+verify_against_usermap(const char *pguser,
+ const char *ident_username,
+ const char *usermap_name,
bool *checks_out_p)
{
/*--------------------------------------------------------------------------
int
authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
- const char postgres_username[],
- const char auth_arg[])
+ const char *postgres_username,
+ const char *auth_arg)
{
/*---------------------------------------------------------------------------
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
- the usermap auth_arg[] and see if that user is equivalent to
- Postgres user user[].
+ the usermap *auth_arg and see if that user is equivalent to
+ Postgres user *user.
Return STATUS_OK if yes.
---------------------------------------------------------------------------*/
verify_against_usermap(postgres_username, ident_username, auth_arg,
&checks_out);
- return (checks_out ? STATUS_OK : STATUS_ERROR);
+ return checks_out ? STATUS_OK : STATUS_ERROR;
}
if (valid)
{
FromAddr = file_ip_addr.s_addr;
- return ((unsigned) FromAddr == (unsigned) host);
+ return (unsigned) FromAddr == (unsigned) host;
}
}
}
}
void
-GetCharSetByHost(char TableName[], int host, const char DataDir[])
+GetCharSetByHost(char *TableName, int host, const char *DataDir)
{
FILE *file;
char buf[MAX_TOKEN],
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;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* communicate with a backend or by user-defined functions which
* 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.
*
* Do not confuse "PortalEntry" (or "PortalBuffer") with "Portal"
msg, value, min, max);
pqdebug("%s", PQerrormsg);
fputs(PQerrormsg, stderr);
- return (0);
+ return 0;
}
- return (1);
+ return 1;
}
static int
sprintf(PQerrormsg, "FATAL: %s\n", msg);
pqdebug("%s", PQerrormsg);
fputs(PQerrormsg, stderr);
- return (0);
+ return 0;
}
- return (1);
+ return 1;
}
++n;
}
}
- return (n);
+ return n;
}
/* --------------------------------
return NULL;
if ((i = pbuf_getIndex(pname)) < 0)
- return ((PortalBuffer *) NULL);
- return (portals[i]->portal);
+ return (PortalBuffer *) NULL;
+ return portals[i]->portal;
}
/* --------------------------------
PQrulep(PortalBuffer *portal)
{
if (!valid_pointer("PQrulep: invalid portal pointer", portal))
- return (-1);
+ return -1;
- return (portal->rule_p);
+ return portal->rule_p;
}
/* --------------------------------
PQntuples(PortalBuffer *portal)
{
if (!valid_pointer("PQntuples: invalid portal pointer", portal))
- return (-1);
+ return -1;
- return (portal->no_tuples);
+ return portal->no_tuples;
}
int
PQninstances(PortalBuffer *portal)
{
- return (PQntuples(portal));
+ return PQntuples(portal);
}
/* --------------------------------
PQngroups(PortalBuffer *portal)
{
if (!valid_pointer("PQngroups: invalid portal pointer", portal))
- return (-1);
+ return -1;
- return (portal->no_groups);
+ return portal->no_groups;
}
/* --------------------------------
if (!valid_pointer("PQntuplesGroup: invalid portal pointer", portal) ||
!in_range("PQntuplesGroup: group index",
group_index, 0, portal->no_groups))
- return (-1);
+ return -1;
gbp = pbuf_findGroup(portal, group_index);
if (gbp)
- return (gbp->no_tuples);
- return (-1);
+ return gbp->no_tuples;
+ return -1;
}
int
PQninstancesGroup(PortalBuffer *portal, int group_index)
{
- return (PQntuplesGroup(portal, group_index));
+ return PQntuplesGroup(portal, group_index);
}
/* --------------------------------
if (!valid_pointer("PQnfieldsGroup: invalid portal pointer", portal) ||
!in_range("PQnfieldsGroup: group index",
group_index, 0, portal->no_groups))
- return (-1);
+ return -1;
gbp = pbuf_findGroup(portal, group_index);
if (gbp)
- return (gbp->no_fields);
- return (-1);
+ return gbp->no_fields;
+ return -1;
}
/* --------------------------------
field_name) ||
!in_range("PQfnumberGroup: group index",
group_index, 0, portal->no_groups))
- return (-1);
+ return -1;
gbp = pbuf_findGroup(portal, group_index);
if (gbp)
- return (pbuf_findFnumber(gbp, field_name));
- return (-1);
+ return pbuf_findFnumber(gbp, field_name);
+ return -1;
}
/* --------------------------------
if (!valid_pointer("PQfnameGroup: invalid portal pointer", portal) ||
!in_range("PQfnameGroup: group index",
group_index, 0, portal->no_groups))
- return ((char *) NULL);
+ return (char *) NULL;
if ((gbp = pbuf_findGroup(portal, group_index)) &&
in_range("PQfnameGroup: field number",
field_number, 0, gbp->no_fields))
- return (pbuf_findFname(gbp, field_number));
- return ((char *) NULL);
+ return pbuf_findFname(gbp, field_number);
+ return (char *) NULL;
}
/* --------------------------------
if (!valid_pointer("PQftypeGroup: invalid portal pointer", portal) ||
!in_range("PQftypeGroup: group index",
group_index, 0, portal->no_groups))
- return (-1);
+ return -1;
if ((gbp = pbuf_findGroup(portal, group_index)) &&
in_range("PQftypeGroup: field number", field_number, 0, gbp->no_fields))
- return (gbp->types[field_number].typid);
- return (-1);
+ return gbp->types[field_number].typid;
+ return -1;
}
/* --------------------------------
if (!valid_pointer("PQfsizeGroup: invalid portal pointer", portal) ||
!in_range("PQfsizeGroup: tuple index",
group_index, 0, portal->no_groups))
- return (-1);
+ return -1;
if ((gbp = pbuf_findGroup(portal, group_index)) &&
in_range("PQfsizeGroup: field number", field_number, 0, gbp->no_fields))
- return (gbp->types[field_number].typlen);
- return (-1);
+ return gbp->types[field_number].typlen;
+ return -1;
}
if (!valid_pointer("PQgroup: invalid portal pointer", portal) ||
!in_range("PQgroup: tuple index",
tuple_index, 0, portal->no_tuples))
- return ((GroupBuffer *) NULL);
+ return (GroupBuffer *) NULL;
for (gbp = portal->groups;
gbp && tuple_index >= (tuple_count += gbp->no_tuples);
;
if (!in_range("PQgroup: tuple not found: tuple index",
tuple_index, 0, tuple_count))
- return ((GroupBuffer *) NULL);
- return (gbp);
+ return (GroupBuffer *) NULL;
+ return gbp;
}
/* --------------------------------
if (!valid_pointer("PQgetgroup: invalid portal pointer", portal) ||
!in_range("PQgetgroup: tuple index",
tuple_index, 0, portal->no_tuples))
- return (-1);
+ return -1;
for (gbp = portal->groups;
gbp && tuple_index >= (tuple_count += gbp->no_tuples);
++group_count;
if (!gbp || !in_range("PQgetgroup: tuple not found: tuple index",
tuple_index, 0, tuple_count))
- return (-1);
- return (group_count);
+ return -1;
+ return group_count;
}
/* --------------------------------
if (!valid_pointer("PQnfields: invalid portal pointer", portal) ||
!in_range("PQnfields: tuple index",
tuple_index, 0, portal->no_tuples))
- return (-1);
+ return -1;
gbp = PQgroup(portal, tuple_index);
if (gbp)
- return (gbp->no_fields);
- return (-1);
+ return gbp->no_fields;
+ return -1;
}
/* --------------------------------
!valid_pointer("PQfnumber: invalid field name pointer", field_name) ||
!in_range("PQfnumber: tuple index",
tuple_index, 0, portal->no_tuples))
- return (-1);
+ return -1;
gbp = PQgroup(portal, tuple_index);
if (gbp)
- return (pbuf_findFnumber(gbp, field_name));
- return (-1);
+ return pbuf_findFnumber(gbp, field_name);
+ return -1;
}
/* --------------------------------
if (!valid_pointer("PQfname: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index",
tuple_index, 0, portal->no_tuples))
- return ((char *) NULL);
+ return (char *) NULL;
if ((gbp = PQgroup(portal, tuple_index)) &&
in_range("PQfname: field number",
field_number, 0, gbp->no_fields))
- return (pbuf_findFname(gbp, field_number));
- return ((char *) NULL);
+ return pbuf_findFname(gbp, field_number);
+ return (char *) NULL;
}
/* --------------------------------
if (!valid_pointer("PQftype: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index",
tuple_index, 0, portal->no_tuples))
- return (-1);
+ return -1;
if ((gbp = PQgroup(portal, tuple_index)) &&
in_range("PQftype: field number", field_number, 0, gbp->no_fields))
- return (gbp->types[field_number].typid);
- return (-1);
+ return gbp->types[field_number].typid;
+ return -1;
}
/* --------------------------------
if (!valid_pointer("PQfsize: invalid portal pointer", portal) ||
!in_range("PQfsize: tuple index",
tuple_index, 0, portal->no_tuples))
- return (-1);
+ return -1;
if ((gbp = PQgroup(portal, tuple_index)) &&
in_range("PQfsize: field number", field_number, 0, gbp->no_fields))
- return (gbp->types[field_number].typlen);
- return (-1);
+ return gbp->types[field_number].typlen;
+ return -1;
}
tuple_index1, 0, portal->no_tuples) ||
!in_range("PQsametype: tuple index 2",
tuple_index2, 0, portal->no_tuples))
- return (-1);
+ return -1;
gbp1 = PQgroup(portal, tuple_index1);
gbp2 = PQgroup(portal, tuple_index2);
if (gbp1 && gbp2)
- return (gbp1 == gbp2);
- return (-1);
+ return gbp1 == gbp2;
+ return -1;
}
static TupleBlock *
tuple_offset) ||
!in_range("PQGetTupleBlock: tuple index",
tuple_index, 0, portal->no_tuples))
- return ((TupleBlock *) NULL);
+ return (TupleBlock *) NULL;
for (gbp = portal->groups;
gbp && tuple_index >= (tuple_count += gbp->no_tuples);
if (!gbp ||
!in_range("PQGetTupleBlock: tuple not found: tuple index",
tuple_index, 0, tuple_count))
- return ((TupleBlock *) NULL);
+ return (TupleBlock *) NULL;
tuple_count -= gbp->no_tuples;
for (tbp = gbp->tuples;
tbp && tuple_index >= (tuple_count += TupleBlockSize);
if (!tbp ||
!in_range("PQGetTupleBlock: tuple not found: tuple index",
tuple_index, 0, tuple_count))
- return ((TupleBlock *) NULL);
+ return (TupleBlock *) NULL;
tuple_count -= TupleBlockSize;
*tuple_offset = tuple_index - tuple_count;
- return (tbp);
+ return tbp;
}
/* --------------------------------
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
- return (tbp->values[tuple_offset][field_number]);
- return ((char *) NULL);
+ return tbp->values[tuple_offset][field_number];
+ return (char *) NULL;
}
/* --------------------------------
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
- return (tbp->lengths[tuple_offset][field_number]);
- return (-1);
+ return tbp->lengths[tuple_offset][field_number];
+ return -1;
}
/* ----------------
PQcleanNotify();
e = DLGetHead(pqNotifyList);
- return (e ? (PQNotifyList *) DLE_VAL(e) : NULL);
+ return e ? (PQNotifyList *) DLE_VAL(e) : NULL;
}
void
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (addr == (caddr_t) NULL)
libpq_raise(&MemoryError, form("Cannot Allocate space."));
- return (addr);
+ return addr;
}
/* --------------------------------
portal->no_groups = 0;
portal->groups = NULL;
- return (portal);
+ return portal;
}
/* --------------------------------
group1->next = group;
}
- return (group);
+ return group;
}
/* --------------------------------
types = (TypeBlock *)
pbuf_alloc(n * sizeof(TypeBlock));
- return (types);
+ return types;
}
/* --------------------------------
tuples->next = NULL;
tuples->tuple_index = 0;
- return (tuples);
+ return tuples;
}
/* --------------------------------
return i;
}
- return (-1);
+ return -1;
}
/* --------------------------------
libpq_raise(&PortalError,
form("Group index %d out of bound.", group_index));
- return (group);
+ return group;
}
/* --------------------------------
for (i = 0; i < group->no_fields; i++)
if (strncmp(types[i].name, field_name, NAMEDATALEN) == 0)
- return (i);
+ return i;
libpq_raise(&PortalError,
form("Field-name %s does not exist.", field_name));
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
char *envport = getenv("PGPORT");
if (envport)
- return (atoi(envport));
- return (atoi(DEF_PGPORT));
+ return atoi(envport);
+ return atoi(DEF_PGPORT);
}
/* --------------------------------
if (Pfin == (FILE *) NULL)
{
/* elog(DEBUG, "Input descriptor is null"); */
- return (EOF);
+ return EOF;
}
while (maxlen-- && (c = pq_getc(Pfin)) != EOF && c)
* -----------------
*/
if (c == EOF)
- return (EOF);
- return (!EOF);
+ return EOF;
+ return !EOF;
}
/*
PQgetline(char *s, int maxlen)
{
if (!Pfin || !s || maxlen <= 1)
- return (EOF);
+ return EOF;
if (fgets(s, maxlen - 1, Pfin) == NULL)
return feof(Pfin) ? EOF : 1;
fputs(s, Pfout);
fflush(Pfout);
}
- return (0);
+ return 0;
}
/* --------------------------------
if (!(hs = gethostbyname(host)))
{
perror(host);
- return (1);
+ return 1;
}
if (hs->h_addrtype != AF_INET)
{
host);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (1);
+ return 1;
}
memmove((char *) &sin->sin_addr,
hs->h_addr,
}
sin->sin_family = AF_INET;
sin->sin_port = htons(port);
- return (0);
+ return 0;
}
/* --------------------------------
struct servent *ss;
if (*serv >= '0' && *serv <= '9')
- return (pq_getinaddr(sin, host, atoi(serv)));
+ return pq_getinaddr(sin, host, atoi(serv));
if (!(ss = getservbyname(serv, NULL)))
{
sprintf(PQerrormsg,
serv);
fputs(PQerrormsg, stderr);
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));
}
/*
errno);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
sizeof(one))) == -1)
errno);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
MemSet((char *) &saddr, 0, sizeof(saddr));
saddr.sa.sa_family = family;
else
strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
fputs(PQerrormsg, stderr);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (family == AF_UNIX) {
*fdP = fd;
if (family == AF_UNIX)
chmod(sock_path, 0777);
- return (STATUS_OK);
+ return STATUS_OK;
}
/*
&addrlen)) < 0)
{
elog(ERROR, "postmaster: StreamConnection: accept: %m");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/* fill in the server (local) address */
&addrlen) < 0)
{
elog(ERROR, "postmaster: StreamConnection: getsockname: %m");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (family == AF_INET)
{
if (pe == NULL)
{
elog(ERROR, "postmaster: getprotobyname failed");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (setsockopt(port->sock, pe->p_proto, TCP_NODELAY,
&on, sizeof(on)) < 0)
{
elog(ERROR, "postmaster: setsockopt failed");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
}
/* reset to non-blocking */
fcntl(port->sock, F_SETFL, 1);
- return (STATUS_OK);
+ return STATUS_OK;
}
/*
hostName);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
memmove((char *) &(port->raddr.in.sin_addr),
(char *) hp->h_addr,
errno);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
err = connect(port->sock, &port->raddr.sa, len);
if (err < 0)
errno);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/* fill in the client address */
errno);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
- return (STATUS_OK);
+ return STATUS_OK;
}
#ifdef MULTIBYTE
*
*
* 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
* This shouldn't be in libpq, but the monitor and some other
if (signo != SIGALRM)
act.sa_flags |= SA_RESTART;
if (sigaction(signo, &act, &oact) < 0)
- return (SIG_ERR);
- return (oact.sa_handler);
+ return SIG_ERR;
+ return oact.sa_handler;
#endif /* !USE_POSIX_SIGNALS */
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (!from->constisnull && cached_type != from->consttype)
{
HeapTuple typeTuple;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
/* ----------------
* get the type tuple corresponding to the paramList->type,
*/
Assert(PointerIsValid(typeTuple));
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTuple);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
cached_typbyval = (typeStruct)->typbyval ? true : false;
cached_type = from->consttype;
}
}
/* ----------------
- * _copyCInfo
+ * _copyClauseInfo
* ----------------
*/
-static CInfo *
-_copyCInfo(CInfo *from)
+static ClauseInfo *
+_copyClauseInfo(ClauseInfo *from)
{
- CInfo *newnode = makeNode(CInfo);
+ ClauseInfo *newnode = makeNode(ClauseInfo);
/* ----------------
* copy remainder of node
}
/* ----------------
- * _copyJInfo
+ * _copyJoinInfo
* ----------------
*/
-static JInfo *
-_copyJInfo(JInfo *from)
+static JoinInfo *
+_copyJoinInfo(JoinInfo *from)
{
- JInfo *newnode = makeNode(JInfo);
+ JoinInfo *newnode = makeNode(JoinInfo);
/* ----------------
* copy remainder of node
case T_MergeOrder:
retval = _copyMergeOrder(from);
break;
- case T_CInfo:
- retval = _copyCInfo(from);
+ case T_ClauseInfo:
+ retval = _copyClauseInfo(from);
break;
case T_JoinMethod:
retval = _copyJoinMethod(from);
case T_MInfo:
retval = _copyMInfo(from);
break;
- case T_JInfo:
- retval = _copyJInfo(from);
+ case T_JoinInfo:
+ retval = _copyJoinInfo(from);
break;
case T_Iter:
retval = _copyIter(from);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
_equalResdom(Resdom *a, Resdom *b)
{
if (a->resno != b->resno)
- return (false);
+ return false;
if (a->restype != b->restype)
- return (false);
+ return false;
if (a->restypmod != b->restypmod)
- return (false);
+ return false;
if (strcmp(a->resname, b->resname) != 0)
- return (false);
+ return false;
if (a->reskey != b->reskey)
- return (false);
+ return false;
if (a->reskeyop != b->reskeyop)
- return (false);
+ return false;
- return (true);
+ return true;
}
static bool
int nNodes;
if (a->fj_initialized != b->fj_initialized)
- return (false);
+ return false;
if (a->fj_nNodes != b->fj_nNodes)
- return (false);
+ return false;
if (!equal(a->fj_innerNode, b->fj_innerNode))
- return (false);
+ return false;
nNodes = a->fj_nNodes;
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)
- return (false);
+ return false;
- return (true);
+ return true;
}
/*
_equalExpr(Expr *a, Expr *b)
{
if (a->opType != b->opType)
- return (false);
+ return false;
if (!equal(a->oper, b->oper))
- return (false);
+ return false;
if (!equal(a->args, b->args))
- return (false);
+ return false;
- return (true);
+ return true;
}
static bool
_equalIter(Iter *a, Iter *b)
{
- return (equal(a->iterexpr, b->iterexpr));
+ return equal(a->iterexpr, b->iterexpr);
}
static bool
_equalStream(Stream *a, Stream *b)
{
if (a->clausetype != b->clausetype)
- return (false);
+ return false;
if (a->groupup != b->groupup)
- return (false);
+ return false;
if (a->groupcost != b->groupcost)
- return (false);
+ return false;
if (a->groupsel != b->groupsel)
- return (false);
+ return false;
if (!equal(a->pathptr, b->pathptr))
- return (false);
+ return false;
if (!equal(a->cinfo, b->cinfo))
- return (false);
+ return false;
if (!equal(a->upstream, b->upstream))
- return (false);
- return (equal(a->downstream, b->downstream));
+ return false;
+ return equal(a->downstream, b->downstream);
}
/*
_equalVar(Var *a, Var *b)
{
if (a->varno != b->varno)
- return (false);
+ return false;
if (a->varattno != b->varattno)
- return (false);
+ return false;
if (a->vartype != b->vartype)
- return (false);
+ return false;
if (a->vartypmod != b->vartypmod)
- return (false);
+ return false;
if (a->varlevelsup != b->varlevelsup)
- return (false);
+ return false;
if (a->varnoold != b->varnoold)
- return (false);
+ return false;
if (a->varoattno != b->varoattno)
- return (false);
+ return false;
- return (true);
+ return true;
}
static bool
_equalArray(Array *a, Array *b)
{
if (a->arrayelemtype != b->arrayelemtype)
- return (false);
+ return false;
if (a->arrayndim != b->arrayndim)
- return (false);
+ return false;
if (a->arraylow.indx[0] != b->arraylow.indx[0])
- return (false);
+ return false;
if (a->arrayhigh.indx[0] != b->arrayhigh.indx[0])
- return (false);
+ return false;
if (a->arraylen != b->arraylen)
- return (false);
- return (TRUE);
+ return false;
+ return TRUE;
}
static bool
_equalArrayRef(ArrayRef *a, ArrayRef *b)
{
if (a->refelemtype != b->refelemtype)
- return (false);
+ return false;
if (a->refattrlength != b->refattrlength)
- return (false);
+ return false;
if (a->refelemlength != b->refelemlength)
- return (false);
+ return false;
if (a->refelembyval != b->refelembyval)
- return (false);
+ return false;
if (!equal(a->refupperindexpr, b->refupperindexpr))
- return (false);
+ return false;
if (!equal(a->reflowerindexpr, b->reflowerindexpr))
- return (false);
+ return false;
if (!equal(a->refexpr, b->refexpr))
- return (false);
- return (equal(a->refassgnexpr, b->refassgnexpr));
+ return false;
+ return equal(a->refassgnexpr, b->refassgnexpr);
}
/*
_equalOper(Oper *a, Oper *b)
{
if (a->opno != b->opno)
- return (false);
+ return false;
if (a->opresulttype != b->opresulttype)
- return (false);
+ return false;
- return (true);
+ return true;
}
/*
* ridiculous. -- JMH, 7/11/92
*/
if (a->consttype != b->consttype)
- return (false);
+ return false;
if (a->constlen != b->constlen)
- return (false);
+ return false;
if (a->constisnull != b->constisnull)
- return (false);
+ return false;
if (a->constbyval != b->constbyval)
- return (false);
+ return false;
return (datumIsEqual(a->constvalue, b->constvalue,
a->consttype, a->constbyval, a->constlen));
}
_equalParam(Param *a, Param *b)
{
if (a->paramkind != b->paramkind)
- return (false);
+ return false;
if (a->paramtype != b->paramtype)
- return (false);
+ return false;
if (!equal(a->param_tlist, b->param_tlist))
- return (false);
+ return false;
switch (a->paramkind)
{
case PARAM_NEW:
case PARAM_OLD:
if (strcmp(a->paramname, b->paramname) != 0)
- return (false);
+ return false;
break;
case PARAM_NUM:
case PARAM_EXEC:
if (a->paramid != b->paramid)
- return (false);
+ return false;
break;
case PARAM_INVALID:
/*
* XXX: Hmmm... What are we supposed to return in this case ??
*/
- return (true);
+ return true;
break;
default:
elog(ERROR, "_equalParam: Invalid paramkind value: %d",
a->paramkind);
}
- return (true);
+ return true;
}
/*
_equalFunc(Func *a, Func *b)
{
if (a->funcid != b->funcid)
- return (false);
+ return false;
if (a->functype != b->functype)
- return (false);
+ return false;
if (a->funcisindex != b->funcisindex)
- return (false);
+ return false;
if (a->funcsize != b->funcsize)
- return (false);
+ return false;
if (!equal(a->func_tlist, b->func_tlist))
- return (false);
+ return false;
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
-_equalCInfo(CInfo *a, CInfo *b)
+_equalClauseInfo(ClauseInfo *a, ClauseInfo *b)
{
- Assert(IsA(a, CInfo));
- Assert(IsA(b, CInfo));
+ Assert(IsA(a, ClauseInfo));
+ Assert(IsA(b, ClauseInfo));
if (!equal(a->clause, b->clause))
- return (false);
+ return false;
if (a->selectivity != b->selectivity)
- return (false);
+ return false;
if (a->notclause != b->notclause)
- return (false);
+ return false;
#ifdef EqualMergeOrderExists
if (!EqualMergeOrder(a->mergejoinorder, b->mergejoinorder))
- return (false);
+ return false;
#endif
if (a->hashjoinoperator != b->hashjoinoperator)
- return (false);
+ return false;
return (equal((a->indexids),
(b->indexids)));
}
if (!equal((a->jmkeys),
(b->jmkeys)))
- return (false);
+ return false;
if (!equal((a->clauses),
(b->clauses)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
_equalPath(Path *a, Path *b)
{
if (a->pathtype != b->pathtype)
- return (false);
+ return false;
if (a->parent != b->parent)
- return (false);
+ return false;
/*
* if (a->path_cost != b->path_cost) return(false);
{
if (!equal((a->p_ordering.ord.merge),
(b->p_ordering.ord.merge)))
- return (false);
+ return false;
}
if (!equal((a->keys),
(b->keys)))
- return (false);
+ return false;
/*
* if (a->outerjoincost != b->outerjoincost) return(false);
*/
if (!equali((a->joinid),
(b->joinid)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
_equalIndexPath(IndexPath *a, IndexPath *b)
{
if (!_equalPath((Path *) a, (Path *) b))
- return (false);
+ return false;
if (!equali((a->indexid), (b->indexid)))
- return (false);
+ return false;
if (!equal((a->indexqual), (b->indexqual)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
Assert(IsA_JoinPath(b));
if (!_equalPath((Path *) a, (Path *) b))
- return (false);
+ return false;
if (!equal((a->pathclauseinfo), (b->pathclauseinfo)))
- return (false);
+ return false;
if (!equal((a->outerjoinpath), (b->outerjoinpath)))
- return (false);
+ return false;
if (!equal((a->innerjoinpath), (b->innerjoinpath)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
Assert(IsA(b, MergePath));
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
- return (false);
+ return false;
if (!equal((a->path_mergeclauses), (b->path_mergeclauses)))
- return (false);
+ return false;
if (!equal((a->outersortkeys), (b->outersortkeys)))
- return (false);
+ return false;
if (!equal((a->innersortkeys), (b->innersortkeys)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
Assert(IsA(b, HashPath));
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
- return (false);
+ return false;
if (!equal((a->path_hashclauses), (b->path_hashclauses)))
- return (false);
+ return false;
if (!equal((a->outerhashkeys), (b->outerhashkeys)))
- return (false);
+ return false;
if (!equal((a->innerhashkeys), (b->innerhashkeys)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
Assert(IsA(b, JoinKey));
if (!equal((a->outer), (b->outer)))
- return (false);
+ return false;
if (!equal((a->inner), (b->inner)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
_equalMergeOrder(MergeOrder *a, MergeOrder *b)
{
if (a == (MergeOrder *) NULL && b == (MergeOrder *) NULL)
- return (true);
+ return true;
Assert(IsA(a, MergeOrder));
Assert(IsA(b, MergeOrder));
if (a->join_operator != b->join_operator)
- return (false);
+ return false;
if (a->left_operator != b->left_operator)
- return (false);
+ return false;
if (a->right_operator != b->right_operator)
- return (false);
+ return false;
if (a->left_type != b->left_type)
- return (false);
+ return false;
if (a->right_type != b->right_type)
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
Assert(IsA(b, HInfo));
if (a->hashop != b->hashop)
- return (false);
- return (true);
+ return false;
+ return true;
}
/* XXX This equality function is a quick hack, should be
*/
if (!equal((a->indxqual), (b->indxqual)))
- return (false);
+ return false;
if (a->scan.scanrelid != b->scan.scanrelid)
- return (false);
+ return false;
if (!equali((a->indxid), (b->indxid)))
- return (false);
- return (true);
+ return false;
+ return true;
}
static bool
_equalSubPlan(SubPlan *a, SubPlan *b)
{
if (a->plan_id != b->plan_id)
- return (false);
+ return false;
if (!equal((a->sublink->oper), (b->sublink->oper)))
- return (false);
+ return false;
- return (true);
+ return true;
}
static bool
-_equalJInfo(JInfo *a, JInfo *b)
+_equalJoinInfo(JoinInfo *a, JoinInfo *b)
{
- Assert(IsA(a, JInfo));
- Assert(IsA(b, JInfo));
+ Assert(IsA(a, JoinInfo));
+ Assert(IsA(b, JoinInfo));
if (!equal((a->otherrels), (b->otherrels)))
- return (false);
+ return false;
if (!equal((a->jinfoclauseinfo), (b->jinfoclauseinfo)))
- return (false);
+ return false;
if (a->mergejoinable != b->mergejoinable)
- return (false);
+ return false;
if (a->hashjoinable != b->hashjoinable)
- return (false);
- return (true);
+ return false;
+ return true;
}
/*
_equalEState(EState *a, EState *b)
{
if (a->es_direction != b->es_direction)
- return (false);
+ return false;
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)
- return (false);
+ return false;
- return (true);
+ return true;
}
static bool
_equalTargetEntry(TargetEntry *a, TargetEntry *b)
{
if (!equal(a->resdom, b->resdom))
- return (false);
+ return false;
if (!equal(a->fjoin, b->fjoin))
- return (false);
+ return false;
if (!equal(a->expr, b->expr))
- return (false);
+ return false;
- return (true);
+ return true;
}
_equalValue(Value *a, Value *b)
{
if (a->type != b->type)
- return (false);
+ return false;
switch (a->type)
{
case T_String:
return strcmp(a->val.str, b->val.str);
case T_Integer:
- return (a->val.ival == b->val.ival);
+ return a->val.ival == b->val.ival;
case T_Float:
- return (a->val.dval == b->val.dval);
+ return a->val.dval == b->val.dval;
default:
break;
}
- return (true);
+ return true;
}
/*
bool retval = false;
if (a == b)
- return (true);
+ return true;
/*
* note that a!=b, so only one of them can be NULL
*/
if (a == NULL || b == NULL)
- return (false);
+ return false;
/*
* are they the same type of nodes?
*/
if (nodeTag(a) != nodeTag(b))
- return (false);
+ return false;
switch (nodeTag(a))
{
case T_Func:
retval = _equalFunc(a, b);
break;
- case T_CInfo:
- retval = _equalCInfo(a, b);
+ case T_ClauseInfo:
+ retval = _equalClauseInfo(a, b);
break;
case T_RelOptInfo:
retval = _equalRelOptInfo(a, b);
case T_SubPlan:
retval = _equalSubPlan(a, b);
break;
- case T_JInfo:
- retval = _equalJInfo(a, b);
+ case T_JoinInfo:
+ retval = _equalJoinInfo(a, b);
break;
case T_EState:
retval = _equalEState(a, b);
List *l;
if (a == NULL && b == NULL)
- return (true);
+ return true;
if (length(a) != length(b))
- return (false);
+ return false;
foreach(l, la)
{
if (!equal(lfirst(l), lfirst(lb)))
- return (false);
+ return false;
lb = lnext(lb);
}
retval = true;
List *l;
if (a == NULL && b == NULL)
- return (true);
+ return true;
if (length(a) != length(b))
- return (false);
+ return false;
foreach(l, la)
{
if (lfirsti(l) != lfirsti(lb))
- return (false);
+ return false;
lb = lnext(lb);
}
return true;