Commit 6bd323c6 authored by Bruce Momjian's avatar Bruce Momjian

Remove un-needed braces around single statements.

parent 27db9ecd
......@@ -104,38 +104,26 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
{
result = (int) (*proc_fn) (p, value);
if (typlen > 0)
{
p += typlen;
}
else
{
p += INTALIGN(*(int32 *) p);
}
}
if (result)
{
if (!and)
{
return (1);
}
}
else
{
if (and)
{
return (0);
}
}
}
if (and && result)
{
return (1);
}
else
{
return (0);
}
}
/*
......
......@@ -97,13 +97,9 @@ hhmm_out(TimeADT *time)
tm->tm_sec = (((int) *time) % 60);
if (tm->tm_sec == 0)
{
sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min);
}
else
{
sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
}
result = palloc(strlen(buf) + 1);
......
......@@ -66,9 +66,7 @@ string_output(char *data, int size)
}
if (size < 0)
{
size = strlen(data);
}
/* adjust string length for escapes */
len = size;
......@@ -90,9 +88,7 @@ string_output(char *data, int size)
break;
default:
if (NOTPRINTABLE(*p))
{
len += 3;
}
}
}
len++;
......@@ -147,9 +143,7 @@ string_output(char *data, int size)
r += 3;
}
else
{
*r++ = c;
}
}
}
*r = '\0';
......@@ -192,9 +186,7 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
int len;
if ((str == NULL) || (hdrsize < 0))
{
return (char *) NULL;
}
/* Compute result size */
len = strlen(str);
......@@ -223,22 +215,16 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
/* result has variable length */
if (size == 0)
{
size = len + 1;
}
else
/* result has variable length with maximum size */
if (size < 0)
{
size = MIN(len, -size) + 1;
}
result = (char *) palloc(hdrsize + size);
memset(result, 0, hdrsize + size);
if (rtn_size)
{
*rtn_size = size;
}
r = result + hdrsize;
for (p = str; *p;)
......@@ -262,13 +248,9 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
case '7':
c = VALUE(c);
if (isdigit(*p))
{
c = (c << 3) + VALUE(*p++);
}
if (isdigit(*p))
{
c = (c << 3) + VALUE(*p++);
}
*r++ = c;
break;
case 'b':
......@@ -294,9 +276,7 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
}
}
else
{
*r++ = c;
}
}
return ((char *) result);
......@@ -380,9 +360,7 @@ c_textin(char *str)
int len;
if (str == NULL)
{
return ((struct varlena *) NULL);
}
result = (struct varlena *) string_input(str, 0, VARHDRSZ, &len);
VARSIZE(result) = len;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.37 1998/02/26 04:29:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.38 1998/06/15 19:27:44 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
......@@ -143,9 +143,7 @@ DataFill(char *data,
if (bit != NULL)
{
if (bitmask != CSIGNBIT)
{
bitmask <<= 1;
}
else
{
bitP += 1;
......@@ -167,13 +165,9 @@ DataFill(char *data,
case -1:
*infomask |= HEAP_HASVARLENA;
if (att[i]->attalign == 'd')
{
data = (char *) DOUBLEALIGN(data);
}
else
{
data = (char *) INTALIGN(data);
}
data_length = VARSIZE(DatumGetPointer(value[i]));
memmove(data, DatumGetPointer(value[i]), data_length);
data += data_length;
......@@ -239,9 +233,7 @@ heap_attisnull(HeapTuple tup, int attnum)
return (0);
if (attnum > 0)
{
return (att_isnull(attnum - 1, tup->t_bits));
}
else
switch (attnum)
{
......@@ -513,9 +505,7 @@ nocachegetattr(HeapTuple tup,
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
{
return ((Datum) fetchatt(&(att[0]), (char *) tp));
}
else if (!HeapTupleAllFixed(tup))
{
int j = 0;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.28 1998/02/26 04:29:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.29 1998/06/15 19:27:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -178,9 +178,7 @@ nocache_index_getattr(IndexTuple tup,
/* first attribute is always at position zero */
if (attnum == 1)
{
return (Datum) fetchatt(&(att[0]), (char *) tup + data_off);
}
if (att[attnum]->attcacheoff != -1)
{
return (Datum) fetchatt(&(att[attnum]),
......@@ -260,9 +258,7 @@ nocache_index_getattr(IndexTuple tup,
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
{
return ((Datum) fetchatt(&(att[0]), (char *) tp));
}
else if (!IndexTupleAllFixed(tup))
{
int j = 0;
......@@ -482,9 +478,7 @@ CopyIndexTuple(IndexTuple source, IndexTuple *target)
size = IndexTupleSize(source);
if (*target == NULL)
{
*target = (IndexTuple) palloc(size);
}
ret = *target;
memmove((char *) ret, (char *) source, size);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.18 1998/01/31 05:54:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.19 1998/06/15 19:27:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -61,9 +61,7 @@ index_keytest(IndexTuple tuple,
}
if (key[0].sk_flags & SK_ISNULL)
{
return (false);
}
if (key[0].sk_flags & SK_COMMUTE)
{
......@@ -79,9 +77,7 @@ index_keytest(IndexTuple tuple,
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
{
return (false);
}
scanKeySize -= 1;
key++;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.39 1998/04/26 04:05:02 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.40 1998/06/15 19:27:45 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
......@@ -508,9 +508,7 @@ BuildDescForRelation(List *schema, char *relname)
* ----------------
*/
if (!strcmp(typename, relname))
{
TupleDescMakeSelfReference(desc, attnum, relname);
}
else
elog(ERROR, "DefineRelation: no such type %s",
typename);
......
......@@ -632,9 +632,7 @@ gistAdjustKeys(Relation r,
pfree(datum);
}
else
{
ReleaseBuffer(b);
}
pfree(evec);
}
......@@ -834,9 +832,7 @@ gistSplit(Relation r,
}
if ((bufblock = BufferGetBlockNumber(buffer)) != GISTP_ROOT)
{
PageRestoreTempPage(left, p);
}
WriteBuffer(leftbuf);
WriteBuffer(rightbuf);
......
......@@ -52,13 +52,9 @@ gistgettuple(IndexScanDesc s, ScanDirection dir)
/* 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);
}
......@@ -103,13 +99,9 @@ gistfirst(IndexScanDesc s, ScanDirection dir)
maxoff = PageGetMaxOffsetNumber(p);
if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->gs_child);
}
else
{
n = OffsetNumberNext(stk->gs_child);
}
so->s_stack = stk->gs_parent;
pfree(stk);
......@@ -163,13 +155,9 @@ gistnext(IndexScanDesc s, ScanDirection dir)
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
if (ScanDirectionIsForward(dir))
{
n = OffsetNumberNext(n);
}
else
{
n = OffsetNumberPrev(n);
}
b = ReadBuffer(s->relation, blk);
p = BufferGetPage(b);
......@@ -195,13 +183,9 @@ gistnext(IndexScanDesc s, ScanDirection dir)
po = (GISTPageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->gs_child);
}
else
{
n = OffsetNumberNext(stk->gs_child);
}
so->s_stack = stk->gs_parent;
pfree(stk);
......@@ -235,13 +219,9 @@ gistnext(IndexScanDesc s, ScanDirection dir)
po = (GISTPageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
{
n = PageGetMaxOffsetNumber(p);
}
else
{
n = FirstOffsetNumber;
}
}
}
}
......@@ -296,9 +276,7 @@ gistindex_keytest(IndexTuple tuple,
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
{
return (false);
}
scanKeySize -= 1;
key++;
......@@ -343,13 +321,9 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
break;
if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(n);
}
else
{
n = OffsetNumberNext(n);
}
}
return (n);
......@@ -405,9 +379,7 @@ gistheapptr(Relation r, ItemPointer itemp)
ReleaseBuffer(b);
}
else
{
ItemPointerSetInvalid(ip);
}
return (ip);
}
......@@ -102,17 +102,11 @@ gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
* Set flags.
*/
if (RelationGetNumberOfBlocks(s->relation) == 0)
{
s->flags = ScanUnmarked;
}
else if (fromEnd)
{
s->flags = ScanUnmarked | ScanUncheckedPrevious;
}
else
{
s->flags = ScanUnmarked | ScanUncheckedNext;
}
s->scanFromEnd = fromEnd;
......@@ -276,9 +270,7 @@ gistdropscan(IndexScanDesc s)
for (l = GISTScans;
l != (GISTScanList) NULL && l->gsl_scan != s;
l = l->gsl_next)
{
prev = l;
}
if (l == (GISTScanList) NULL)
elog(ERROR, "GiST scan list corrupted -- cannot find 0x%lx", s);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.12 1998/01/07 21:00:56 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.13 1998/06/15 19:27:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -204,9 +204,7 @@ _hash_insertonpg(Relation rel,
if (do_expand ||
(metap->hashm_nkeys / (metap->hashm_maxbucket + 1))
> metap->hashm_ffactor)
{
_hash_expandtable(rel, metabuf);
}
_hash_relbuf(rel, metabuf, HASH_READ);
return (res);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.15 1998/01/07 21:01:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.16 1998/06/15 19:27:49 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
......@@ -64,9 +64,7 @@ _hash_addovflpage(Relation rel, Buffer *metabufp, Buffer buf)
/* allocate an empty overflow page */
oaddr = _hash_getovfladdr(rel, metabufp);
if (oaddr == InvalidOvflAddress)
{
elog(ERROR, "_hash_addovflpage: problem with _hash_getovfladdr.");
}
ovflblkno = OADDR_TO_BLKNO(OADDR_OF(SPLITNUM(oaddr), OPAGENUM(oaddr)));
Assert(BlockNumberIsValid(ovflblkno));
ovflbuf = _hash_getbuf(rel, ovflblkno, HASH_WRITE);
......@@ -171,9 +169,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
if (offset > SPLITMASK)
{
if (++splitnum >= NCACHED)
{
elog(ERROR, OVMSG);
}
metap->OVFL_POINT = splitnum;
metap->SPARES[splitnum] = metap->SPARES[splitnum - 1];
metap->SPARES[splitnum - 1]--;
......@@ -189,9 +185,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
free_page++;
if (free_page >= NCACHED)
{
elog(ERROR, OVMSG);
}
/*
* This is tricky. The 1 indicates that you want the new page
......@@ -205,17 +199,13 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
*/
if (_hash_initbitmap(rel, metap, OADDR_OF(splitnum, offset),
1, free_page))
{
elog(ERROR, "overflow_page: problem with _hash_initbitmap.");
}
metap->SPARES[splitnum]++;
offset++;
if (offset > SPLITMASK)
{
if (++splitnum >= NCACHED)
{
elog(ERROR, OVMSG);
}
metap->OVFL_POINT = splitnum;
metap->SPARES[splitnum] = metap->SPARES[splitnum - 1];
metap->SPARES[splitnum - 1]--;
......@@ -252,18 +242,14 @@ found:
bit = 1 + bit + (i * BMPGSZ_BIT(metap));
if (bit >= metap->LAST_FREED)
{
metap->LAST_FREED = bit - 1;
}
/* Calculate the split number for this page */
for (i = 0; (i < splitnum) && (bit > metap->SPARES[i]); i++)
;
offset = (i ? bit - metap->SPARES[i - 1] : bit);
if (offset >= SPLITMASK)
{
elog(ERROR, OVMSG);
}
/* initialize this page */
oaddr = OADDR_OF(i, offset);
......@@ -381,9 +367,7 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
(splitnum ? metap->SPARES[splitnum - 1] : 0) + (addr & SPLITMASK) - 1;
if (ovflpgno < metap->LAST_FREED)
{
metap->LAST_FREED = ovflpgno;
}
bitmappage = (ovflpgno >> (metap->BSHIFT + BYTE_TO_BIT));
bitmapbit = ovflpgno & (BMPGSZ_BIT(metap) - 1);
......@@ -403,13 +387,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
* return that buffer with a write lock.
*/
if (BlockNumberIsValid(nextblkno))
{
return (_hash_getbuf(rel, nextblkno, HASH_WRITE));
}
else
{
return (InvalidBuffer);
}
}
......@@ -543,9 +523,7 @@ _hash_squeezebucket(Relation rel,
{
rblkno = ropaque->hasho_nextblkno;
if (ropaque != wopaque)
{
_hash_relbuf(rel, rbuf, HASH_WRITE);
}
rbuf = _hash_getbuf(rel, rblkno, HASH_WRITE);
rpage = BufferGetPage(rbuf);
_hash_checkpage(rpage, LH_OVERFLOW_PAGE);
......@@ -621,9 +599,7 @@ _hash_squeezebucket(Relation rel,
*/
rbuf = _hash_freeovflpage(rel, rbuf);
if (BufferIsValid(rbuf))
{
_hash_relbuf(rel, rbuf, HASH_WRITE);
}
if (rblkno == wblkno)
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.15 1998/01/07 21:01:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.16 1998/06/15 19:27:49 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
......@@ -106,9 +106,7 @@ _hash_metapinit(Relation rel)
if ((1 << i) < (metap->hashm_bsize -
(DOUBLEALIGN(sizeof(PageHeaderData)) +
DOUBLEALIGN(sizeof(HashPageOpaqueData)))))
{
break;
}
}
Assert(i);
metap->hashm_bmsize = 1 << i;
......@@ -191,9 +189,7 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
Buffer buf;
if (blkno == P_NEW)
{
elog(ERROR, "_hash_getbuf: internal error: hash AM does not use P_NEW");
}
switch (access)
{
case HASH_WRITE:
......@@ -395,14 +391,10 @@ _hash_pagedel(Relation rel, ItemPointer tid)
{
buf = _hash_freeovflpage(rel, buf);
if (BufferIsValid(buf))
{
_hash_relbuf(rel, buf, HASH_WRITE);
}
}
else
{
_hash_relbuf(rel, buf, HASH_WRITE);
}
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_WRITE);
metap = (HashMetaPage) BufferGetPage(metabuf);
......@@ -545,9 +537,7 @@ _hash_splitpage(Relation rel,
opage = BufferGetPage(obuf);
_hash_checkpage(opage, LH_OVERFLOW_PAGE);
if (PageIsEmpty(opage))
{
elog(ERROR, "_hash_splitpage: empty overflow page %d", oblkno);
}
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.13 1998/01/07 21:01:13 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.14 1998/06/15 19:27:50 momjian Exp $
*
* NOTES
* Because we can be doing an index scan on a relation while we
......@@ -71,9 +71,7 @@ _hash_dropscan(IndexScanDesc scan)
for (chk = HashScans;
chk != (HashScanList) NULL && chk->hashsl_scan != scan;
chk = chk->hashsl_next)
{
last = chk;
}
if (chk == (HashScanList) NULL)
elog(ERROR, "hash scan list trashed; can't find 0x%lx", scan);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.14 1997/09/08 21:40:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.15 1998/06/15 19:27:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -49,9 +49,7 @@ _hash_search(Relation rel,
bucket = 0;
}
else
{
bucket = _hash_call(rel, metap, keyDatum);
}
blkno = BUCKET_TO_BLKNO(bucket);
......@@ -109,9 +107,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
* next tuple, we come back with a lock on that buffer.
*/
if (!_hash_step(scan, &buf, dir, metabuf))
{
return ((RetrieveIndexResult) NULL);
}
/* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData);
......@@ -225,9 +221,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
if (PageIsEmpty(page))
{
if (BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque);
}
else
{
ItemPointerSetInvalid(current);
......@@ -249,15 +243,11 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
if (ScanDirectionIsBackward(dir))
{
while (BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque);
}
}
if (!_hash_step(scan, &buf, dir, metabuf))
{
return ((RetrieveIndexResult) NULL);
}
/* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData);
......@@ -321,13 +311,9 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
*/
maxoff = PageGetMaxOffsetNumber(page);
if (ItemPointerIsValid(current))
{
offnum = ItemPointerGetOffsetNumber(current);
}
else
{
offnum = InvalidOffsetNumber;
}
/*
* 'offnum' now points to the last tuple we have seen (if any).
......@@ -371,9 +357,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
Assert(opaque->hasho_bucket == bucket);
while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque);
}
maxoff = PageGetMaxOffsetNumber(page);
offnum = FirstOffsetNumber;
}
......@@ -420,9 +404,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
Assert(opaque->hasho_bucket == bucket);
while (BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque);
}
maxoff = offnum = PageGetMaxOffsetNumber(page);
}
else
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.27 1998/02/26 04:29:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.28 1998/06/15 19:27:51 momjian Exp $
*
*
* INTERFACE ROUTINES
......@@ -168,9 +168,7 @@ static void
unpinsdesc(HeapScanDesc sdesc)
{
if (BufferIsValid(sdesc->rs_pbuf))
{
ReleaseBuffer(sdesc->rs_pbuf);
}
/* ------------------------------------
* Scan will pin buffer one for each non-NULL tuple pointer
......@@ -179,14 +177,10 @@ unpinsdesc(HeapScanDesc sdesc)
* ------------------------------------
*/
if (BufferIsValid(sdesc->rs_cbuf))
{
ReleaseBuffer(sdesc->rs_cbuf);
}
if (BufferIsValid(sdesc->rs_nbuf))
{
ReleaseBuffer(sdesc->rs_nbuf);
}
}
/* ------------------------------------------
......@@ -262,9 +256,7 @@ heapgettup(Relation relation,
#endif /* !defined(HEAPDEBUGALL) */
if (!ItemPointerIsValid(tid))
{
Assert(!PointerIsValid(tid));
}
/* ----------------
* return null immediately if relation is empty
......@@ -313,9 +305,7 @@ heapgettup(Relation relation,
* ----------------
*/
if (ItemPointerIsValid(tid) == false)
{
tid = NULL;
}
if (tid == NULL)
{
page = pages - 1; /* final page */
......@@ -333,9 +323,7 @@ heapgettup(Relation relation,
*b = RelationGetBufferWithBuffer(relation, page, *b);
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
{
elog(ERROR, "heapgettup: failed ReadBuffer");
}
#endif
dp = (Page) BufferGetPage(*b);
......@@ -380,9 +368,7 @@ heapgettup(Relation relation,
*b = RelationGetBufferWithBuffer(relation, page, *b);
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
{
elog(ERROR, "heapgettup: failed ReadBuffer");
}
#endif
dp = (Page) BufferGetPage(*b);
......@@ -398,13 +384,9 @@ heapgettup(Relation relation,
*/
lpp = PageGetItemId(dp, lineoff);
if (dir < 0)
{
linesleft = lineoff - 1;
}
else
{
linesleft = lines - lineoff;
}
/* ----------------
* advance the scan until we find a qualifying tuple or
......@@ -476,21 +458,15 @@ heapgettup(Relation relation,
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
{
elog(ERROR, "heapgettup: failed ReadBuffer");
}
#endif
dp = (Page) BufferGetPage(*b);
lines = lineoff = PageGetMaxOffsetNumber((Page) dp);
linesleft = lines - 1;
if (dir < 0)
{
lpp = PageGetItemId(dp, lineoff);
}
else
{
lpp = PageGetItemId(dp, FirstOffsetNumber);
}
}
}
......@@ -544,9 +520,7 @@ heap_open(Oid relationId)
r = (Relation) RelationIdGetRelation(relationId);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
{
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
}
return (r);
}
......@@ -573,9 +547,7 @@ heap_openr(char *relationName)
r = RelationNameGetRelation(relationName);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
{
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
}
return (r);
}
......@@ -1094,9 +1066,7 @@ heap_fetch(Relation relation,
*/
if (PointerIsValid(b))
{
*b = buffer;
}
else
{
tuple = heap_copytuple(tuple);
......@@ -1402,9 +1372,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
* ----------------
*/
if ((unsigned) DOUBLEALIGN(tup->t_len) <= PageGetFreeSpace((Page) dp))
{
RelationPutHeapTuple(relation, BufferGetBlockNumber(buffer), tup);
}
else
{
/* ----------------
......@@ -1500,29 +1468,17 @@ heap_markpos(HeapScanDesc sdesc)
* ----------------
*/
if (sdesc->rs_ptup != NULL)
{
sdesc->rs_mptid = sdesc->rs_ptup->t_ctid;
}
else
{
ItemPointerSetInvalid(&sdesc->rs_mptid);
}
if (sdesc->rs_ctup != NULL)
{
sdesc->rs_mctid = sdesc->rs_ctup->t_ctid;
}
else
{
ItemPointerSetInvalid(&sdesc->rs_mctid);
}
if (sdesc->rs_ntup != NULL)
{
sdesc->rs_mntid = sdesc->rs_ntup->t_ctid;
}
else
{
ItemPointerSetInvalid(&sdesc->rs_mntid);
}
}
/* ----------------
......@@ -1568,9 +1524,7 @@ heap_restrpos(HeapScanDesc sdesc)
sdesc->rs_nbuf = InvalidBuffer;
if (!ItemPointerIsValid(&sdesc->rs_mptid))
{
sdesc->rs_ptup = NULL;
}
else
{
sdesc->rs_ptup = (HeapTuple)
......@@ -1584,9 +1538,7 @@ heap_restrpos(HeapScanDesc sdesc)
}
if (!ItemPointerIsValid(&sdesc->rs_mctid))
{
sdesc->rs_ctup = NULL;
}
else
{
sdesc->rs_ctup = (HeapTuple)
......@@ -1600,9 +1552,7 @@ heap_restrpos(HeapScanDesc sdesc)
}
if (!ItemPointerIsValid(&sdesc->rs_mntid))
{
sdesc->rs_ntup = NULL;
}
else
{
sdesc->rs_ntup = (HeapTuple)
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.11 1998/01/07 21:01:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.12 1998/06/15 19:27:53 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
......@@ -117,13 +117,9 @@ RelationGetIndexScan(Relation relation,
ItemPointerSetInvalid(&scan->nextMarkData);
if (numberOfKeys > 0)
{
scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * numberOfKeys);
}
else
{
scan->keyData = NULL;
}
index_rescan(scan, scanFromEnd, key);
......@@ -224,13 +220,9 @@ IndexScanMarkPosition(IndexScanDesc scan)
index_getnext(scan, BackwardScanDirection);
if (result != NULL)
{
scan->previousItemData = result->index_iptr;
}
else
{
ItemPointerSetInvalid(&scan->previousItemData);
}
}
else if (scan->flags & ScanUncheckedNext)
......@@ -239,13 +231,9 @@ IndexScanMarkPosition(IndexScanDesc scan)
index_getnext(scan, ForwardScanDirection);
if (result != NULL)
{
scan->nextItemData = result->index_iptr;
}
else
{
ItemPointerSetInvalid(&scan->nextItemData);
}
}
scan->previousMarkData = scan->previousItemData;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.19 1998/04/27 04:04:09 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.20 1998/06/15 19:27:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -309,9 +309,7 @@ RelationGetStrategy(Relation relation,
for (index = 0; index < evaluation->maxStrategy; index += 1)
{
if (strategyMap->entry[index].sk_procedure == procedure)
{
break;
}
}
if (index == evaluation->maxStrategy)
......@@ -347,9 +345,7 @@ RelationGetStrategy(Relation relation,
if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy))
{
if (!StrategyNumberIsValid(strategy))
{
elog(ERROR, "RelationGetStrategy: corrupted evaluation");
}
}
return strategy;
......@@ -465,9 +461,7 @@ RelationInvokeStrategy(Relation relation,
(*termP)->operatorData[index].strategy);
if (!RegProcedureIsValid(entry->sk_procedure))
{
break;
}
}
if (index == (*termP)->degree)
......@@ -582,9 +576,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
if (!OidIsValid(iform->indkey[attributeIndex]))
{
if (attributeIndex == 0)
{
elog(ERROR, "IndexSupportInitialize: no pg_index tuple");
}
break;
}
......@@ -621,9 +613,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)];
for (support = maxSupportNumber; --support >= 0;)
{
loc[support] = InvalidOid;
}
entry[1].sk_argument =
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.25 1998/01/15 19:42:10 pgsql Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.26 1998/06/15 19:27:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -127,9 +127,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
}
/* get next offnum */
if (offset < maxoff)
{
offset = OffsetNumberNext(offset);
}
else
{ /* move right ? */
if (P_RIGHTMOST(opaque))
......@@ -906,13 +904,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
*/
if (P_RIGHTMOST(ropaque))
{
itemid = PageGetItemId(rightpage, P_HIKEY);
}
else
{
itemid = PageGetItemId(rightpage, P_FIRSTKEY);
}
itemsz = ItemIdGetLength(itemid);
item = (BTItem) PageGetItem(rightpage, itemid);
......@@ -1178,9 +1172,7 @@ _bt_pgaddtup(Relation rel,
first = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (afteritem == (BTItem) NULL)
{
itup_off = _bt_binsrch(rel, buf, keysz, itup_scankey, BT_INSERTION);
}
else
{
itup_off = first;
......@@ -1358,9 +1350,7 @@ _bt_itemcmp(Relation rel,
compare = (strat == BTLessStrategyNumber) ? true : false;
}
else
{
compare = _bt_invokestrat(rel, i, strat, attrDatum1, attrDatum2);
}
if (compare) /* true for one of ">, <, =" */
{
......@@ -1430,9 +1420,7 @@ _bt_updateitem(Relation rel,
/* this should never happen (in theory) */
if (!BTItemSame(item, oldItem))
{
elog(FATAL, "_bt_getstackbuf was lying!!");
}
/*
* It's defined by caller (_bt_insertonpg)
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.25 1998/02/26 04:29:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.26 1998/06/15 19:27:56 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
......@@ -267,20 +267,14 @@ btbuild(Relation heap,
* into the btree.
*/
if (usefast)
{
_bt_spool(index, btitem, spool);
}
else
{
res = _bt_doinsert(index, btitem, isunique, heap);
}
pfree(btitem);
pfree(itup);
if (res)
{
pfree(res);
}
}
/* okay, all heap tuples are indexed */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.13 1998/02/28 13:53:18 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.14 1998/06/15 19:27:57 momjian Exp $
*
*
* NOTES
......@@ -72,9 +72,7 @@ _bt_dropscan(IndexScanDesc scan)
for (chk = BTScans;
chk != (BTScanList) NULL && chk->btsl_scan != scan;
chk = chk->btsl_next)
{
last = chk;
}
if (chk == (BTScanList) NULL)
elog(ERROR, "btree scan list trashed; can't find 0x%lx", scan);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.35 1998/05/13 03:44:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.36 1998/06/15 19:27:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -541,9 +541,7 @@ _bt_firsteq(Relation rel,
while (offnum > limit
&& _bt_compare(rel, itupdesc, page,
keysz, scankey, OffsetNumberPrev(offnum)) == 0)
{
offnum = OffsetNumberPrev(offnum);
}
return (offnum);
}
......@@ -616,9 +614,7 @@ _bt_compare(Relation rel,
* - see new comments above...
*/
if (!P_RIGHTMOST(opaque))
{
elog(ERROR, "_bt_compare: invalid comparison to high key");
}
#if 0
......@@ -634,9 +630,7 @@ _bt_compare(Relation rel,
if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber))
{
return (0);
}
return (1);
#endif
}
......@@ -676,9 +670,7 @@ _bt_compare(Relation rel,
tmpres = (long) -1; /* NOT_NULL "<" NULL */
}
else
{
tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
}
result = tmpres;
/* if the keys are unequal, return the difference */
......@@ -1090,9 +1082,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (ScanDirectionIsForward(dir))
{
if (!PageIsEmpty(page) && offnum < maxoff)
{
offnum = OffsetNumberNext(offnum);
}
else
{
......@@ -1119,9 +1109,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (!PageIsEmpty(page) && start <= maxoff)
{
break;
}
else
{
blkno = opaque->btpo_next;
......@@ -1145,9 +1133,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (offnum > start)
{
offnum = OffsetNumberPrev(offnum);
}
else
{
......@@ -1196,9 +1182,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
/* anything to look at here? */
if (!PageIsEmpty(page) && maxoff >= start)
{
break;
}
else
{
blkno = opaque->btpo_prev;
......@@ -1278,13 +1262,9 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
/* if we've hit end of scan we don't have to do any work */
if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
{
return (false);
}
else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque))
{
return (false);
}
/*
* Okay, it's off the page; let _bt_step() do the hard work, and we'll
......@@ -1371,13 +1351,9 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
break;
if (ScanDirectionIsForward(dir))
{
offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
}
else
{
offnum = PageGetMaxOffsetNumber(page);
}
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &(btitem->bti_itup);
......@@ -1461,9 +1437,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
}
/* new stuff ends here */
else
{
ItemPointerSet(current, blkno, start);
}
}
else if (ScanDirectionIsBackward(dir))
{
......@@ -1510,9 +1484,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
}
}
else
{
elog(ERROR, "Illegal scan direction %d", dir);
}
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, start));
itup = &(btitem->bti_itup);
......
......@@ -5,7 +5,7 @@
*
*
* IDENTIFICATION
* $Id: nbtsort.c,v 1.29 1998/02/26 04:29:54 momjian Exp $
* $Id: nbtsort.c,v 1.30 1998/06/15 19:27:59 momjian Exp $
*
* NOTES
*
......@@ -288,9 +288,7 @@ _bt_pqsift(BTPriQueue *q, int parent)
if (child < q->btpq_nelem - 1)
{
if (GREATER(&(q->btpq_queue[child]), &(q->btpq_queue[child + 1])))
{
++child;
}
}
if (GREATER(&(q->btpq_queue[parent]), &(q->btpq_queue[child])))
{
......@@ -300,9 +298,7 @@ _bt_pqsift(BTPriQueue *q, int parent)
parent = child;
}
else
{
parent = child + 1;
}
}
}
......@@ -331,18 +327,14 @@ _bt_pqadd(BTPriQueue *q, BTPriQueueElem *e)
parent;
if (q->btpq_nelem >= MAXELEM)
{
elog(ERROR, "_bt_pqadd: queue overflow");
}
child = q->btpq_nelem++;
while (child > 0)
{
parent = child / 2;
if (GREATER(e, &(q->btpq_queue[parent])))
{
break;
}
else
{
q->btpq_queue[child] = q->btpq_queue[parent]; /* struct = */
......@@ -424,9 +416,7 @@ _bt_tapecreate(char *fname)
BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
if (tape == (BTTapeBlock *) NULL)
{
elog(ERROR, "_bt_tapecreate: out of memory");
}
tape->bttb_magic = BTTAPEMAGIC;
......@@ -516,9 +506,7 @@ _bt_tapenext(BTTapeBlock *tape, char **pos)
BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
{
return ((BTItem) NULL);
}
bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz);
......@@ -561,9 +549,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
if (btspool == (BTSpool *) NULL || fname == (char *) NULL)
{
elog(ERROR, "_bt_spoolinit: out of memory");
}
MemSet((char *) btspool, 0, sizeof(BTSpool));
btspool->bts_ntapes = ntapes;
btspool->bts_tape = 0;
......@@ -575,9 +561,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
if (btspool->bts_itape == (BTTapeBlock **) NULL ||
btspool->bts_otape == (BTTapeBlock **) NULL)
{
elog(ERROR, "_bt_spoolinit: out of memory");
}
for (i = 0; i < ntapes; ++i)
{
......@@ -621,9 +605,7 @@ _bt_spoolflush(BTSpool *btspool)
for (i = 0; i < btspool->bts_ntapes; ++i)
{
if (!EMPTYTAPE(btspool->bts_otape[i]))
{
_bt_tapewrite(btspool->bts_otape[i], 1);
}
}
}
......@@ -716,9 +698,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
(BTSortKey *) palloc(it_ntup * sizeof(BTSortKey));
pos = itape->bttb_data;
for (i = 0; i < it_ntup; ++i)
{
_bt_setsortkey(index, _bt_tapenext(itape, &pos), &(parray[i]));
}
/*
* qsort the pointer array.
......@@ -790,9 +770,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
/* insert this item into the current buffer */
if (btitem != (BTItem) NULL)
{
_bt_tapeadd(itape, btitem, itemsz);
}
}
/*
......@@ -1008,9 +986,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
* shuffling).
*/
for (o = last_off; o > first_off; o = OffsetNumberPrev(o))
{
PageIndexTupleDelete(opage, o);
}
hii = PageGetItemId(opage, P_HIKEY);
ii = PageGetItemId(opage, first_off);
*hii = *ii;
......@@ -1085,14 +1061,10 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
#endif
if (last_bti == (BTItem) NULL)
{
first_off = P_FIRSTKEY;
}
else if (!_bt_itemcmp(index, _bt_nattr,
bti, last_bti, BTEqualStrategyNumber))
{
first_off = off;
}
last_off = off;
last_bti = (BTItem) PageGetItem(npage, PageGetItemId(npage, off));
......@@ -1226,9 +1198,7 @@ _bt_merge(Relation index, BTSpool *btspool)
do
{
if (_bt_taperead(itape) == 0)
{
tapedone[t] = 1;
}
} while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t])
{
......@@ -1237,9 +1207,7 @@ _bt_merge(Relation index, BTSpool *btspool)
_bt_setsortkey(index, _bt_tapenext(itape, &tapepos[t]),
&(e.btpqe_item));
if (e.btpqe_item.btsk_item != (BTItem) NULL)
{
_bt_pqadd(&q, &e);
}
}
}
......@@ -1334,9 +1302,7 @@ _bt_merge(Relation index, BTSpool *btspool)
do
{
if (_bt_taperead(itape) == 0)
{
tapedone[t] = 1;
}
} while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t])
{
......@@ -1372,9 +1338,7 @@ _bt_merge(Relation index, BTSpool *btspool)
* pages instead of merging into a tape file.
*/
if (nruns <= btspool->bts_ntapes)
{
doleaf = true;
}
} while (nruns > 0); /* pass */
_bt_uppershutdown(index, state);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.19 1998/04/27 04:04:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.20 1998/06/15 19:27:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -157,9 +157,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
if (i == numberOfKeys || cur->sk_attno != attno)
{
if (cur->sk_attno != attno + 1 && i < numberOfKeys)
{
elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1);
}
/*
* If = has been specified, no other key will be used. In case
......@@ -373,9 +371,7 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
/* btree doesn't support 'A is null' clauses, yet */
if (isNull || key[0].sk_flags & SK_ISNULL)
{
return (false);
}
if (key[0].sk_flags & SK_COMMUTE)
{
......@@ -391,9 +387,7 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
{
return (false);
}
keysz -= 1;
key++;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.9 1997/09/08 02:21:03 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.10 1998/06/15 19:28:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -47,13 +47,9 @@ rtgettuple(IndexScanDesc s, ScanDirection dir)
/* 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);
}
......@@ -98,13 +94,9 @@ rtfirst(IndexScanDesc s, ScanDirection dir)
maxoff = PageGetMaxOffsetNumber(p);
if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->rts_child);
}
else
{
n = OffsetNumberNext(stk->rts_child);
}
so->s_stack = stk->rts_parent;
pfree(stk);
......@@ -158,13 +150,9 @@ rtnext(IndexScanDesc s, ScanDirection dir)
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
if (ScanDirectionIsForward(dir))
{
n = OffsetNumberNext(n);
}
else
{
n = OffsetNumberPrev(n);
}
b = ReadBuffer(s->relation, blk);
p = BufferGetPage(b);
......@@ -190,13 +178,9 @@ rtnext(IndexScanDesc s, ScanDirection dir)
po = (RTreePageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->rts_child);
}
else
{
n = OffsetNumberNext(stk->rts_child);
}
so->s_stack = stk->rts_parent;
pfree(stk);
......@@ -230,13 +214,9 @@ rtnext(IndexScanDesc s, ScanDirection dir)
po = (RTreePageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
{
n = PageGetMaxOffsetNumber(p);
}
else
{
n = FirstOffsetNumber;
}
}
}
}
......@@ -283,13 +263,9 @@ findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
}
if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(n);
}
else
{
n = OffsetNumberNext(n);
}
}
return (n);
......@@ -345,9 +321,7 @@ rtheapptr(Relation r, ItemPointer itemp)
ReleaseBuffer(b);
}
else
{
ItemPointerSetInvalid(ip);
}
return (ip);
}
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.23 1998/02/26 04:30:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.24 1998/06/15 19:28:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -450,9 +450,7 @@ rttighten(Relation r,
memmove(oldud, datum, VARSIZE(datum));
}
else
{
memmove(oldud, datum, att_size);
}
WriteBuffer(b);
/*
......@@ -467,9 +465,7 @@ rttighten(Relation r,
pfree(tdatum);
}
else
{
ReleaseBuffer(b);
}
pfree(datum);
}
......@@ -587,9 +583,7 @@ dosplit(Relation r,
}
if ((bufblock = BufferGetBlockNumber(buffer)) != P_ROOT)
{
PageRestoreTempPage(left, p);
}
WriteBuffer(leftbuf);
WriteBuffer(rightbuf);
......@@ -842,13 +836,9 @@ picksplit(Relation r,
/* okay, which page needs least enlargement? */
if (i == maxoff)
{
item_1 = itup;
}
else
{
item_1 = (IndexTuple) PageGetItem(page, PageGetItemId(page, i));
}
datum_alpha = ((char *) item_1) + sizeof(IndexTupleData);
union_dl = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_l, datum_alpha);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.15 1998/01/07 21:02:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.16 1998/06/15 19:28:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -104,17 +104,11 @@ rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
* Set flags.
*/
if (RelationGetNumberOfBlocks(s->relation) == 0)
{
s->flags = ScanUnmarked;
}
else if (fromEnd)
{
s->flags = ScanUnmarked | ScanUncheckedPrevious;
}
else
{
s->flags = ScanUnmarked | ScanUncheckedNext;
}
s->scanFromEnd = fromEnd;
......@@ -133,9 +127,7 @@ rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
p->s_stack = p->s_markstk = (RTSTACK *) NULL;
p->s_flags = 0x0;
for (i = 0; i < s->numberOfKeys; i++)
{
p->s_internalKey[i].sk_argument = s->keyData[i].sk_argument;
}
}
else
{
......@@ -279,9 +271,7 @@ rtdropscan(IndexScanDesc s)
for (l = RTScans;
l != (RTScanList) NULL && l->rtsl_scan != s;
l = l->rtsl_next)
{
prev = l;
}
if (l == (RTScanList) NULL)
elog(ERROR, "rtree scan list corrupted -- cannot find 0x%lx", s);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.19 1998/01/07 21:02:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.20 1998/06/15 19:28:02 momjian Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
......@@ -1450,9 +1450,7 @@ IsTransactionBlock()
if (s->blockState == TBLOCK_INPROGRESS
|| s->blockState == TBLOCK_ENDABORT)
{
return (true);
}
return (false);
}
......@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.42 1998/05/29 17:00:05 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.43 1998/06/15 19:28:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -349,13 +349,9 @@ BootstrapMain(int argc, char *argv[])
} /* while */
if (argc - optind > 1)
{
usage();
}
else if (argc - optind == 1)
{
dbName = argv[optind];
}
if (!DataDir)
{
......@@ -485,9 +481,7 @@ boot_openrel(char *relname)
}
if (reldesc != NULL)
{
closerel(NULL);
}
if (!Quiet)
printf("Amopen: relation %s. attrsize %d\n", relname ? relname : "(null)",
......@@ -499,9 +493,7 @@ boot_openrel(char *relname)
for (i = 0; i < numattr; i++)
{
if (attrtypes[i] == NULL)
{
attrtypes[i] = AllocateAttribute();
}
memmove((char *) attrtypes[i],
(char *) reldesc->rd_att->attrs[i],
ATTRIBUTE_TUPLE_SIZE);
......@@ -553,9 +545,7 @@ closerel(char *name)
}
if (reldesc == NULL)
{
elog(ERROR, "Warning: no opened relation to close.\n");
}
else
{
if (!Quiet)
......@@ -639,9 +629,7 @@ InsertOneTuple(Oid objectid)
pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
if (objectid != (Oid) 0)
{
tuple->t_oid = objectid;
}
heap_insert(reldesc, tuple);
pfree(tuple);
if (DebugMode)
......@@ -735,9 +723,7 @@ InsertOneNull(int i)
if (DebugMode)
printf("Inserting null\n");
if (i < 0 || i >= MAXATTR)
{
elog(FATAL, "i out of range (too many attrs): %d\n", i);
}
values[i] = (char *) NULL;
Blanks[i] = 'n';
}
......@@ -787,9 +773,7 @@ cleanup()
exitpg(1);
}
if (reldesc != (Relation) NULL)
{
heap_close(reldesc);
}
CommitTransactionCommand();
exitpg(Warnings);
}
......@@ -823,9 +807,7 @@ gettype(char *type)
for (i = 0; i <= n_types; i++)
{
if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0)
{
return (i);
}
}
if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type);
......@@ -869,9 +851,7 @@ AllocateAttribute()
(AttributeTupleForm) malloc(ATTRIBUTE_TUPLE_SIZE);
if (!PointerIsValid(attribute))
{
elog(FATAL, "AllocateAttribute: malloc failed");
}
MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE);
return (attribute);
......@@ -928,9 +908,7 @@ EnterString(char *str)
node = FindStr(str, len, 0);
if (node)
{
return (node->strnum);
}
else
{
node = AddStr(str, len, 0);
......@@ -997,9 +975,7 @@ FindStr(char *str, int length, hashnode *mderef)
return (node); /* no need to check */
}
else
{
node = node->next;
}
}
/* Couldn't find it in the list */
return (NULL);
......@@ -1056,9 +1032,7 @@ AddStr(char *str, int strlength, int mderef)
hashresult = CompHash(str, strlength);
if (hashtable[hashresult] == NULL)
{
hashtable[hashresult] = newnode;
}
else
{ /* There is something in the list */
trail = hashtable[hashresult];
......@@ -1135,9 +1109,7 @@ index_register(char *heap,
}
}
else
{
newind->il_params = (Datum *) NULL;
}
if (finfo != (FuncIndexInfo *) NULL)
{
......@@ -1145,9 +1117,7 @@ index_register(char *heap,
memmove(newind->il_finfo, finfo, sizeof(FuncIndexInfo));
}
else
{
newind->il_finfo = (FuncIndexInfo *) NULL;
}
if (predInfo != NULL)
{
......@@ -1156,9 +1126,7 @@ index_register(char *heap,
newind->il_predInfo->oldPred = predInfo->oldPred;
}
else
{
newind->il_predInfo = NULL;
}
newind->il_next = ILHead;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.10 1998/05/09 23:42:58 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.11 1998/06/15 19:28:06 momjian Exp $
*
* NOTES
* See acl.h.
......@@ -200,13 +200,9 @@ get_grosysid(char *groname)
htp = SearchSysCacheTuple(GRONAME, PointerGetDatum(groname),
0, 0, 0);
if (HeapTupleIsValid(htp))
{
id = ((Form_pg_group) GETSTRUCT(htp))->grosysid;
}
else
{
elog(ERROR, "non-existent group \"%s\"", groname);
}
return (id);
}
......@@ -219,13 +215,9 @@ get_groname(AclId grosysid)
htp = SearchSysCacheTuple(GROSYSID, PointerGetDatum(grosysid),
0, 0, 0);
if (HeapTupleIsValid(htp))
{
name = (((Form_pg_group) GETSTRUCT(htp))->groname).data;
}
else
{
elog(NOTICE, "get_groname: group %d not found", grosysid);
}
return (name);
}
......@@ -267,9 +259,7 @@ in_group(AclId uid, AclId gid)
}
}
else
{
elog(NOTICE, "in_group: group %d not found", gid);
}
heap_close(relation);
return (found);
}
......@@ -290,9 +280,7 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
/* if no acl is found, use world default */
if (!acl)
{
acl = acldefault(relname);
}
num = ACL_NUM(acl);
aidat = ACL_DAT(acl);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.50 1998/06/14 13:31:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.51 1998/06/15 19:28:07 momjian Exp $
*
* INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation
......@@ -291,9 +291,7 @@ heap_create(char *name,
rdesc->rd_rel->relchecks = tupDesc->constr->num_check;
for (i = 0; i < natts; i++)
{
rdesc->rd_att->attrs[i]->attrelid = relid;
}
rdesc->rd_id = relid;
......@@ -933,9 +931,7 @@ RelationRemoveInheritance(Relation relation)
{
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
break;
}
heap_delete(catalogRelation, &tuple->t_ctid);
}
......@@ -961,9 +957,7 @@ RelationRemoveInheritance(Relation relation)
{
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
break;
}
heap_delete(catalogRelation, &tuple->t_ctid);
}
......@@ -1000,9 +994,7 @@ RelationRemoveIndexes(Relation relation)
{
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
break;
}
index_destroy(((IndexTupleForm) GETSTRUCT(tuple))->indexrelid);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.42 1998/06/13 20:22:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.43 1998/06/15 19:28:09 momjian Exp $
*
*
* INTERFACE ROUTINES
......@@ -190,9 +190,7 @@ RelationNameGetObjectId(char *relationName,
pg_class_tuple = heap_getnext(pg_class_scan, 0, &buffer);
if (!HeapTupleIsValid(pg_class_tuple))
{
relationObjectId = InvalidOid;
}
else
{
relationObjectId = pg_class_tuple->t_oid;
......@@ -385,9 +383,7 @@ ConstructTupleDescriptor(Oid heapoid,
IndexKeyType = IndexKey->tname;
}
else
{
IndexKeyType = NULL;
}
indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
......@@ -805,9 +801,7 @@ UpdateIndexRelation(Oid indexoid,
pfree(predString);
}
else
{
predText = (text *) fmgr(F_TEXTIN, "");
}
predLen = VARSIZE(predText);
itupLen = predLen + sizeof(FormData_pg_index);
indexForm = (IndexTupleForm) palloc(itupLen);
......@@ -942,9 +936,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
pfree(predString);
}
else
{
predText = (text *) fmgr(F_TEXTIN, "");
}
/* open the index system catalog relation */
pg_index = heap_openr(IndexRelationName);
......@@ -1027,9 +1019,7 @@ InitIndexStrategy(int numatts,
strsize);
}
else
{
support = (RegProcedure *) NULL;
}
/* ----------------
* fill in the index strategy structure with information
......@@ -1269,9 +1259,7 @@ index_destroy(Oid indexId)
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
{
heap_delete(catalogRelation, &tuple->t_ctid);
}
heap_endscan(scan);
heap_close(catalogRelation);
......@@ -1410,9 +1398,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
*/
pg_class = heap_openr(RelationRelationName);
if (!RelationIsValid(pg_class))
{
elog(ERROR, "UpdateStats: could not open RELATION relation");
}
key[0].sk_argument = ObjectIdGetDatum(relid);
pg_class_scan =
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.17 1998/04/27 04:04:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.18 1998/06/15 19:28:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -80,9 +80,7 @@ CatalogOpenIndices(int nIndices, char *names[], Relation idescs[])
int i;
for (i = 0; i < nIndices; i++)
{
idescs[i] = index_openr(names[i]);
}
}
/*
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.17 1998/04/27 04:05:03 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.18 1998/06/15 19:28:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -94,9 +94,7 @@ ProcedureCreate(char *procedureName,
if (strcmp(strVal(t), "opaque") == 0)
{
if (strcmp(languageName, "sql") == 0)
{
elog(ERROR, "ProcedureDefine: sql functions cannot take type \"opaque\"");
}
toid = 0;
}
else
......@@ -162,9 +160,7 @@ ProcedureCreate(char *procedureName,
if (strcmp(returnTypeName, "opaque") == 0)
{
if (strcmp(languageName, "sql") == 0)
{
elog(ERROR, "ProcedureCreate: sql functions cannot return type \"opaque\"");
}
typeObjectId = 0;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.24 1998/05/09 23:43:00 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.25 1998/06/15 19:28:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -334,9 +334,7 @@ TypeCreate(char *typeName,
*/
typeObjectId = TypeGet(typeName, &defined);
if (OidIsValid(typeObjectId) && defined)
{
elog(ERROR, "TypeCreate: type %s already defined", typeName);
}
/* ----------------
* if this type has an associated elementType, then we check that
......@@ -347,9 +345,7 @@ TypeCreate(char *typeName,
{
elementObjectId = TypeGet(elementTypeName, &defined);
if (!defined)
{
elog(ERROR, "TypeCreate: type %s is not defined", elementTypeName);
}
}
/* ----------------
......@@ -437,9 +433,7 @@ TypeCreate(char *typeName,
0);
}
if (!HeapTupleIsValid(tup))
{
func_error("TypeCreate", procname, 1, argList, NULL);
}
}
values[i++] = (Datum) tup->t_oid; /* 11 - 14 */
......@@ -559,9 +553,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
/* check that that the new type is not already defined */
type_oid = TypeGet(newTypeName, &defined);
if (OidIsValid(type_oid) && defined)
{
elog(ERROR, "TypeRename: type %s already defined", newTypeName);
}
/* get the type tuple from the catalog index scan manager */
pg_type_desc = heap_openr(TypeRelationName);
......@@ -592,9 +584,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
}
else
{
elog(ERROR, "TypeRename: type %s not defined", oldTypeName);
}
/* finish up */
heap_close(pg_type_desc);
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.12 1998/06/04 17:26:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.13 1998/06/15 19:28:17 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
......@@ -207,9 +207,7 @@ setAttrList(char *bname)
attrname = (rdesc->rd_att->attrs[i]->attname).data;
if (notfirst == 1)
{
sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
}
else
{
sprintf(temp_buf, "%s = new.%s", attrname, attrname);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.32 1998/05/06 23:49:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.33 1998/06/15 19:28:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -312,9 +312,7 @@ Async_NotifyAtCommit()
if (kill(DatumGetInt32(d), SIGUSR2) < 0)
{
if (errno == ESRCH)
{
heap_delete(lRel, &lTuple->t_ctid);
}
}
#endif
}
......@@ -360,9 +358,7 @@ Async_NotifyAtAbort()
extern TransactionState CurrentTransactionState;
if (notifyIssued)
{
ClearPendingNotify();
}
notifyIssued = 0;
if (pendingNotifies)
DLFreeList(pendingNotifies);
......@@ -446,9 +442,7 @@ Async_Listen(char *relname, int pid)
d = heap_getattr(htup, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d);
if (pid == MyProcPid)
{
alreadyListener = 1;
}
}
ReleaseBuffer(b);
}
......@@ -517,9 +511,7 @@ Async_Unlisten(char *relname, int pid)
RelationSetLockForWrite(lDesc);
if (lTuple != NULL)
{
heap_delete(lDesc, &lTuple->t_ctid);
}
RelationUnsetLockForWrite(lDesc);
heap_close(lDesc);
......@@ -610,9 +602,7 @@ Async_NotifyFrontEnd()
pq_flush();
}
else
{
elog(NOTICE, "Async_NotifyFrontEnd: no asynchronous notification to frontend on interactive sessions");
}
ReleaseBuffer(b);
}
CommitTransactionCommand();
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.27 1998/04/27 04:05:10 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.28 1998/06/15 19:28:12 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
......@@ -475,9 +475,7 @@ PerformAddAttribute(char *relationName,
form = (TypeTupleForm) GETSTRUCT(typeTuple);
if (!HeapTupleIsValid(typeTuple))
{
elog(ERROR, "Add: type \"%s\" nonexistent", p);
}
namestrcpy(&(attribute->attname), (char *) key[1].sk_argument);
attribute->atttypid = typeTuple->t_oid;
......
......@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.45 1998/03/30 16:45:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.46 1998/06/15 19:28:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -284,9 +284,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
fputs("\\N", fp); /* null indicator */
if (i == attr_count - 1)
{
fputc('\n', fp);
}
else
{
......@@ -343,9 +341,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
heap_endscan(scandesc);
if (binary)
{
pfree(nulls);
}
else
{
pfree(out_functions);
......@@ -494,9 +490,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
}
}
else
{
indexPred[i] = NULL;
}
}
}
}
......@@ -576,9 +570,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
nulls[i] = 'n';
}
else if (string == NULL)
{
done = 1;
}
else
{
values[i] =
......@@ -592,25 +584,19 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
*/
if (!PointerIsValid(values[i]) &&
!(rel->rd_att->attrs[i]->attbyval))
{
elog(ERROR, "copy from line %d: Bad file format", lineno);
}
}
}
#ifdef COPY_PATCH
if (!done)
{
CopyReadNewline(fp, &newline);
}
#endif
}
else
{ /* binary */
fread(&len, sizeof(int32), 1, fp);
if (feof(fp))
{
done = 1;
}
else
{
if (oids)
......@@ -799,9 +785,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
pfree((void *) values[i]);
}
else if (nulls[i] == 'n')
{
nulls[i] = ' ';
}
}
pfree(tuple);
......@@ -959,9 +943,7 @@ GetIndexRelations(Oid main_relation_oid,
*index_rels = (Relation *) palloc(*n_indices * sizeof(Relation));
for (i = 0, scan = head; i < *n_indices; i++, scan = scan->next)
{
(*index_rels)[i] = index_open(scan->index_rel_oid);
}
for (i = 0, scan = head; i < *n_indices + 1; i++)
{
......@@ -1075,9 +1057,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
val = (val << 3) + VALUE(c);
c = getc(fp);
if (ISOCTAL(c))
{
val = (val << 3) + VALUE(c);
}
else
{
if (feof(fp))
......@@ -1128,9 +1108,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
{
#ifdef COPY_PATCH
if (c == '\n')
{
*newline = 1;
}
#endif
done = 1;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.29 1998/04/26 04:06:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.30 1998/06/15 19:28:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -256,9 +256,7 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
"MergeAttr: Can't inherit from non-existent superclass '%s'", name);
}
if (relation->rd_rel->relkind == 'S')
{
elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name);
}
tupleDesc = RelationGetTupleDescriptor(relation);
constr = tupleDesc->constr;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.14 1998/06/04 17:26:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.15 1998/06/15 19:28:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -68,9 +68,7 @@ createdb(char *dbname, char *dbpath)
sprintf(loc, "%s%c%s", dbpath, SEP_CHAR, dbname);
}
else
{
strcpy(loc, dbname);
}
lp = ExpandDatabasePath(loc);
......@@ -114,9 +112,7 @@ destroydb(char *dbname)
check_permissions("destroydb", dbpath, dbname, &db_id, &user_id);
if (!OidIsValid(db_id))
{
elog(FATAL, "impossible: pg_database instance with invalid OID.");
}
/* stop the vacuum daemon */
stop_vacuum(dbpath, dbname);
......@@ -224,15 +220,11 @@ check_permissions(char *command,
/* Make sure we are not mucking with the template database */
if (!strcmp(dbname, "template1"))
{
elog(ERROR, "%s cannot be executed on the template database.", command);
}
/* Check to make sure database is not the currently open database */
if (!strcmp(dbname, DatabaseName))
{
elog(ERROR, "%s cannot be executed on an open database", command);
}
/* Check to make sure database is owned by this user */
......@@ -272,9 +264,7 @@ check_permissions(char *command,
*(path + VARSIZE(dbtext) - VARHDRSZ) = '\0';
}
else
{
*dbIdP = InvalidOid;
}
heap_close(dbrel);
......@@ -322,9 +312,7 @@ stop_vacuum(char *dbpath, char *dbname)
dbname, SEP_CHAR, dbname);
}
else
{
sprintf(filename, "%s%c%s.vacuum", dbpath, SEP_CHAR, dbname);
}
if ((fp = AllocateFile(filename, "r")) != NULL)
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.20 1998/01/05 16:38:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.21 1998/06/15 19:28:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -94,9 +94,7 @@ DefineIndex(char *heapRelationName,
*/
numberOfAttributes = length(attributeList);
if (numberOfAttributes <= 0)
{
elog(ERROR, "DefineIndex: must specify at least one attribute");
}
/*
* compute heap relation id
......@@ -369,9 +367,7 @@ CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid)
List *item;
foreach(item, predList)
{
CheckPredExpr(lfirst(item), rangeTable, baseRelOid);
}
}
static void
......@@ -391,9 +387,7 @@ CheckPredExpr(Node *predicate, List *rangeTable, Oid baseRelOid)
elog(ERROR, "Unsupported partial-index predicate expression type");
foreach(clause, clauses)
{
CheckPredExpr(lfirst(clause), rangeTable, baseRelOid);
}
}
static void
......@@ -408,9 +402,7 @@ CheckPredClause(Expr *predicate, List *rangeTable, Oid baseRelOid)
if (!IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) ||
!IsA(pred_const, Const))
{
elog(ERROR, "Unsupported partial-index predicate clause type");
}
if (getrelid(pred_var->varno, rangeTable) != baseRelOid)
elog(ERROR,
......@@ -538,9 +530,7 @@ GetDefaultOpClass(Oid atttypid)
ObjectIdGetDatum(atttypid),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
{
return 0;
}
return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname));
}
......@@ -564,9 +554,7 @@ RemoveIndex(char *name)
0, 0, 0);
if (!HeapTupleIsValid(tuple))
{
elog(ERROR, "index \"%s\" nonexistent", name);
}
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
{
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.24 1998/02/26 04:30:57 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.25 1998/06/15 19:28:15 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
......@@ -130,9 +130,7 @@ compute_full_attributes(const List *parameters, int32 *byte_pct_p,
ParamString *param = (ParamString *) lfirst(pl);
if (strcasecmp(param->name, "iscachable") == 0)
{
*canCache_p = true;
}
else if (strcasecmp(param->name, "trusted") == 0)
{
......@@ -177,9 +175,7 @@ compute_full_attributes(const List *parameters, int32 *byte_pct_p,
}
}
else if (strcasecmp(param->name, "outin_ratio") == 0)
{
*outin_ratio_p = atoi(param->val);
}
}
}
......@@ -394,13 +390,9 @@ DefineOperator(char *oprName,
elog(ERROR, "setof type not implemented for leftarg");
if (nodeTag(defel->arg) == T_String)
{
typeName1 = defGetString(defel);
}
else
{
elog(ERROR, "type for leftarg is malformed.");
}
}
else if (!strcasecmp(defel->defname, "rightarg"))
{
......@@ -409,18 +401,12 @@ DefineOperator(char *oprName,
elog(ERROR, "setof type not implemented for rightarg");
if (nodeTag(defel->arg) == T_String)
{
typeName2 = defGetString(defel);
}
else
{
elog(ERROR, "type for rightarg is malformed.");
}
}
else if (!strcasecmp(defel->defname, "procedure"))
{
functionName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "precedence"))
{
/* NOT IMPLEMENTED (never worked in v4.2) */
......@@ -432,25 +418,15 @@ DefineOperator(char *oprName,
elog(NOTICE, "CREATE OPERATOR: associativity not implemented");
}
else if (!strcasecmp(defel->defname, "commutator"))
{
commutatorName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "negator"))
{
negatorName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "restrict"))
{
restrictionName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "join"))
{
joinName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "hashes"))
{
canHash = TRUE;
}
else if (!strcasecmp(defel->defname, "sort1"))
{
/* ----------------
......@@ -462,9 +438,7 @@ DefineOperator(char *oprName,
sortName1 = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "sort2"))
{
sortName2 = defGetString(defel);
}
else
{
elog(NOTICE, "DefineOperator: attribute \"%s\" not recognized",
......@@ -476,9 +450,7 @@ DefineOperator(char *oprName,
* make sure we have our required definitions
*/
if (functionName == NULL)
{
elog(ERROR, "Define: \"procedure\" unspecified");
}
/* ----------------
* now have OperatorCreate do all the work..
......@@ -528,13 +500,9 @@ DefineAggregate(char *aggName, List *parameters)
* sfunc1
*/
if (!strcasecmp(defel->defname, "sfunc1"))
{
stepfunc1Name = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "basetype"))
{
baseType = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "stype1"))
{
stepfunc1Type = defGetString(defel);
......@@ -544,9 +512,7 @@ DefineAggregate(char *aggName, List *parameters)
*/
}
else if (!strcasecmp(defel->defname, "sfunc2"))
{
stepfunc2Name = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "stype2"))
{
stepfunc2Type = defGetString(defel);
......@@ -564,13 +530,9 @@ DefineAggregate(char *aggName, List *parameters)
*/
}
else if (!strcasecmp(defel->defname, "initcond1"))
{
init1 = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "initcond2"))
{
init2 = defGetString(defel);
}
else
{
elog(NOTICE, "DefineAggregate: attribute \"%s\" not recognized",
......@@ -647,25 +609,15 @@ DefineType(char *typeName, List *parameters)
DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "internallength"))
{
internalLength = defGetTypeLength(defel);
}
else if (!strcasecmp(defel->defname, "externallength"))
{
externalLength = defGetTypeLength(defel);
}
else if (!strcasecmp(defel->defname, "input"))
{
inputName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "output"))
{
outputName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "send"))
{
sendName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "delimiter"))
{
char *p = defGetString(defel);
......@@ -673,33 +625,21 @@ DefineType(char *typeName, List *parameters)
delimiter = p[0];
}
else if (!strcasecmp(defel->defname, "receive"))
{
receiveName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "element"))
{
elemName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "default"))
{
defaultValue = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "passedbyvalue"))
{
byValue = true;
}
else if (!strcasecmp(defel->defname, "alignment"))
{
char *a = defGetString(defel);
if (!strcasecmp(a, "double"))
{
alignment = 'd';
}
else if (!strcasecmp(a, "int"))
{
alignment = 'i';
}
else
{
elog(ERROR, "DefineType: \"%s\" alignment not recognized",
......
......@@ -80,9 +80,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
PointerGetDatum(languageName),
0, 0, 0);
if (HeapTupleIsValid(langTup))
{
elog(ERROR, "Language %s already exists", languageName);
}
/* ----------------
* Lookup the PL handler function and check that it is
......@@ -171,9 +169,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
PointerGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(langTup))
{
elog(ERROR, "Language %s doesn't exist", languageName);
}
if (!((Form_pg_language) GETSTRUCT(langTup))->lanispl)
{
......@@ -195,9 +191,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tup))
{
elog(ERROR, "Language with name '%s' not found", languageName);
}
heap_delete(rdesc, &(tup->t_ctid));
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.20 1998/02/26 04:30:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.21 1998/06/15 19:28:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -387,9 +387,7 @@ tg_rewriteQuery(TgRecipe * r,
{
tle = lfirst(tl);
if (tle->resdom != NULL)
{
tle->expr = tg_rewriteParamsInExpr(tle->expr, inputQlist);
}
}
}
......@@ -401,9 +399,7 @@ tg_rewriteQuery(TgRecipe * r,
if (orig->qual)
{
if (nodeTag(orig->qual) == T_List)
{
elog(ERROR, "tg_rewriteQuery: Whoa! why is my qual a List???");
}
orig->qual = tg_rewriteParamsInExpr(orig->qual, inputQlist);
}
......@@ -514,9 +510,7 @@ tg_replaceNumberedParam(Node *expression,
}
}
else
{
elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
}
}
break;
case T_Expr:
......@@ -626,15 +620,11 @@ tg_rewriteParamsInExpr(Node *expression, QueryTreeList *inputQlist)
{
tle = lfirst(tl);
if (strcmp(resname, tle->resdom->resname) == 0)
{
return tle->expr;
}
}
}
else
{
elog(ERROR, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
}
}
else
......@@ -648,9 +638,7 @@ tg_rewriteParamsInExpr(Node *expression, QueryTreeList *inputQlist)
}
}
else
{
elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
}
}
break;
case T_Expr:
......@@ -716,9 +704,7 @@ getParamTypes(TgElement * elem, Oid typev[])
parameterCount = 0;
for (i = 0; i < 8; i++)
{
typev[i] = 0;
}
for (j = 0; j < elem->inTypes->num; j++)
{
if (parameterCount == 8)
......@@ -736,13 +722,9 @@ getParamTypes(TgElement * elem, Oid typev[])
{
toid = TypeGet(elem->inTypes->val[j], &defined);
if (!OidIsValid(toid))
{
elog(ERROR, "getParamTypes: arg type '%s' is not defined", t);
}
if (!defined)
{
elog(NOTICE, "getParamTypes: arg type '%s' is only a shell", t);
}
}
typev[parameterCount++] = toid;
}
......@@ -904,9 +886,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
sprintf(newquery, "select %s($1", funcName);
for (i = 1; i < parameterCount; i++)
{
sprintf(newquery, "%s,$%d", newquery, i);
}
sprintf(newquery, "%s)", newquery);
}
else
......@@ -1071,9 +1051,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
"result",
InvalidOid,
-1, 0, false))
{
elog(NOTICE, "tg_parseSubQuery: unexpected result from TupleDescInitEntry");
}
else
{
relid = heap_create_with_catalog(
......@@ -1083,9 +1061,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
}
}
else if (n->nodeType == TG_RECIPE_NODE)
{
elog(NOTICE, "tg_parseSubQuery: can't handle embedded recipes yet!");
}
else
elog(NOTICE, "unknown nodeType: %d", n->nodeType);
......@@ -1134,9 +1110,7 @@ OffsetVarAttno(Node *node, int varno, int offset)
List *l;
foreach(l, (List *) node)
{
OffsetVarAttno(lfirst(l), varno, offset);
}
}
break;
default:
......@@ -1174,9 +1148,7 @@ appendQlist(QueryTreeList *q1, QueryTreeList *q2)
for (i = 0; i < q1->len; i++)
newq->qtrees[i] = q1->qtrees[i];
for (j = 0; j < q2->len; j++)
{
newq->qtrees[i + j] = q2->qtrees[j];
}
return newq;
}
......@@ -1225,9 +1197,7 @@ replaceSeqScan(Plan *plan, Plan *parent,
Result *newPlan;
if (plan == NULL)
{
return;
}
if (plan->type == T_SeqScan)
{
......@@ -1288,13 +1258,9 @@ replaceSeqScan(Plan *plan, Plan *parent,
else
{
if (plan->lefttree)
{
replaceSeqScan(plan->lefttree, plan, rt_ind, tplan);
}
if (plan->righttree)
{
replaceSeqScan(plan->righttree, plan, rt_ind, tplan);
}
}
}
......@@ -1352,14 +1318,10 @@ replaceTeeScans(Plan *plan, Query *parsetree, TeeInfo * teeInfo)
{
if (strcmp(teeInfo->val[i].tpi_relName,
rte->refname) == 0)
{
tplan = teeInfo->val[i].tpi_plan;
}
}
if (tplan == NULL)
{
elog(NOTICE, "replaceTeeScans didn't find the corresponding tee plan");
}
/*
* replace the sequential scan node with that var number with
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.24 1998/05/09 23:43:45 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.25 1998/06/15 19:28:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -364,9 +364,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
0, 0, 0);
if (!HeapTupleIsValid(tup))
{
elog(ERROR, "RemoveFunction: type '%s' not found", typename);
}
argList[i] = tup->t_oid;
}
}
......@@ -458,14 +456,10 @@ RemoveAggregate(char *aggName, char *aggType)
{
basetypeID = TypeGet(aggType, &defined);
if (!OidIsValid(basetypeID))
{
elog(ERROR, "RemoveAggregate: type '%s' does not exist", aggType);
}
}
else
{
basetypeID = 0;
}
/*
#ifndef NO_SECURITY
......
......@@ -313,9 +313,7 @@ currval(struct varlena * seqin)
pfree(seqname);
if (elm->increment == 0) /* nextval/read_info were not called */
{
elog(ERROR, "%s.currval is not yet defined in this session", elm->name);
}
result = elm->last;
......
......@@ -149,14 +149,10 @@ CreateTrigger(CreateTrigStmt *stmt)
ObjectIdGetDatum(((Form_pg_proc) GETSTRUCT(tuple))->prolang),
0, 0, 0);
if (!HeapTupleIsValid(langTup))
{
elog(ERROR, "CreateTrigger: cache lookup for PL failed");
}
if (((Form_pg_language) GETSTRUCT(langTup))->lanispl == false)
{
elog(ERROR, "CreateTrigger: only C and PL functions are supported");
}
}
MemSet(nulls, ' ', Natts_pg_trigger * sizeof(char));
......@@ -598,9 +594,7 @@ ExecCallTriggerFunc(Trigger *trigger)
{
if (trigger->tgfunc.fn_addr == NULL)
{
fmgr_info(trigger->tgfoid, &trigger->tgfunc);
}
if (trigger->tgfunc.fn_plhandler != NULL)
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.64 1998/04/27 04:05:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.65 1998/06/15 19:28:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -333,9 +333,7 @@ vc_getrels(NameData *VacRelP)
/* get a relation list entry for this guy */
old = MemoryContextSwitchTo((MemoryContext) portalmem);
if (vrl == (VRelList) NULL)
{
vrl = cur = (VRelList) palloc(sizeof(VRelListData));
}
else
{
cur->vrl_next = (VRelList) palloc(sizeof(VRelListData));
......@@ -1029,9 +1027,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
dowrite = true;
}
else
{
Assert(isempty);
}
--Vnpages;
Assert(Vnpages > 0);
/* get prev reapped page from Vvpl */
......@@ -1054,9 +1050,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
}
}
else
{
Assert(!isempty);
}
vpc->vpd_blkno = blkno;
maxoff = PageGetMaxOffsetNumber(page);
......@@ -1529,9 +1523,7 @@ vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
index_delete(indrel, &res->index_iptr);
}
else
{
nitups++;
}
/* be tidy */
pfree(res);
......@@ -2219,9 +2211,7 @@ vc_clsindices(int nindices, Relation *Irel)
return;
while (nindices--)
{
index_close(Irel[nindices]);
}
pfree(Irel);
} /* vc_clsindices */
......
......@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements.
*
* $Id: variable.c,v 1.5 1998/03/30 16:45:59 momjian Exp $
* $Id: variable.c,v 1.6 1998/06/15 19:28:17 momjian Exp $
*
*/
......@@ -365,9 +365,7 @@ parse_date(const char *value)
ecnt++;
}
else
{
elog(ERROR, "Bad value for date style (%s)", tok);
}
pfree(tok);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.21 1998/02/26 04:31:06 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.22 1998/06/15 19:28:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -90,9 +90,7 @@ DefineVirtualRelation(char *relname, List *tlist)
}
}
else
{
elog(ERROR, "attempted to define virtual relation with no attrs");
}
/*
* now create the parametesr for keys/inheritance etc. All of them are
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.20 1998/02/27 16:11:26 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.21 1998/06/15 19:28:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -124,9 +124,7 @@ ExecOpenR(Oid relationOid, bool isindex)
* ----------------
*/
if (isindex)
{
relation = index_open(relationOid);
}
else
relation = heap_open(relationOid);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.10 1998/01/31 04:38:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.11 1998/06/15 19:28:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -230,9 +230,7 @@ ExecInitJunkFilter(List *targetList)
}
}
else
{
cleanMap = NULL;
}
/* ---------------------
* Finally create and initialize the JunkFilter.
......
......@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.47 1998/05/26 03:44:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.48 1998/06/15 19:28:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -364,9 +364,7 @@ ExecCheckPerms(CmdType operation,
++i;
}
if (!ok)
{
elog(ERROR, "%s: %s", rname.data, aclcheck_error_strings[aclcheck_result]);
}
}
/* ===============================================================
......@@ -660,9 +658,7 @@ EndPlan(Plan *plan, EState *estate)
* ----------------
*/
if (intoRelationDesc != NULL)
{
heap_close(intoRelationDesc);
}
}
/* ----------------------------------------------------------------
......@@ -1009,9 +1005,7 @@ ExecAppend(TupleTableSlot *slot,
*/
numIndices = resultRelationInfo->ri_NumIndices;
if (numIndices > 0)
{
ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, false);
}
(estate->es_processed)++;
estate->es_lastoid = newId;
......@@ -1218,9 +1212,7 @@ ExecReplace(TupleTableSlot *slot,
numIndices = resultRelationInfo->ri_NumIndices;
if (numIndices > 0)
{
ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, true);
}
/* AFTER ROW UPDATE Triggers */
if (resultRelationDesc->trigdesc &&
......
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.10 1998/05/19 18:05:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.11 1998/06/15 19:28:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -426,13 +426,9 @@ ExecEndNode(Plan *node, Plan *parent)
return;
foreach(subp, node->initPlan)
{
ExecEndSubPlan((SubPlan *) lfirst(subp));
}
foreach(subp, node->subPlan)
{
ExecEndSubPlan((SubPlan *) lfirst(subp));
}
if (node->chgParam != NULL)
{
freeList(node->chgParam);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.32 1998/05/29 17:00:06 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.33 1998/06/15 19:28:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -417,16 +417,12 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
case PARAM_NAMED:
if (thisParameterKind == paramList->kind &&
strcmp(paramList->name, thisParameterName) == 0)
{
matchFound = 1;
}
break;
case PARAM_NUM:
if (thisParameterKind == paramList->kind &&
paramList->id == thisParameterId)
{
matchFound = 1;
}
break;
case PARAM_OLD:
case PARAM_NEW:
......@@ -454,9 +450,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
thisParameterKind);
}
if (!matchFound)
{
paramList++;
}
} /* while */
} /* if */
......@@ -821,9 +815,7 @@ ExecMakeFunctionResult(Node *node,
* its func cache.
*/
if (*isDone)
{
((Func *) node)->func_fcache = NULL;
}
}
return result;
}
......@@ -1558,9 +1550,7 @@ ExecTargetList(List *targetlist,
#endif
resind = fjRes->resno - 1;
if (fjIsNull[curNode])
{
null_head[resind] = 'n';
}
else
{
null_head[resind] = ' ';
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.31 1998/04/27 04:05:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.32 1998/06/15 19:28:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -804,9 +804,7 @@ ExecOpenIndices(Oid resultRelationOid,
pfree(predString);
}
else
{
predicate = NULL;
}
/* ----------------
* save the index information into lists
......@@ -916,9 +914,7 @@ ExecOpenIndices(Oid resultRelationOid,
i = 0;
foreach(indexpreds, predList)
{
indexInfoArray[i++]->ii_Predicate = lfirst(indexpreds);
}
/* ----------------
* store the index info array into relation info
* ----------------
......@@ -1117,9 +1113,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
if (predicate != NULL)
{
if (econtext == NULL)
{
econtext = makeNode(ExprContext);
}
econtext->ecxt_scantuple = slot;
/* Skip this index-update if the predicate isn't satisfied */
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.16 1998/02/13 03:26:44 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.17 1998/06/15 19:28:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -176,9 +176,7 @@ postquel_start(execution_state *es)
* 30-8-1996
*/
if (es->qd->operation == CMD_UTILITY)
{
return (TupleDesc) NULL;
}
#endif
return ExecutorStart(es->qd, es->estate);
}
......@@ -218,9 +216,7 @@ postquel_end(execution_state *es)
* 30-8-1996
*/
if (es->qd->operation == CMD_UTILITY)
{
return;
}
#endif
ExecutorEnd(es->qd, es->estate);
}
......
......@@ -405,9 +405,7 @@ ExecAgg(Agg *node)
* the tuples we aggregate over share the same group column)
*/
if (!oneTuple)
{
oneTuple = heap_copytuple(outerslot->val);
}
nTuplesAgged++;
}
......@@ -437,13 +435,9 @@ ExecAgg(Agg *node)
args[1] = (char *) value2[i];
}
else if (aggfns->xfn1.fn_addr != NULL)
{
args[0] = (char *) value1[i];
}
else if (aggfns->xfn2.fn_addr != NULL)
{
args[0] = (char *) value2[i];
}
else
elog(NOTICE, "ExecAgg: no valid transition functions??");
value1[i] = (Datum) fmgr_c(&aggfns->finalfn,
......@@ -458,9 +452,7 @@ ExecAgg(Agg *node)
*/
}
else if (aggfns->xfn2.fn_addr != NULL)
{
value1[i] = value2[i];
}
else
elog(ERROR, "ExecAgg: no valid transition functions??");
}
......@@ -475,9 +467,7 @@ ExecAgg(Agg *node)
aggstate->agg_done = ((Group *) outerPlan)->grpstate->grp_done;
}
else
{
aggstate->agg_done = TRUE;
}
/* ----------------
* form a projection tuple, store it in the result tuple
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.11 1998/02/26 04:31:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.12 1998/06/15 19:28:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -351,9 +351,7 @@ ExecCountSlotsAppend(Append *node)
int nSlots = 0;
foreach(plan, unionplans)
{
nSlots += ExecCountSlotsNode((Plan *) lfirst(plan));
}
return nSlots + APPEND_NSLOTS;
}
......@@ -426,13 +424,9 @@ ExecProcAppend(Append *node)
whichplan = unionstate->as_whichplan;
if (ScanDirectionIsForward(direction))
{
unionstate->as_whichplan = whichplan + 1;
}
else
{
unionstate->as_whichplan = whichplan - 1;
}
/* ----------------
* return something from next node or an empty slot
......@@ -484,9 +478,7 @@ ExecEndAppend(Append *node)
for (i = 0; i < nplans; i++)
{
if (initialized[i] == TRUE)
{
ExecEndNode((Plan *) nth(i, unionplans), (Plan *) node);
}
}
/* ----------------
......
......@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive)
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.18 1998/02/26 04:31:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.19 1998/06/15 19:28:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -114,9 +114,7 @@ ExecGroupEveryTuple(Group *node)
firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */
if (firsttuple == NULL)
{
grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
else
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.20 1998/02/26 04:31:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.21 1998/06/15 19:28:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -354,9 +354,7 @@ ExecHashTableCreate(Hash *node)
shmid = 0;
if (hashtable == NULL)
{
elog(ERROR, "not enough memory for hashjoin.");
}
/* ----------------
* initialize the hash table header
* ----------------
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.17 1998/03/30 16:46:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.18 1998/06/15 19:28:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -279,13 +279,9 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
ExecEvalExpr(scanexpr, exprCtxt, &isNull, &isDone);
scan_keys[j].sk_argument = scanvalue;
if (isNull)
{
scan_keys[j].sk_flags |= SK_ISNULL;
}
else
{
scan_keys[j].sk_flags &= ~SK_ISNULL;
}
}
}
}
......@@ -885,9 +881,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* ----------------
*/
if (have_runtime_keys)
{
indexstate->iss_RuntimeKeyInfo = (Pointer) runtimeKeyInfo;
}
else
{
indexstate->iss_RuntimeKeyInfo = NULL;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.15 1998/06/15 18:39:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.16 1998/06/15 19:28:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -571,13 +571,9 @@ ExecMergeJoin(MergeJoin *node)
MJ_DEBUG_QUAL(mergeclauses, qualResult);
if (qualResult)
{
mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
}
else
{
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
}
break;
/*
......@@ -634,13 +630,9 @@ ExecMergeJoin(MergeJoin *node)
econtext->ecxt_innertuple = innerTupleSlot;
if (TupIsNull(innerTupleSlot))
{
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
}
else
{
mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
}
break;
/*
......@@ -863,13 +855,9 @@ ExecMergeJoin(MergeJoin *node)
MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
if (compareResult)
{
mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
}
else
{
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
}
break;
/*
......@@ -986,13 +974,9 @@ ExecMergeJoin(MergeJoin *node)
MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
if (compareResult)
{
mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
}
else
{
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
}
break;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.9 1998/02/26 04:31:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.10 1998/06/15 19:28:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -120,9 +120,7 @@ ExecNestLoop(NestLoop *node, Plan *parent)
needNewOuterTuple = false;
if (!TupIsNull(outerTupleSlot))
{
ENL1_printf("have outer tuple, deal with it");
}
else
{
ENL1_printf("outer tuple is nil, need new outer tuple");
......@@ -196,9 +194,7 @@ ExecNestLoop(NestLoop *node, Plan *parent)
econtext->ecxt_innertuple = innerTupleSlot;
if (TupIsNull(innerTupleSlot))
{
ENL1_printf("couldn't get inner tuple - need new outer tuple");
}
else
{
ENL1_printf("got inner and outer tuples");
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.9 1998/03/30 16:46:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.10 1998/06/15 19:28:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -129,13 +129,9 @@ ExecSeqScan(SeqScan *node)
* ----------------
*/
if ((outerPlan = outerPlan((Plan *) node)) != NULL)
{
slot = ExecProcNode(outerPlan, (Plan *) node);
}
else
{
slot = ExecScan(node, SeqNext);
}
S1_printf("ExecSeqScan: returned tuple slot: %d\n", slot);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.14 1998/02/26 04:31:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.15 1998/06/15 19:28:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -181,9 +181,7 @@ ExecSort(Sort *node)
SO1_printf(stderr, "ExecSort: sorting done.\n");
}
else
{
slot = (TupleTableSlot *) sortstate->csstate.cstate.cs_ResultTupleSlot;
}
SO1_printf("ExecSort: %s\n",
"retrieving tuple from sorted relation");
......
......@@ -15,7 +15,7 @@
* ExecEndTee
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.17 1998/04/24 14:41:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.18 1998/06/15 19:28:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -315,18 +315,14 @@ ExecTee(Tee *node, Plan *parent)
/* XXX doesn't handle backwards direction yet */
if (parent == node->leftParent)
{
branch = leftPlace;
}
else if ((parent == node->rightParent) || (parent == (Plan *) node))
/*
* the tee node could be the root node of the plan, in which case,
* we treat it like a right-parent pull
*/
{
branch = rightPlace;
}
else
{
elog(ERROR, "A Tee node can only be executed from its left or right parent\n");
......@@ -419,13 +415,9 @@ ExecTee(Tee *node, Plan *parent)
}
if (parent == node->leftParent)
{
teeState->tee_leftPlace = leftPlace + 1;
}
else
{
teeState->tee_rightPlace = rightPlace + 1;
}
return result;
}
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.9 1998/02/26 04:31:37 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.10 1998/06/15 19:28:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -173,9 +173,7 @@ DLRemHead(Dllist *l)
result = l->dll_head;
if (l->dll_head->dle_next)
{
l->dll_head->dle_next->dle_prev = 0;
}
l->dll_head = l->dll_head->dle_next;
......@@ -199,9 +197,7 @@ DLRemTail(Dllist *l)
result = l->dll_tail;
if (l->dll_tail->dle_prev)
{
l->dll_tail->dle_prev->dle_next = 0;
}
l->dll_tail = l->dll_tail->dle_prev;
result->dle_prev = 0;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/fstack.c,v 1.7 1998/04/06 17:27:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/fstack.c,v 1.8 1998/06/15 19:28:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -62,9 +62,7 @@ FixedStackPop(FixedStack stack)
AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top))
{
return (NULL);
}
pointer = FixedStackGetItemBase(stack, stack->top);
stack->top = stack->top->next;
......@@ -110,9 +108,7 @@ FixedStackContains(FixedStack stack, Pointer pointer)
for (next = stack->top; FixedItemIsValid(next); next = next->next)
{
if (next == item)
{
return (true);
}
}
return (false);
}
......@@ -125,9 +121,7 @@ FixedStackGetTop(FixedStack stack)
AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top))
{
return (NULL);
}
return (FixedStackGetItemBase(stack, stack->top));
}
......@@ -144,9 +138,7 @@ FixedStackGetNext(FixedStack stack, Pointer pointer)
item = FixedStackGetItem(stack, pointer)->next;
if (!PointerIsValid(item))
{
return (NULL);
}
return (FixedStackGetItemBase(stack, item));
}
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.9 1998/01/07 21:03:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.10 1998/06/15 19:28:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -35,9 +35,7 @@ makeStringInfo()
res = (StringInfo) palloc(sizeof(StringInfoData));
if (res == NULL)
{
elog(ERROR, "makeStringInfo: Out of memory!");
}
size = 100;
res->data = palloc(size);
......@@ -95,9 +93,7 @@ appendStringInfo(StringInfo str, char *buffer)
*/
newlen = 2 * str->len;
while (buflen + str->len >= newlen - 1)
{
newlen = 2 * newlen;
}
/*
* allocate enough space.
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.20 1998/05/12 21:43:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.21 1998/06/15 19:28:25 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
......@@ -69,9 +69,7 @@ lo_open(Oid lobjId, int mode)
#endif
if (fscxt == NULL)
{
fscxt = CreateGlobalMemory("Filesystem");
}
currentContext = MemoryContextSwitchTo((MemoryContext) fscxt);
lobjDesc = inv_open(lobjId, mode);
......@@ -171,9 +169,7 @@ lo_creat(int mode)
Oid lobjId;
if (fscxt == NULL)
{
fscxt = CreateGlobalMemory("Filesystem");
}
currentContext = MemoryContextSwitchTo((MemoryContext) fscxt);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.16 1998/06/04 17:26:39 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.17 1998/06/15 19:28:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -77,17 +77,11 @@ PQfn(int fnid,
for (i = 0; i < nargs; i++)
{
if (args[i].len == VAR_LENGTH_ARG)
{
arg[i] = (char *) args[i].u.ptr;
}
else if (args[i].len > sizeof(int4))
{
elog(ERROR, "arg_length of argument %d too long", i);
}
else
{
arg[i] = (char *) args[i].u.integer;
}
}
/* ----------------
......@@ -107,13 +101,9 @@ PQfn(int fnid,
return "0";
if (result_is_int)
{
*result_buf = (int) retval;
}
else
{
memmove(result_buf, retval, result_len);
}
return "G";
}
......
......@@ -145,9 +145,7 @@ crypt_loadpwdfile()
{ /* free the old data only if this is a
* reload */
while (pwd_cache_count--)
{
free((void *) pwd_cache[pwd_cache_count]);
}
free((void *) pwd_cache);
pwd_cache = NULL;
pwd_cache_count = 0;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.32 1998/06/13 05:14:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.33 1998/06/15 19:28:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -995,9 +995,7 @@ GetCharSetByHost(char TableName[], int host, const char DataDir[])
/* Read the charset */
next_token(file, buf, sizeof(buf));
if (buf[0] != '\0')
{
strcpy(HostCharset, buf);
}
}
}
break;
......@@ -1005,9 +1003,7 @@ GetCharSetByHost(char TableName[], int host, const char DataDir[])
/* Read the base charset */
next_token(file, buf, sizeof(buf));
if (buf[0] != '\0')
{
strcpy(BaseCharset, buf);
}
break;
case KEY_TABLE:
/* Read the original charset */
......@@ -1046,9 +1042,7 @@ GetCharSetByHost(char TableName[], int host, const char DataDir[])
{
if (!strcasecmp(BaseCharset, ChArray[i]->Orig) &&
!strcasecmp(HostCharset, ChArray[i]->Dest))
{
strncpy(TableName, ChArray[i]->Table, 79);
}
free((struct CharsetItem *) ChArray[i]);
}
}
......
......@@ -48,9 +48,7 @@ verify_password(char *auth_arg, char *user, char *password)
test_pw = strtok(NULL, ":");
if (!test_user || !test_pw ||
test_user[0] == '\0' || test_pw[0] == '\0')
{
continue;
}
/* kill the newline */
if (test_pw[strlen(test_pw) - 1] == '\n')
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.13 1998/02/26 04:31:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.14 1998/06/15 19:28:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -119,9 +119,7 @@ PQnportals(int rule_p)
if (portals[i] && portals[i]->portal)
{
if (!rule_p || portals[i]->portal->rule_p)
{
++n;
}
}
}
return (n);
......@@ -690,9 +688,7 @@ PQnotifies_init()
PQNotifyList *p;
if (pqNotifyList == NULL)
{
pqNotifyList = DLNewList();
}
else
{
/* clean all notifies */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.43 1998/05/29 17:00:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.44 1998/06/15 19:28:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -89,13 +89,9 @@ pq_init(int fd)
elog(FATAL, "pq_init: Couldn't initialize socket connection");
PQnotifies_init();
if (getenv("LIBPQ_DEBUG"))
{
Pfdebug = stderr;
}
else
{
Pfdebug = NULL;
}
}
/* -------------------------
......@@ -229,9 +225,7 @@ PQgetline(char *s, int maxlen)
return (EOF);
if (fgets(s, maxlen - 1, Pfin) == NULL)
{
return feof(Pfin) ? EOF : 1;
}
else
{
for (; *s; s++)
......@@ -643,9 +637,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
*fdP = fd;
if (family == AF_UNIX)
{
chmod(sock_path, 0777);
}
return (STATUS_OK);
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.7 1997/09/08 02:23:19 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.8 1998/06/15 19:28:27 momjian Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
......@@ -56,9 +56,7 @@ pqsignal(int signo, pqsigfunc func)
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
if (signo != SIGALRM)
{
act.sa_flags |= SA_RESTART;
}
if (sigaction(signo, &act, &oact) < 0)
return (SIG_ERR);
return (oact.sa_handler);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.20 1998/06/04 17:26:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.21 1998/06/15 19:28:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -72,9 +72,7 @@ main(int argc, char *argv[])
#if defined(__alpha)
if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
(unsigned long) NULL) < 0)
{
elog(NOTICE, "setsysinfo failed: %d\n", errno);
}
#endif
#endif /* NOFIXADE || NOPRINTADE */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.41 1998/02/26 04:32:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.42 1998/06/15 19:28:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -45,9 +45,7 @@ listCopy(List *list)
foreach(l, list)
{
if (newlist == NIL)
{
newlist = nl = lcons(lfirst(l), NIL);
}
else
{
lnext(nl) = lcons(lfirst(l), NIL);
......@@ -842,9 +840,7 @@ _copyConst(Const *from)
}
}
else
{
newnode->constvalue = from->constvalue;
}
newnode->constisnull = from->constisnull;
newnode->constbyval = from->constbyval;
newnode->constisset = from->constisset;
......@@ -1108,9 +1104,7 @@ CopyPathFields(Path *from, Path *newnode)
}
}
else
{
Node_Copy(from, newnode, p_ordering.ord.merge);
}
Node_Copy(from, newnode, keys);
......@@ -1829,9 +1823,7 @@ copyObject(void *from)
foreach(l, list)
{
if (newlist == NIL)
{
newlist = nl = lcons(copyObject(lfirst(l)), NIL);
}
else
{
lnext(nl) = lcons(copyObject(lfirst(l)), NIL);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.12 1998/02/26 04:32:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.13 1998/06/15 19:28:31 momjian Exp $
*
* NOTES
* XXX a few of the following functions are duplicated to handle
......@@ -122,9 +122,7 @@ nreverse(List *list)
return (list);
for (p = list; p != NULL; p = lnext(p))
{
rlist = lcons(lfirst(p), rlist);
}
lfirst(list) = lfirst(rlist);
lnext(list) = lnext(rlist);
......@@ -324,9 +322,7 @@ LispUnion(List *l1, List *l2)
}
}
foreach(i, l2)
{
retval = lappend(retval, lfirst(i));
}
return (retval);
}
......@@ -356,9 +352,7 @@ LispUnioni(List *l1, List *l2)
}
}
foreach(i, l2)
{
retval = lappendi(retval, lfirsti(i));
}
return (retval);
}
......@@ -410,13 +404,9 @@ lremove(void *elem, List *list)
if (l != NULL)
{
if (prev == NIL)
{
result = lnext(list);
}
else
{
lnext(prev) = lnext(l);
}
}
return result;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.35 1998/05/09 23:46:35 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.36 1998/06/15 19:28:32 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
......@@ -690,9 +690,7 @@ _outFjoin(StringInfo str, Fjoin *node)
appendStringInfo(str, " :alwaysdone ");
for (i = 0; i < node->fj_nNodes; i++)
{
appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false");
}
}
/*
......@@ -779,13 +777,9 @@ _outConst(StringInfo str, Const *node)
appendStringInfo(str, node->constisnull ? "true" : "false");
appendStringInfo(str, " :constvalue ");
if (node->constisnull)
{
appendStringInfo(str, "<>");
}
else
{
_outDatum(str, node->constvalue, node->consttype);
}
appendStringInfo(str, " :constbyval ");
appendStringInfo(str, node->constbyval ? "true" : "false");
}
......@@ -1496,9 +1490,7 @@ _outDatum(StringInfo str, Datum value, Oid type)
* without casting it to int first!! -mer 8 Jan 1991
*/
if (((int) length) <= -1)
{
length = VARSIZE(s);
}
sprintf(buf, " %d [ ", length);
appendStringInfo(str, buf);
for (i = 0; i < length; i++)
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.14 1998/01/20 05:03:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.15 1998/06/15 19:28:32 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
......@@ -69,9 +69,7 @@ pprint(void *obj)
for (;;)
{
for (j = 0; j < indentLev * 3; j++)
{
line[j] = ' ';
}
for (; j < 75 && s[i] != '\0'; i++, j++)
{
line[j] = s[i];
......@@ -109,9 +107,7 @@ pprint(void *obj)
printf("%s\n", line);
/* print the line before : and resets */
for (j = 0; j < indentLev * 3; j++)
{
line[j] = ' ';
}
}
line[j] = s[i];
break;
......@@ -123,9 +119,7 @@ pprint(void *obj)
printf("%s\n", line);
}
if (j != 0)
{
printf("%s\n", line);
}
fflush(stdout);
return;
}
......@@ -211,14 +205,10 @@ print_expr(Node *expr, List *rtable)
print_expr((Node *) get_rightop(e), rtable);
}
else
{
printf("an expr");
}
}
else
{
printf("not an expr");
}
}
/*
......@@ -258,13 +248,9 @@ print_tl(List *tlist, List *rtable)
printf("\t%d %s\t", tle->resdom->resno, tle->resdom->resname);
if (tle->resdom->reskey != 0)
{
printf("(%d):\t", tle->resdom->reskey);
}
else
{
printf(" :\t");
}
print_expr(tle->expr, rtable);
printf("\n");
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.11 1998/02/26 04:32:16 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.12 1998/06/15 19:28:32 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
......@@ -78,9 +78,7 @@ nodeTokenType(char *token, int length)
* skip the optional '-' (i.e. negative number)
*/
if (*token == '-')
{
token++;
}
/*
* See if there is a decimal point
......@@ -127,9 +125,7 @@ lsptok(char *string, int *length)
{
local_str = string;
if (length == NULL)
{
return (NULL);
}
}
for (; *local_str == ' '
......@@ -159,9 +155,7 @@ lsptok(char *string, int *length)
}
else if (*local_str == ')' || *local_str == '(' ||
*local_str == '}' || *local_str == '{')
{
local_str++;
}
else
{
for (; *local_str != ' '
......@@ -223,9 +217,7 @@ nodeRead(bool read_car_only)
this_value = (Node *) l;
}
else
{
this_value = nodeRead(false);
}
break;
case RIGHT_PAREN:
this_value = NULL;
......@@ -241,13 +233,9 @@ nodeRead(bool read_car_only)
* It might be NULL but it is an atom!
*/
if (read_car_only)
{
make_dotted_pair_cell = false;
}
else
{
make_dotted_pair_cell = true;
}
}
else
{
......@@ -293,18 +281,12 @@ nodeRead(bool read_car_only)
lfirst(l) = this_value;
if (!read_car_only)
{
lnext(l) = nodeRead(false);
}
else
{
lnext(l) = NULL;
}
return_value = (Node *) l;
}
else
{
return_value = this_value;
}
return (return_value);
}
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.29 1998/04/27 02:58:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.30 1998/06/15 19:28:33 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
......@@ -238,9 +238,7 @@ _getPlan(Plan *node)
token = lsptok(NULL, &length); /* now get the state */
if (length == 0)
{
node->state = (EState *) NULL;
}
else
{ /* Disgusting hack until I figure out what
* to do here */
......@@ -758,29 +756,17 @@ _readExpr()
token = lsptok(NULL, &length); /* eat :opType */
token = lsptok(NULL, &length); /* get opType */
if (!strncmp(token, "op", 2))
{
local_node->opType = OP_EXPR;
}
else if (!strncmp(token, "func", 4))
{
local_node->opType = FUNC_EXPR;
}
else if (!strncmp(token, "or", 2))
{
local_node->opType = OR_EXPR;
}
else if (!strncmp(token, "and", 3))
{
local_node->opType = AND_EXPR;
}
else if (!strncmp(token, "not", 3))
{
local_node->opType = NOT_EXPR;
}
else if (!strncmp(token, "subp", 4))
{
local_node->opType = SUBPLAN_EXPR;
}
token = lsptok(NULL, &length); /* eat :oper */
local_node->oper = nodeRead(true);
......@@ -953,13 +939,9 @@ _readConst()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->constisnull = true;
}
else
{
local_node->constisnull = false;
}
token = lsptok(NULL, &length); /* get :constvalue */
......@@ -981,13 +963,9 @@ _readConst()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->constbyval = true;
}
else
{
local_node->constbyval = false;
}
return (local_node);
}
......@@ -1019,13 +997,9 @@ _readFunc()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->funcisindex = true;
}
else
{
local_node->funcisindex = false;
}
token = lsptok(NULL, &length); /* get :funcsize */
token = lsptok(NULL, &length); /* now read it */
......@@ -1264,13 +1238,9 @@ _readRel()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->indexed = true;
}
else
{
local_node->indexed = false;
}
token = lsptok(NULL, &length); /* get :pages */
token = lsptok(NULL, &length); /* now read it */
......@@ -1817,13 +1787,9 @@ _readCInfo()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->notclause = true;
}
else
{
local_node->notclause = false;
}
token = lsptok(NULL, &length); /* get :indexids */
local_node->indexids = nodeRead(true); /* now read it */
......@@ -1917,24 +1883,16 @@ _readJInfo()
token = lsptok(NULL, &length); /* get :mergesortable */
if (!strncmp(token, "true", 4))
{
local_node->mergesortable = true;
}
else
{
local_node->mergesortable = false;
}
token = lsptok(NULL, &length); /* get :hashjoinable */
if (!strncmp(token, "true", 4))
{
local_node->hashjoinable = true;
}
else
{
local_node->hashjoinable = false;
}
return (local_node);
}
......@@ -1979,193 +1937,99 @@ parsePlanString(void)
token = lsptok(NULL, &length);
if (!strncmp(token, "PLAN", length))
{
return_value = _readPlan();
}
else if (!strncmp(token, "RESULT", length))
{
return_value = _readResult();
}
else if (!strncmp(token, "APPEND", length))
{
return_value = _readAppend();
}
else if (!strncmp(token, "JOIN", length))
{
return_value = _readJoin();
}
else if (!strncmp(token, "NESTLOOP", length))
{
return_value = _readNestLoop();
}
else if (!strncmp(token, "MERGEJOIN", length))
{
return_value = _readMergeJoin();
}
else if (!strncmp(token, "HASHJOIN", length))
{
return_value = _readHashJoin();
}
else if (!strncmp(token, "SCAN", length))
{
return_value = _readScan();
}
else if (!strncmp(token, "SEQSCAN", length))
{
return_value = _readSeqScan();
}
else if (!strncmp(token, "INDEXSCAN", length))
{
return_value = _readIndexScan();
}
else if (!strncmp(token, "TEMP", length))
{
return_value = _readTemp();
}
else if (!strncmp(token, "SORT", length))
{
return_value = _readSort();
}
else if (!strncmp(token, "AGGREG", length))
{
return_value = _readAggreg();
}
else if (!strncmp(token, "SUBLINK", length))
{
return_value = _readSubLink();
}
else if (!strncmp(token, "AGG", length))
{
return_value = _readAgg();
}
else if (!strncmp(token, "UNIQUE", length))
{
return_value = _readUnique();
}
else if (!strncmp(token, "HASH", length))
{
return_value = _readHash();
}
else if (!strncmp(token, "RESDOM", length))
{
return_value = _readResdom();
}
else if (!strncmp(token, "EXPR", length))
{
return_value = _readExpr();
}
else if (!strncmp(token, "ARRAYREF", length))
{
return_value = _readArrayRef();
}
else if (!strncmp(token, "ARRAY", length))
{
return_value = _readArray();
}
else if (!strncmp(token, "VAR", length))
{
return_value = _readVar();
}
else if (!strncmp(token, "CONST", length))
{
return_value = _readConst();
}
else if (!strncmp(token, "FUNC", length))
{
return_value = _readFunc();
}
else if (!strncmp(token, "OPER", length))
{
return_value = _readOper();
}
else if (!strncmp(token, "PARAM", length))
{
return_value = _readParam();
}
else if (!strncmp(token, "ESTATE", length))
{
return_value = _readEState();
}
else if (!strncmp(token, "REL", length))
{
return_value = _readRel();
}
else if (!strncmp(token, "TLE", length))
{
return_value = _readTargetEntry();
}
else if (!strncmp(token, "RTE", length))
{
return_value = _readRangeTblEntry();
}
else if (!strncmp(token, "PATH", length))
{
return_value = _readPath();
}
else if (!strncmp(token, "INDEXPATH", length))
{
return_value = _readIndexPath();
}
else if (!strncmp(token, "JOINPATH", length))
{
return_value = _readJoinPath();
}
else if (!strncmp(token, "MERGEPATH", length))
{
return_value = _readMergePath();
}
else if (!strncmp(token, "HASHPATH", length))
{
return_value = _readHashPath();
}
else if (!strncmp(token, "ORDERKEY", length))
{
return_value = _readOrderKey();
}
else if (!strncmp(token, "JOINKEY", length))
{
return_value = _readJoinKey();
}
else if (!strncmp(token, "MERGEORDER", length))
{
return_value = _readMergeOrder();
}
else if (!strncmp(token, "CINFO", length))
{
return_value = _readCInfo();
}
else if (!strncmp(token, "JOINMETHOD", length))
{
return_value = _readJoinMethod();
}
else if (!strncmp(token, "JINFO", length))
{
return_value = _readJInfo();
}
else if (!strncmp(token, "HINFO", length))
{
return_value = _readHInfo();
}
else if (!strncmp(token, "ITER", length))
{
return_value = _readIter();
}
else if (!strncmp(token, "QUERY", length))
{
return_value = _readQuery();
}
else if (!strncmp(token, "SORTCLAUSE", length))
{
return_value = _readSortClause();
}
else if (!strncmp(token, "GROUPCLAUSE", length))
{
return_value = _readGroupClause();
}
else
{
elog(ERROR, "badly formatted planstring \"%.10s\"...\n", token);
}
return ((Node *) return_value);
}
......@@ -2202,9 +2066,7 @@ readDatum(Oid type)
if (byValue)
{
if (length > sizeof(Datum))
{
elog(ERROR, "readValue: byval & length = %d", length);
}
s = (char *) (&res);
for (i = 0; i < sizeof(Datum); i++)
{
......@@ -2213,9 +2075,7 @@ readDatum(Oid type)
}
}
else if (length <= 0)
{
s = NULL;
}
else if (length >= 1)
{
s = (char *) palloc(length);
......@@ -2230,9 +2090,7 @@ readDatum(Oid type)
token = lsptok(NULL, &tokenLength); /* skip the ']' */
if (token[0] != ']')
{
elog(ERROR, "readValue: ']' expected, length =%d", length);
}
return (res);
}
......@@ -3,7 +3,7 @@
* geqo_erx.c--
* edge recombination crossover [ER]
*
* $Id: geqo_erx.c,v 1.8 1998/02/26 04:32:20 momjian Exp $
* $Id: geqo_erx.c,v 1.9 1998/06/15 19:28:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -228,9 +228,7 @@ gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene)
/* find destination for the newly entered point */
if (edge_table[new_gene[i - 1]].unused_edges > 0)
{
new_gene[i] = gimme_gene(edge_table[(int) new_gene[i - 1]], edge_table);
}
else
{ /* cope with fault */
......
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.18 1998/02/26 04:32:21 momjian Exp $
* $Id: geqo_eval.c,v 1.19 1998/06/15 19:28:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -131,9 +131,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
new_rels = lcons(gimme_clauseless_join(outer_rel, outer_rel), NIL); /* ??? MAU */
}
else
{
new_rels = lcons(gimme_clauseless_join(outer_rel, inner_rel), NIL);
}
}
/* process new_rel->pathlist */
......@@ -221,9 +219,7 @@ gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
rel = init_join_rel(outer_rel, get_join_rel(root, other_rels), joininfo);
}
else
{
rel = NULL;
}
if (rel != NULL)
join_list = lappend(join_list, rel);
......@@ -700,18 +696,12 @@ geqo_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel)
temp = (Cost) inner_rel->tuples * (Cost) outer_rel->tuples; /* cartesian product */
if (joinrel->clauseinfo)
{
temp = temp * product_selec(joinrel->clauseinfo);
}
if (temp >= (MAXINT - 1))
{
ntuples = ceil(geqo_log((double) temp, (double) GEQO_LOG_BASE));
}
else
{
ntuples = ceil((double) temp);
}
if (ntuples < 1)
ntuples = 1; /* make the best case 1 instead of 0 */
......
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.c,v 1.7 1998/01/07 21:03:44 momjian Exp $
* $Id: geqo_misc.c,v 1.8 1998/06/15 19:28:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -269,16 +269,12 @@ geqo_print_rel(Query *root, Rel *rel)
printf("______________________________\n");
printf("(");
foreach(l, rel->relids)
{
printf("%d ", lfirsti(l));
}
printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n");
foreach(l, rel->pathlist)
{
geqo_print_path(root, lfirst(l), 1);
}
printf("\tcheapest path:\n");
geqo_print_path(root, rel->cheapestpath, 1);
......
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_params.c,v 1.8 1997/09/08 21:44:30 momjian Exp $
* $Id: geqo_params.c,v 1.9 1998/06/15 19:28:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -205,9 +205,7 @@ geqo_params(int string_length)
}
else
{
elog(DEBUG, "geqo_params: ga parameter file\n\'%s\'\ndoes not exist or permissions are not setup correctly", conf_file);
}
/*
* parameter checkings follow
......@@ -317,13 +315,9 @@ gimme_pool_size(int string_length)
size = pow(2.0, exponent);
if (size < MIN_POOL)
{
return (MIN_POOL);
}
else if (size > MAX_POOL)
{
return (MAX_POOL);
}
else
return ((int) ceil(size));
}
......
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_paths.c,v 1.8 1998/02/26 04:32:23 momjian Exp $
* $Id: geqo_paths.c,v 1.9 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -147,9 +147,7 @@ set_paths(Rel *rel, Path *unorderedpath)
rel->pathlist = lremove(unorderedpath, rel->pathlist);
}
else
{
rel->unorderedpath = (Path *) unorderedpath;
}
return (cheapest);
}
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_pool.c,v 1.7 1998/04/06 02:38:04 momjian Exp $
* $Id: geqo_pool.c,v 1.8 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -66,9 +66,7 @@ alloc_pool(int pool_size, int string_length)
/* all gene */
chromo = (Chromosome *) new_pool->data; /* vector of all chromos */
for (i = 0; i < pool_size; i++)
{
chromo[i].string = palloc((string_length + 1) * sizeof(Gene));
}
return (new_pool);
}
......
......@@ -6,7 +6,7 @@
* PX operator according to Syswerda
* (The Genetic Algorithms Handbook, L Davis, ed)
*
* $Id: geqo_px.c,v 1.4 1997/09/08 21:44:35 momjian Exp $
* $Id: geqo_px.c,v 1.5 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -70,9 +70,7 @@ px(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
/* initialize city table */
for (i = 1; i <= num_gene; i++)
{
city_table[i].used = 0;
}
/* choose random positions that will be inherited directly from parent */
num_positions = geqo_randint(2 * num_gene / 3, num_gene / 3);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.4 1997/09/08 21:44:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.5 1998/06/15 19:28:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -88,9 +88,7 @@ minspantree(Query *root, List *join_rels, Rel *garel)
id2 = (int) lsecond(joinrel->relids);
if (id1 > id2)
{
tmprel_array[id2][id1] = *(Rel *) joinrel;
}
else
{
tmprel_array[id1][id2] = *(Rel *) joinrel; /* ever reached? */
......@@ -121,25 +119,17 @@ minspantree(Query *root, List *join_rels, Rel *garel)
{
garel[1] = tmprel_array[1][3];
if (rel12->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
{
garel[2] = tmprel_array[2][3];
}
else
{
garel[2] = tmprel_array[1][2];
}
}
else
{
garel[1] = tmprel_array[1][2];
if (rel13->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
{
garel[2] = tmprel_array[2][3];
}
else
{
garel[2] = tmprel_array[1][3];
}
}
}
......@@ -169,13 +159,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
if (connectto[tempn] != 0)
{
if (n > tempn)
{
joinrel = (Rel *) &tmprel_array[tempn][n];
}
else
{
joinrel = (Rel *) &tmprel_array[n][tempn];
}
dist = joinrel->cheapestpath->path_cost;
if (dist < disttoconnect[tempn])
......@@ -192,13 +178,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
}
n = nextn;
if (n > connectto[n])
{
garel[i] = tmprel_array[connectto[n]][n];
}
else
{
garel[i] = tmprel_array[n][connectto[n]];
}
i++;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.15 1998/02/26 04:32:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.16 1998/06/15 19:28:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -259,9 +259,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
root->join_relation_list_ = outer_rels;
}
else
{
root->join_relation_list_ = new_rels;
}
if (!BushyPlanFlag)
outer_rels = new_rels;
}
......@@ -407,16 +405,12 @@ debug_print_rel(Query *root, Rel *rel)
printf("(");
foreach(l, rel->relids)
{
printf("%d ", lfirsti(l));
}
printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n");
foreach(l, rel->pathlist)
{
print_path(root, lfirst(l), 1);
}
printf("\tcheapest path:\n");
print_path(root, rel->cheapestpath, 1);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.7 1998/04/27 04:05:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.8 1998/06/15 19:28:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -54,9 +54,7 @@ set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
clausenode = (CInfo *) lfirst(temp);
cost_clause = clausenode->selectivity;
if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause)
{
clausenode->selectivity = new_selectivity;
}
}
}
......@@ -225,18 +223,14 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
List *clause = lfirst(clauses);
if (clauses == NULL)
{
s1 = 1.0;
}
else if (IsA(clause, Param))
{
/* XXX How're we handling this before?? -ay */
s1 = 1.0;
}
else if (IsA(clause, Const))
{
s1 = ((bool) ((Const *) clause)->constvalue) ? 1.0 : 0.0;
}
else if (IsA(clause, Var))
{
Oid relid = getrelid(((Var *) clause)->varno,
......@@ -369,9 +363,7 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
*/
if (length(clauses) < 2)
{
return (s1);
}
else
{
/* Compute selectivity of the 'or'ed subclauses. */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.20 1998/01/13 04:04:06 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.21 1998/06/15 19:28:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -368,13 +368,9 @@ compute_rel_size(Rel *rel)
temp = rel->tuples * product_selec(rel->clauseinfo);
Assert(temp >= 0);
if (temp >= (MAXINT - 1))
{
temp1 = MAXINT;
}
else
{
temp1 = ceil((double) temp);
}
Assert(temp1 >= 0);
Assert(temp1 <= MAXINT);
return (temp1);
......@@ -449,9 +445,7 @@ compute_joinrel_size(JoinPath *joinpath)
temp = temp * product_selec(joinpath->pathclauseinfo);
if (temp >= (MAXINT - 1))
{
temp1 = MAXINT;
}
else
{
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.15 1998/04/27 04:05:53 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.16 1998/06/15 19:28:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -662,9 +662,7 @@ match_clause_to_indexkey(Rel *rel,
else if (leftop
&& match_index_to_operand(indexkey,
(Expr *) leftop, rel, index))
{
join_op = ((Oper *) ((Expr *) clause)->oper)->opno;
}
if (join_op && op_class(join_op, xclass, index->relam) &&
join_clause_p((Node *) clause))
......@@ -943,9 +941,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
!IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) ||
!IsA(pred_const, Const))
{
return false;
}
/*
* The implication can't be determined unless the predicate and the
......@@ -1161,9 +1157,7 @@ extract_restrict_clauses(List *clausegroup)
CInfo *cinfo = lfirst(l);
if (!join_clause_p((Node *) cinfo->clause))
{
restrict_cls = lappend(restrict_cls, cinfo);
}
}
return restrict_cls;
}
......@@ -1293,9 +1287,7 @@ create_index_paths(Query *root,
if (!(join_clause_p((Node *) clauseinfo->clause) &&
equal_path_merge_ordering(index->ordering,
clauseinfo->mergesortorder)))
{
temp = false;
}
}
if (!join || temp)
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.5 1997/09/08 21:44:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.6 1998/06/15 19:28:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -180,9 +180,7 @@ find_all_join_paths(Query *root, List *joinrels)
* wierd behavior.
*/
if (IsA_JoinPath(path))
{
((Path *) lfirst(path))->outerjoincost = (Cost) 0;
}
/*
* do it iff it is a join path, which is not always true, esp
......@@ -354,9 +352,7 @@ match_unsorted_outer(Rel *joinrel,
}
if (xmergeinfo)
{
clauses = xmergeinfo->jmethod.clauses;
}
if (clauses)
{
......@@ -374,19 +370,13 @@ match_unsorted_outer(Rel *joinrel,
joinrel->targetlist, clauses);
}
else
{
merge_pathkeys = outerpath->keys;
}
if (best_innerjoin &&
path_is_cheaper(best_innerjoin, cheapest_inner))
{
nestinnerpath = best_innerjoin;
}
else
{
nestinnerpath = cheapest_inner;
}
paths = lcons(create_nestloop_path(joinrel,
outerrel,
......@@ -429,13 +419,9 @@ match_unsorted_outer(Rel *joinrel,
* wouldn't otherwise be considered.
*/
if (path_is_cheaper_than_sort)
{
mergeinnerpath->outerjoincost = outerpath->path_cost;
}
else
{
mergeinnerpath = cheapest_inner;
}
temp_node =
lcons(create_mergesort_path(joinrel,
......@@ -453,9 +439,7 @@ match_unsorted_outer(Rel *joinrel,
paths);
}
else
{
temp_node = paths;
}
jp_list = nconc(jp_list, temp_node);
}
return (jp_list);
......@@ -518,9 +502,7 @@ match_unsorted_inner(Rel *joinrel,
}
if (xmergeinfo)
{
clauses = ((JoinMethod *) xmergeinfo)->clauses;
}
if (clauses)
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.9 1998/03/30 16:46:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.10 1998/06/15 19:28:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -138,9 +138,7 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
joininfo);
}
else
{
rel = NULL;
}
if (rel != NULL)
join_list = lappend(join_list, rel);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment