1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-16 17:07:43 +03:00

Remove un-needed braces around single statements.

This commit is contained in:
Bruce Momjian
1998-06-15 19:30:31 +00:00
parent 27db9ecd0b
commit 6bd323c6b3
224 changed files with 221 additions and 2504 deletions

View File

@@ -104,38 +104,26 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
{ {
result = (int) (*proc_fn) (p, value); result = (int) (*proc_fn) (p, value);
if (typlen > 0) if (typlen > 0)
{
p += typlen; p += typlen;
}
else else
{
p += INTALIGN(*(int32 *) p); p += INTALIGN(*(int32 *) p);
}
} }
if (result) if (result)
{ {
if (!and) if (!and)
{
return (1); return (1);
}
} }
else else
{ {
if (and) if (and)
{
return (0); return (0);
}
} }
} }
if (and && result) if (and && result)
{
return (1); return (1);
}
else else
{
return (0); return (0);
}
} }
/* /*

View File

@@ -97,13 +97,9 @@ hhmm_out(TimeADT *time)
tm->tm_sec = (((int) *time) % 60); tm->tm_sec = (((int) *time) % 60);
if (tm->tm_sec == 0) if (tm->tm_sec == 0)
{
sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min); sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min);
}
else else
{
sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
}
result = palloc(strlen(buf) + 1); result = palloc(strlen(buf) + 1);

View File

@@ -66,9 +66,7 @@ string_output(char *data, int size)
} }
if (size < 0) if (size < 0)
{
size = strlen(data); size = strlen(data);
}
/* adjust string length for escapes */ /* adjust string length for escapes */
len = size; len = size;
@@ -90,9 +88,7 @@ string_output(char *data, int size)
break; break;
default: default:
if (NOTPRINTABLE(*p)) if (NOTPRINTABLE(*p))
{
len += 3; len += 3;
}
} }
} }
len++; len++;
@@ -147,9 +143,7 @@ string_output(char *data, int size)
r += 3; r += 3;
} }
else else
{
*r++ = c; *r++ = c;
}
} }
} }
*r = '\0'; *r = '\0';
@@ -192,9 +186,7 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
int len; int len;
if ((str == NULL) || (hdrsize < 0)) if ((str == NULL) || (hdrsize < 0))
{
return (char *) NULL; return (char *) NULL;
}
/* Compute result size */ /* Compute result size */
len = strlen(str); len = strlen(str);
@@ -223,22 +215,16 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
/* result has variable length */ /* result has variable length */
if (size == 0) if (size == 0)
{
size = len + 1; size = len + 1;
}
else else
/* result has variable length with maximum size */ /* result has variable length with maximum size */
if (size < 0) if (size < 0)
{
size = MIN(len, -size) + 1; size = MIN(len, -size) + 1;
}
result = (char *) palloc(hdrsize + size); result = (char *) palloc(hdrsize + size);
memset(result, 0, hdrsize + size); memset(result, 0, hdrsize + size);
if (rtn_size) if (rtn_size)
{
*rtn_size = size; *rtn_size = size;
}
r = result + hdrsize; r = result + hdrsize;
for (p = str; *p;) for (p = str; *p;)
@@ -262,13 +248,9 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
case '7': case '7':
c = VALUE(c); c = VALUE(c);
if (isdigit(*p)) if (isdigit(*p))
{
c = (c << 3) + VALUE(*p++); c = (c << 3) + VALUE(*p++);
}
if (isdigit(*p)) if (isdigit(*p))
{
c = (c << 3) + VALUE(*p++); c = (c << 3) + VALUE(*p++);
}
*r++ = c; *r++ = c;
break; break;
case 'b': case 'b':
@@ -294,9 +276,7 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
} }
} }
else else
{
*r++ = c; *r++ = c;
}
} }
return ((char *) result); return ((char *) result);
@@ -380,9 +360,7 @@ c_textin(char *str)
int len; int len;
if (str == NULL) if (str == NULL)
{
return ((struct varlena *) NULL); return ((struct varlena *) NULL);
}
result = (struct varlena *) string_input(str, 0, VARHDRSZ, &len); result = (struct varlena *) string_input(str, 0, VARHDRSZ, &len);
VARSIZE(result) = len; VARSIZE(result) = len;

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* The old interface functions have been converted to macros * The old interface functions have been converted to macros
@@ -143,9 +143,7 @@ DataFill(char *data,
if (bit != NULL) if (bit != NULL)
{ {
if (bitmask != CSIGNBIT) if (bitmask != CSIGNBIT)
{
bitmask <<= 1; bitmask <<= 1;
}
else else
{ {
bitP += 1; bitP += 1;
@@ -167,13 +165,9 @@ DataFill(char *data,
case -1: case -1:
*infomask |= HEAP_HASVARLENA; *infomask |= HEAP_HASVARLENA;
if (att[i]->attalign == 'd') if (att[i]->attalign == 'd')
{
data = (char *) DOUBLEALIGN(data); data = (char *) DOUBLEALIGN(data);
}
else else
{
data = (char *) INTALIGN(data); data = (char *) INTALIGN(data);
}
data_length = VARSIZE(DatumGetPointer(value[i])); data_length = VARSIZE(DatumGetPointer(value[i]));
memmove(data, DatumGetPointer(value[i]), data_length); memmove(data, DatumGetPointer(value[i]), data_length);
data += data_length; data += data_length;
@@ -239,9 +233,7 @@ heap_attisnull(HeapTuple tup, int attnum)
return (0); return (0);
if (attnum > 0) if (attnum > 0)
{
return (att_isnull(attnum - 1, tup->t_bits)); return (att_isnull(attnum - 1, tup->t_bits));
}
else else
switch (attnum) switch (attnum)
{ {
@@ -513,9 +505,7 @@ nocachegetattr(HeapTuple tup,
tp + att[attnum]->attcacheoff); tp + att[attnum]->attcacheoff);
} }
else if (attnum == 0) else if (attnum == 0)
{
return ((Datum) fetchatt(&(att[0]), (char *) tp)); return ((Datum) fetchatt(&(att[0]), (char *) tp));
}
else if (!HeapTupleAllFixed(tup)) else if (!HeapTupleAllFixed(tup))
{ {
int j = 0; int j = 0;

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* first attribute is always at position zero */
if (attnum == 1) if (attnum == 1)
{
return (Datum) fetchatt(&(att[0]), (char *) tup + data_off); return (Datum) fetchatt(&(att[0]), (char *) tup + data_off);
}
if (att[attnum]->attcacheoff != -1) if (att[attnum]->attcacheoff != -1)
{ {
return (Datum) fetchatt(&(att[attnum]), return (Datum) fetchatt(&(att[attnum]),
@@ -260,9 +258,7 @@ nocache_index_getattr(IndexTuple tup,
tp + att[attnum]->attcacheoff); tp + att[attnum]->attcacheoff);
} }
else if (attnum == 0) else if (attnum == 0)
{
return ((Datum) fetchatt(&(att[0]), (char *) tp)); return ((Datum) fetchatt(&(att[0]), (char *) tp));
}
else if (!IndexTupleAllFixed(tup)) else if (!IndexTupleAllFixed(tup))
{ {
int j = 0; int j = 0;
@@ -482,9 +478,7 @@ CopyIndexTuple(IndexTuple source, IndexTuple *target)
size = IndexTupleSize(source); size = IndexTupleSize(source);
if (*target == NULL) if (*target == NULL)
{
*target = (IndexTuple) palloc(size); *target = (IndexTuple) palloc(size);
}
ret = *target; ret = *target;
memmove((char *) ret, (char *) source, size); memmove((char *) ret, (char *) source, size);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) if (key[0].sk_flags & SK_ISNULL)
{
return (false); return (false);
}
if (key[0].sk_flags & SK_COMMUTE) if (key[0].sk_flags & SK_COMMUTE)
{ {
@@ -79,9 +77,7 @@ index_keytest(IndexTuple tuple,
} }
if (!test == !(key[0].sk_flags & SK_NEGATE)) if (!test == !(key[0].sk_flags & SK_NEGATE))
{
return (false); return (false);
}
scanKeySize -= 1; scanKeySize -= 1;
key++; key++;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be * some of the executor utility code such as "ExecTypeFromTL" should be
@@ -508,9 +508,7 @@ BuildDescForRelation(List *schema, char *relname)
* ---------------- * ----------------
*/ */
if (!strcmp(typename, relname)) if (!strcmp(typename, relname))
{
TupleDescMakeSelfReference(desc, attnum, relname); TupleDescMakeSelfReference(desc, attnum, relname);
}
else else
elog(ERROR, "DefineRelation: no such type %s", elog(ERROR, "DefineRelation: no such type %s",
typename); typename);

View File

@@ -632,9 +632,7 @@ gistAdjustKeys(Relation r,
pfree(datum); pfree(datum);
} }
else else
{
ReleaseBuffer(b); ReleaseBuffer(b);
}
pfree(evec); pfree(evec);
} }
@@ -834,9 +832,7 @@ gistSplit(Relation r,
} }
if ((bufblock = BufferGetBlockNumber(buffer)) != GISTP_ROOT) if ((bufblock = BufferGetBlockNumber(buffer)) != GISTP_ROOT)
{
PageRestoreTempPage(left, p); PageRestoreTempPage(left, p);
}
WriteBuffer(leftbuf); WriteBuffer(leftbuf);
WriteBuffer(rightbuf); WriteBuffer(rightbuf);

View File

@@ -52,13 +52,9 @@ gistgettuple(IndexScanDesc s, ScanDirection dir)
/* not cached, so we'll have to do some work */ /* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData))) if (ItemPointerIsValid(&(s->currentItemData)))
{
res = gistnext(s, dir); res = gistnext(s, dir);
}
else else
{
res = gistfirst(s, dir); res = gistfirst(s, dir);
}
return (res); return (res);
} }
@@ -103,13 +99,9 @@ gistfirst(IndexScanDesc s, ScanDirection dir)
maxoff = PageGetMaxOffsetNumber(p); maxoff = PageGetMaxOffsetNumber(p);
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->gs_child); n = OffsetNumberPrev(stk->gs_child);
}
else else
{
n = OffsetNumberNext(stk->gs_child); n = OffsetNumberNext(stk->gs_child);
}
so->s_stack = stk->gs_parent; so->s_stack = stk->gs_parent;
pfree(stk); pfree(stk);
@@ -163,13 +155,9 @@ gistnext(IndexScanDesc s, ScanDirection dir)
n = ItemPointerGetOffsetNumber(&(s->currentItemData)); n = ItemPointerGetOffsetNumber(&(s->currentItemData));
if (ScanDirectionIsForward(dir)) if (ScanDirectionIsForward(dir))
{
n = OffsetNumberNext(n); n = OffsetNumberNext(n);
}
else else
{
n = OffsetNumberPrev(n); n = OffsetNumberPrev(n);
}
b = ReadBuffer(s->relation, blk); b = ReadBuffer(s->relation, blk);
p = BufferGetPage(b); p = BufferGetPage(b);
@@ -195,13 +183,9 @@ gistnext(IndexScanDesc s, ScanDirection dir)
po = (GISTPageOpaque) PageGetSpecialPointer(p); po = (GISTPageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->gs_child); n = OffsetNumberPrev(stk->gs_child);
}
else else
{
n = OffsetNumberNext(stk->gs_child); n = OffsetNumberNext(stk->gs_child);
}
so->s_stack = stk->gs_parent; so->s_stack = stk->gs_parent;
pfree(stk); pfree(stk);
@@ -235,13 +219,9 @@ gistnext(IndexScanDesc s, ScanDirection dir)
po = (GISTPageOpaque) PageGetSpecialPointer(p); po = (GISTPageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = PageGetMaxOffsetNumber(p); n = PageGetMaxOffsetNumber(p);
}
else else
{
n = FirstOffsetNumber; n = FirstOffsetNumber;
}
} }
} }
} }
@@ -296,9 +276,7 @@ gistindex_keytest(IndexTuple tuple,
} }
if (!test == !(key[0].sk_flags & SK_NEGATE)) if (!test == !(key[0].sk_flags & SK_NEGATE))
{
return (false); return (false);
}
scanKeySize -= 1; scanKeySize -= 1;
key++; key++;
@@ -343,13 +321,9 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
break; break;
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(n); n = OffsetNumberPrev(n);
}
else else
{
n = OffsetNumberNext(n); n = OffsetNumberNext(n);
}
} }
return (n); return (n);
@@ -405,9 +379,7 @@ gistheapptr(Relation r, ItemPointer itemp)
ReleaseBuffer(b); ReleaseBuffer(b);
} }
else else
{
ItemPointerSetInvalid(ip); ItemPointerSetInvalid(ip);
}
return (ip); return (ip);
} }

View File

@@ -102,17 +102,11 @@ gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
* Set flags. * Set flags.
*/ */
if (RelationGetNumberOfBlocks(s->relation) == 0) if (RelationGetNumberOfBlocks(s->relation) == 0)
{
s->flags = ScanUnmarked; s->flags = ScanUnmarked;
}
else if (fromEnd) else if (fromEnd)
{
s->flags = ScanUnmarked | ScanUncheckedPrevious; s->flags = ScanUnmarked | ScanUncheckedPrevious;
}
else else
{
s->flags = ScanUnmarked | ScanUncheckedNext; s->flags = ScanUnmarked | ScanUncheckedNext;
}
s->scanFromEnd = fromEnd; s->scanFromEnd = fromEnd;
@@ -276,9 +270,7 @@ gistdropscan(IndexScanDesc s)
for (l = GISTScans; for (l = GISTScans;
l != (GISTScanList) NULL && l->gsl_scan != s; l != (GISTScanList) NULL && l->gsl_scan != s;
l = l->gsl_next) l = l->gsl_next)
{
prev = l; prev = l;
}
if (l == (GISTScanList) NULL) if (l == (GISTScanList) NULL)
elog(ERROR, "GiST scan list corrupted -- cannot find 0x%lx", s); elog(ERROR, "GiST scan list corrupted -- cannot find 0x%lx", s);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 || if (do_expand ||
(metap->hashm_nkeys / (metap->hashm_maxbucket + 1)) (metap->hashm_nkeys / (metap->hashm_maxbucket + 1))
> metap->hashm_ffactor) > metap->hashm_ffactor)
{
_hash_expandtable(rel, metabuf); _hash_expandtable(rel, metabuf);
}
_hash_relbuf(rel, metabuf, HASH_READ); _hash_relbuf(rel, metabuf, HASH_READ);
return (res); return (res);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Overflow pages look like ordinary relation pages. * Overflow pages look like ordinary relation pages.
@@ -64,9 +64,7 @@ _hash_addovflpage(Relation rel, Buffer *metabufp, Buffer buf)
/* allocate an empty overflow page */ /* allocate an empty overflow page */
oaddr = _hash_getovfladdr(rel, metabufp); oaddr = _hash_getovfladdr(rel, metabufp);
if (oaddr == InvalidOvflAddress) if (oaddr == InvalidOvflAddress)
{
elog(ERROR, "_hash_addovflpage: problem with _hash_getovfladdr."); elog(ERROR, "_hash_addovflpage: problem with _hash_getovfladdr.");
}
ovflblkno = OADDR_TO_BLKNO(OADDR_OF(SPLITNUM(oaddr), OPAGENUM(oaddr))); ovflblkno = OADDR_TO_BLKNO(OADDR_OF(SPLITNUM(oaddr), OPAGENUM(oaddr)));
Assert(BlockNumberIsValid(ovflblkno)); Assert(BlockNumberIsValid(ovflblkno));
ovflbuf = _hash_getbuf(rel, ovflblkno, HASH_WRITE); ovflbuf = _hash_getbuf(rel, ovflblkno, HASH_WRITE);
@@ -171,9 +169,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
if (offset > SPLITMASK) if (offset > SPLITMASK)
{ {
if (++splitnum >= NCACHED) if (++splitnum >= NCACHED)
{
elog(ERROR, OVMSG); elog(ERROR, OVMSG);
}
metap->OVFL_POINT = splitnum; metap->OVFL_POINT = splitnum;
metap->SPARES[splitnum] = metap->SPARES[splitnum - 1]; metap->SPARES[splitnum] = metap->SPARES[splitnum - 1];
metap->SPARES[splitnum - 1]--; metap->SPARES[splitnum - 1]--;
@@ -189,9 +185,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
free_page++; free_page++;
if (free_page >= NCACHED) if (free_page >= NCACHED)
{
elog(ERROR, OVMSG); elog(ERROR, OVMSG);
}
/* /*
* This is tricky. The 1 indicates that you want the new page * 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), if (_hash_initbitmap(rel, metap, OADDR_OF(splitnum, offset),
1, free_page)) 1, free_page))
{
elog(ERROR, "overflow_page: problem with _hash_initbitmap."); elog(ERROR, "overflow_page: problem with _hash_initbitmap.");
}
metap->SPARES[splitnum]++; metap->SPARES[splitnum]++;
offset++; offset++;
if (offset > SPLITMASK) if (offset > SPLITMASK)
{ {
if (++splitnum >= NCACHED) if (++splitnum >= NCACHED)
{
elog(ERROR, OVMSG); elog(ERROR, OVMSG);
}
metap->OVFL_POINT = splitnum; metap->OVFL_POINT = splitnum;
metap->SPARES[splitnum] = metap->SPARES[splitnum - 1]; metap->SPARES[splitnum] = metap->SPARES[splitnum - 1];
metap->SPARES[splitnum - 1]--; metap->SPARES[splitnum - 1]--;
@@ -252,18 +242,14 @@ found:
bit = 1 + bit + (i * BMPGSZ_BIT(metap)); bit = 1 + bit + (i * BMPGSZ_BIT(metap));
if (bit >= metap->LAST_FREED) if (bit >= metap->LAST_FREED)
{
metap->LAST_FREED = bit - 1; metap->LAST_FREED = bit - 1;
}
/* Calculate the split number for this page */ /* Calculate the split number for this page */
for (i = 0; (i < splitnum) && (bit > metap->SPARES[i]); i++) for (i = 0; (i < splitnum) && (bit > metap->SPARES[i]); i++)
; ;
offset = (i ? bit - metap->SPARES[i - 1] : bit); offset = (i ? bit - metap->SPARES[i - 1] : bit);
if (offset >= SPLITMASK) if (offset >= SPLITMASK)
{
elog(ERROR, OVMSG); elog(ERROR, OVMSG);
}
/* initialize this page */ /* initialize this page */
oaddr = OADDR_OF(i, offset); oaddr = OADDR_OF(i, offset);
@@ -381,9 +367,7 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
(splitnum ? metap->SPARES[splitnum - 1] : 0) + (addr & SPLITMASK) - 1; (splitnum ? metap->SPARES[splitnum - 1] : 0) + (addr & SPLITMASK) - 1;
if (ovflpgno < metap->LAST_FREED) if (ovflpgno < metap->LAST_FREED)
{
metap->LAST_FREED = ovflpgno; metap->LAST_FREED = ovflpgno;
}
bitmappage = (ovflpgno >> (metap->BSHIFT + BYTE_TO_BIT)); bitmappage = (ovflpgno >> (metap->BSHIFT + BYTE_TO_BIT));
bitmapbit = ovflpgno & (BMPGSZ_BIT(metap) - 1); bitmapbit = ovflpgno & (BMPGSZ_BIT(metap) - 1);
@@ -403,13 +387,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
* return that buffer with a write lock. * return that buffer with a write lock.
*/ */
if (BlockNumberIsValid(nextblkno)) if (BlockNumberIsValid(nextblkno))
{
return (_hash_getbuf(rel, nextblkno, HASH_WRITE)); return (_hash_getbuf(rel, nextblkno, HASH_WRITE));
}
else else
{
return (InvalidBuffer); return (InvalidBuffer);
}
} }
@@ -543,9 +523,7 @@ _hash_squeezebucket(Relation rel,
{ {
rblkno = ropaque->hasho_nextblkno; rblkno = ropaque->hasho_nextblkno;
if (ropaque != wopaque) if (ropaque != wopaque)
{
_hash_relbuf(rel, rbuf, HASH_WRITE); _hash_relbuf(rel, rbuf, HASH_WRITE);
}
rbuf = _hash_getbuf(rel, rblkno, HASH_WRITE); rbuf = _hash_getbuf(rel, rblkno, HASH_WRITE);
rpage = BufferGetPage(rbuf); rpage = BufferGetPage(rbuf);
_hash_checkpage(rpage, LH_OVERFLOW_PAGE); _hash_checkpage(rpage, LH_OVERFLOW_PAGE);
@@ -621,9 +599,7 @@ _hash_squeezebucket(Relation rel,
*/ */
rbuf = _hash_freeovflpage(rel, rbuf); rbuf = _hash_freeovflpage(rel, rbuf);
if (BufferIsValid(rbuf)) if (BufferIsValid(rbuf))
{
_hash_relbuf(rel, rbuf, HASH_WRITE); _hash_relbuf(rel, rbuf, HASH_WRITE);
}
if (rblkno == wblkno) if (rblkno == wblkno)
{ {

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Postgres hash pages look like ordinary relation pages. The opaque * Postgres hash pages look like ordinary relation pages. The opaque
@@ -106,9 +106,7 @@ _hash_metapinit(Relation rel)
if ((1 << i) < (metap->hashm_bsize - if ((1 << i) < (metap->hashm_bsize -
(DOUBLEALIGN(sizeof(PageHeaderData)) + (DOUBLEALIGN(sizeof(PageHeaderData)) +
DOUBLEALIGN(sizeof(HashPageOpaqueData))))) DOUBLEALIGN(sizeof(HashPageOpaqueData)))))
{
break; break;
}
} }
Assert(i); Assert(i);
metap->hashm_bmsize = 1 << i; metap->hashm_bmsize = 1 << i;
@@ -191,9 +189,7 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
Buffer buf; Buffer buf;
if (blkno == P_NEW) if (blkno == P_NEW)
{
elog(ERROR, "_hash_getbuf: internal error: hash AM does not use P_NEW"); elog(ERROR, "_hash_getbuf: internal error: hash AM does not use P_NEW");
}
switch (access) switch (access)
{ {
case HASH_WRITE: case HASH_WRITE:
@@ -395,14 +391,10 @@ _hash_pagedel(Relation rel, ItemPointer tid)
{ {
buf = _hash_freeovflpage(rel, buf); buf = _hash_freeovflpage(rel, buf);
if (BufferIsValid(buf)) if (BufferIsValid(buf))
{
_hash_relbuf(rel, buf, HASH_WRITE); _hash_relbuf(rel, buf, HASH_WRITE);
}
} }
else else
{
_hash_relbuf(rel, buf, HASH_WRITE); _hash_relbuf(rel, buf, HASH_WRITE);
}
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_WRITE); metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_WRITE);
metap = (HashMetaPage) BufferGetPage(metabuf); metap = (HashMetaPage) BufferGetPage(metabuf);
@@ -545,9 +537,7 @@ _hash_splitpage(Relation rel,
opage = BufferGetPage(obuf); opage = BufferGetPage(obuf);
_hash_checkpage(opage, LH_OVERFLOW_PAGE); _hash_checkpage(opage, LH_OVERFLOW_PAGE);
if (PageIsEmpty(opage)) if (PageIsEmpty(opage))
{
elog(ERROR, "_hash_splitpage: empty overflow page %d", oblkno); elog(ERROR, "_hash_splitpage: empty overflow page %d", oblkno);
}
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage); oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Because we can be doing an index scan on a relation while we * Because we can be doing an index scan on a relation while we
@@ -71,9 +71,7 @@ _hash_dropscan(IndexScanDesc scan)
for (chk = HashScans; for (chk = HashScans;
chk != (HashScanList) NULL && chk->hashsl_scan != scan; chk != (HashScanList) NULL && chk->hashsl_scan != scan;
chk = chk->hashsl_next) chk = chk->hashsl_next)
{
last = chk; last = chk;
}
if (chk == (HashScanList) NULL) if (chk == (HashScanList) NULL)
elog(ERROR, "hash scan list trashed; can't find 0x%lx", scan); elog(ERROR, "hash scan list trashed; can't find 0x%lx", scan);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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; bucket = 0;
} }
else else
{
bucket = _hash_call(rel, metap, keyDatum); bucket = _hash_call(rel, metap, keyDatum);
}
blkno = BUCKET_TO_BLKNO(bucket); 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. * next tuple, we come back with a lock on that buffer.
*/ */
if (!_hash_step(scan, &buf, dir, metabuf)) if (!_hash_step(scan, &buf, dir, metabuf))
{
return ((RetrieveIndexResult) NULL); return ((RetrieveIndexResult) NULL);
}
/* if we're here, _hash_step found a valid tuple */ /* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData); current = &(scan->currentItemData);
@@ -225,9 +221,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
if (PageIsEmpty(page)) if (PageIsEmpty(page))
{ {
if (BlockNumberIsValid(opaque->hasho_nextblkno)) if (BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque); _hash_readnext(rel, &buf, &page, &opaque);
}
else else
{ {
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);
@@ -249,15 +243,11 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{ {
while (BlockNumberIsValid(opaque->hasho_nextblkno)) while (BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque); _hash_readnext(rel, &buf, &page, &opaque);
}
} }
if (!_hash_step(scan, &buf, dir, metabuf)) if (!_hash_step(scan, &buf, dir, metabuf))
{
return ((RetrieveIndexResult) NULL); return ((RetrieveIndexResult) NULL);
}
/* if we're here, _hash_step found a valid tuple */ /* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData); current = &(scan->currentItemData);
@@ -321,13 +311,9 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
*/ */
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
if (ItemPointerIsValid(current)) if (ItemPointerIsValid(current))
{
offnum = ItemPointerGetOffsetNumber(current); offnum = ItemPointerGetOffsetNumber(current);
}
else else
{
offnum = InvalidOffsetNumber; offnum = InvalidOffsetNumber;
}
/* /*
* 'offnum' now points to the last tuple we have seen (if any). * '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); Assert(opaque->hasho_bucket == bucket);
while (PageIsEmpty(page) && while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno)) BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque); _hash_readnext(rel, &buf, &page, &opaque);
}
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
offnum = FirstOffsetNumber; offnum = FirstOffsetNumber;
} }
@@ -420,9 +404,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
opaque = (HashPageOpaque) PageGetSpecialPointer(page); opaque = (HashPageOpaque) PageGetSpecialPointer(page);
Assert(opaque->hasho_bucket == bucket); Assert(opaque->hasho_bucket == bucket);
while (BlockNumberIsValid(opaque->hasho_nextblkno)) while (BlockNumberIsValid(opaque->hasho_nextblkno))
{
_hash_readnext(rel, &buf, &page, &opaque); _hash_readnext(rel, &buf, &page, &opaque);
}
maxoff = offnum = PageGetMaxOffsetNumber(page); maxoff = offnum = PageGetMaxOffsetNumber(page);
} }
else else

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * INTERFACE ROUTINES
@@ -168,9 +168,7 @@ static void
unpinsdesc(HeapScanDesc sdesc) unpinsdesc(HeapScanDesc sdesc)
{ {
if (BufferIsValid(sdesc->rs_pbuf)) if (BufferIsValid(sdesc->rs_pbuf))
{
ReleaseBuffer(sdesc->rs_pbuf); ReleaseBuffer(sdesc->rs_pbuf);
}
/* ------------------------------------ /* ------------------------------------
* Scan will pin buffer one for each non-NULL tuple pointer * Scan will pin buffer one for each non-NULL tuple pointer
@@ -179,14 +177,10 @@ unpinsdesc(HeapScanDesc sdesc)
* ------------------------------------ * ------------------------------------
*/ */
if (BufferIsValid(sdesc->rs_cbuf)) if (BufferIsValid(sdesc->rs_cbuf))
{
ReleaseBuffer(sdesc->rs_cbuf); ReleaseBuffer(sdesc->rs_cbuf);
}
if (BufferIsValid(sdesc->rs_nbuf)) if (BufferIsValid(sdesc->rs_nbuf))
{
ReleaseBuffer(sdesc->rs_nbuf); ReleaseBuffer(sdesc->rs_nbuf);
}
} }
/* ------------------------------------------ /* ------------------------------------------
@@ -262,9 +256,7 @@ heapgettup(Relation relation,
#endif /* !defined(HEAPDEBUGALL) */ #endif /* !defined(HEAPDEBUGALL) */
if (!ItemPointerIsValid(tid)) if (!ItemPointerIsValid(tid))
{
Assert(!PointerIsValid(tid)); Assert(!PointerIsValid(tid));
}
/* ---------------- /* ----------------
* return null immediately if relation is empty * return null immediately if relation is empty
@@ -313,9 +305,7 @@ heapgettup(Relation relation,
* ---------------- * ----------------
*/ */
if (ItemPointerIsValid(tid) == false) if (ItemPointerIsValid(tid) == false)
{
tid = NULL; tid = NULL;
}
if (tid == NULL) if (tid == NULL)
{ {
page = pages - 1; /* final page */ page = pages - 1; /* final page */
@@ -333,9 +323,7 @@ heapgettup(Relation relation,
*b = RelationGetBufferWithBuffer(relation, page, *b); *b = RelationGetBufferWithBuffer(relation, page, *b);
#ifndef NO_BUFFERISVALID #ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b)) if (!BufferIsValid(*b))
{
elog(ERROR, "heapgettup: failed ReadBuffer"); elog(ERROR, "heapgettup: failed ReadBuffer");
}
#endif #endif
dp = (Page) BufferGetPage(*b); dp = (Page) BufferGetPage(*b);
@@ -380,9 +368,7 @@ heapgettup(Relation relation,
*b = RelationGetBufferWithBuffer(relation, page, *b); *b = RelationGetBufferWithBuffer(relation, page, *b);
#ifndef NO_BUFFERISVALID #ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b)) if (!BufferIsValid(*b))
{
elog(ERROR, "heapgettup: failed ReadBuffer"); elog(ERROR, "heapgettup: failed ReadBuffer");
}
#endif #endif
dp = (Page) BufferGetPage(*b); dp = (Page) BufferGetPage(*b);
@@ -398,13 +384,9 @@ heapgettup(Relation relation,
*/ */
lpp = PageGetItemId(dp, lineoff); lpp = PageGetItemId(dp, lineoff);
if (dir < 0) if (dir < 0)
{
linesleft = lineoff - 1; linesleft = lineoff - 1;
}
else else
{
linesleft = lines - lineoff; linesleft = lines - lineoff;
}
/* ---------------- /* ----------------
* advance the scan until we find a qualifying tuple or * advance the scan until we find a qualifying tuple or
@@ -476,21 +458,15 @@ heapgettup(Relation relation,
#ifndef NO_BUFFERISVALID #ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b)) if (!BufferIsValid(*b))
{
elog(ERROR, "heapgettup: failed ReadBuffer"); elog(ERROR, "heapgettup: failed ReadBuffer");
}
#endif #endif
dp = (Page) BufferGetPage(*b); dp = (Page) BufferGetPage(*b);
lines = lineoff = PageGetMaxOffsetNumber((Page) dp); lines = lineoff = PageGetMaxOffsetNumber((Page) dp);
linesleft = lines - 1; linesleft = lines - 1;
if (dir < 0) if (dir < 0)
{
lpp = PageGetItemId(dp, lineoff); lpp = PageGetItemId(dp, lineoff);
}
else else
{
lpp = PageGetItemId(dp, FirstOffsetNumber); lpp = PageGetItemId(dp, FirstOffsetNumber);
}
} }
} }
@@ -544,9 +520,7 @@ heap_open(Oid relationId)
r = (Relation) RelationIdGetRelation(relationId); r = (Relation) RelationIdGetRelation(relationId);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX) if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
{
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data); elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
}
return (r); return (r);
} }
@@ -573,9 +547,7 @@ heap_openr(char *relationName)
r = RelationNameGetRelation(relationName); r = RelationNameGetRelation(relationName);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX) if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
{
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data); elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
}
return (r); return (r);
} }
@@ -1094,9 +1066,7 @@ heap_fetch(Relation relation,
*/ */
if (PointerIsValid(b)) if (PointerIsValid(b))
{
*b = buffer; *b = buffer;
}
else else
{ {
tuple = heap_copytuple(tuple); 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)) if ((unsigned) DOUBLEALIGN(tup->t_len) <= PageGetFreeSpace((Page) dp))
{
RelationPutHeapTuple(relation, BufferGetBlockNumber(buffer), tup); RelationPutHeapTuple(relation, BufferGetBlockNumber(buffer), tup);
}
else else
{ {
/* ---------------- /* ----------------
@@ -1500,29 +1468,17 @@ heap_markpos(HeapScanDesc sdesc)
* ---------------- * ----------------
*/ */
if (sdesc->rs_ptup != NULL) if (sdesc->rs_ptup != NULL)
{
sdesc->rs_mptid = sdesc->rs_ptup->t_ctid; sdesc->rs_mptid = sdesc->rs_ptup->t_ctid;
}
else else
{
ItemPointerSetInvalid(&sdesc->rs_mptid); ItemPointerSetInvalid(&sdesc->rs_mptid);
}
if (sdesc->rs_ctup != NULL) if (sdesc->rs_ctup != NULL)
{
sdesc->rs_mctid = sdesc->rs_ctup->t_ctid; sdesc->rs_mctid = sdesc->rs_ctup->t_ctid;
}
else else
{
ItemPointerSetInvalid(&sdesc->rs_mctid); ItemPointerSetInvalid(&sdesc->rs_mctid);
}
if (sdesc->rs_ntup != NULL) if (sdesc->rs_ntup != NULL)
{
sdesc->rs_mntid = sdesc->rs_ntup->t_ctid; sdesc->rs_mntid = sdesc->rs_ntup->t_ctid;
}
else else
{
ItemPointerSetInvalid(&sdesc->rs_mntid); ItemPointerSetInvalid(&sdesc->rs_mntid);
}
} }
/* ---------------- /* ----------------
@@ -1568,9 +1524,7 @@ heap_restrpos(HeapScanDesc sdesc)
sdesc->rs_nbuf = InvalidBuffer; sdesc->rs_nbuf = InvalidBuffer;
if (!ItemPointerIsValid(&sdesc->rs_mptid)) if (!ItemPointerIsValid(&sdesc->rs_mptid))
{
sdesc->rs_ptup = NULL; sdesc->rs_ptup = NULL;
}
else else
{ {
sdesc->rs_ptup = (HeapTuple) sdesc->rs_ptup = (HeapTuple)
@@ -1584,9 +1538,7 @@ heap_restrpos(HeapScanDesc sdesc)
} }
if (!ItemPointerIsValid(&sdesc->rs_mctid)) if (!ItemPointerIsValid(&sdesc->rs_mctid))
{
sdesc->rs_ctup = NULL; sdesc->rs_ctup = NULL;
}
else else
{ {
sdesc->rs_ctup = (HeapTuple) sdesc->rs_ctup = (HeapTuple)
@@ -1600,9 +1552,7 @@ heap_restrpos(HeapScanDesc sdesc)
} }
if (!ItemPointerIsValid(&sdesc->rs_mntid)) if (!ItemPointerIsValid(&sdesc->rs_mntid))
{
sdesc->rs_ntup = NULL; sdesc->rs_ntup = NULL;
}
else else
{ {
sdesc->rs_ntup = (HeapTuple) sdesc->rs_ntup = (HeapTuple)

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* many of the old access method routines have been turned into * many of the old access method routines have been turned into
@@ -117,13 +117,9 @@ RelationGetIndexScan(Relation relation,
ItemPointerSetInvalid(&scan->nextMarkData); ItemPointerSetInvalid(&scan->nextMarkData);
if (numberOfKeys > 0) if (numberOfKeys > 0)
{
scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * numberOfKeys); scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * numberOfKeys);
}
else else
{
scan->keyData = NULL; scan->keyData = NULL;
}
index_rescan(scan, scanFromEnd, key); index_rescan(scan, scanFromEnd, key);
@@ -224,13 +220,9 @@ IndexScanMarkPosition(IndexScanDesc scan)
index_getnext(scan, BackwardScanDirection); index_getnext(scan, BackwardScanDirection);
if (result != NULL) if (result != NULL)
{
scan->previousItemData = result->index_iptr; scan->previousItemData = result->index_iptr;
}
else else
{
ItemPointerSetInvalid(&scan->previousItemData); ItemPointerSetInvalid(&scan->previousItemData);
}
} }
else if (scan->flags & ScanUncheckedNext) else if (scan->flags & ScanUncheckedNext)
@@ -239,13 +231,9 @@ IndexScanMarkPosition(IndexScanDesc scan)
index_getnext(scan, ForwardScanDirection); index_getnext(scan, ForwardScanDirection);
if (result != NULL) if (result != NULL)
{
scan->nextItemData = result->index_iptr; scan->nextItemData = result->index_iptr;
}
else else
{
ItemPointerSetInvalid(&scan->nextItemData); ItemPointerSetInvalid(&scan->nextItemData);
}
} }
scan->previousMarkData = scan->previousItemData; scan->previousMarkData = scan->previousItemData;

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) for (index = 0; index < evaluation->maxStrategy; index += 1)
{ {
if (strategyMap->entry[index].sk_procedure == procedure) if (strategyMap->entry[index].sk_procedure == procedure)
{
break; break;
}
} }
if (index == evaluation->maxStrategy) if (index == evaluation->maxStrategy)
@@ -347,9 +345,7 @@ RelationGetStrategy(Relation relation,
if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy)) if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy))
{ {
if (!StrategyNumberIsValid(strategy)) if (!StrategyNumberIsValid(strategy))
{
elog(ERROR, "RelationGetStrategy: corrupted evaluation"); elog(ERROR, "RelationGetStrategy: corrupted evaluation");
}
} }
return strategy; return strategy;
@@ -465,9 +461,7 @@ RelationInvokeStrategy(Relation relation,
(*termP)->operatorData[index].strategy); (*termP)->operatorData[index].strategy);
if (!RegProcedureIsValid(entry->sk_procedure)) if (!RegProcedureIsValid(entry->sk_procedure))
{
break; break;
}
} }
if (index == (*termP)->degree) if (index == (*termP)->degree)
@@ -582,9 +576,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
if (!OidIsValid(iform->indkey[attributeIndex])) if (!OidIsValid(iform->indkey[attributeIndex]))
{ {
if (attributeIndex == 0) if (attributeIndex == 0)
{
elog(ERROR, "IndexSupportInitialize: no pg_index tuple"); elog(ERROR, "IndexSupportInitialize: no pg_index tuple");
}
break; break;
} }
@@ -621,9 +613,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)]; loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)];
for (support = maxSupportNumber; --support >= 0;) for (support = maxSupportNumber; --support >= 0;)
{
loc[support] = InvalidOid; loc[support] = InvalidOid;
}
entry[1].sk_argument = entry[1].sk_argument =
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]); ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* get next offnum */
if (offset < maxoff) if (offset < maxoff)
{
offset = OffsetNumberNext(offset); offset = OffsetNumberNext(offset);
}
else else
{ /* move right ? */ { /* move right ? */
if (P_RIGHTMOST(opaque)) if (P_RIGHTMOST(opaque))
@@ -906,13 +904,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
*/ */
if (P_RIGHTMOST(ropaque)) if (P_RIGHTMOST(ropaque))
{
itemid = PageGetItemId(rightpage, P_HIKEY); itemid = PageGetItemId(rightpage, P_HIKEY);
}
else else
{
itemid = PageGetItemId(rightpage, P_FIRSTKEY); itemid = PageGetItemId(rightpage, P_FIRSTKEY);
}
itemsz = ItemIdGetLength(itemid); itemsz = ItemIdGetLength(itemid);
item = (BTItem) PageGetItem(rightpage, itemid); item = (BTItem) PageGetItem(rightpage, itemid);
@@ -1178,9 +1172,7 @@ _bt_pgaddtup(Relation rel,
first = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; first = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (afteritem == (BTItem) NULL) if (afteritem == (BTItem) NULL)
{
itup_off = _bt_binsrch(rel, buf, keysz, itup_scankey, BT_INSERTION); itup_off = _bt_binsrch(rel, buf, keysz, itup_scankey, BT_INSERTION);
}
else else
{ {
itup_off = first; itup_off = first;
@@ -1358,9 +1350,7 @@ _bt_itemcmp(Relation rel,
compare = (strat == BTLessStrategyNumber) ? true : false; compare = (strat == BTLessStrategyNumber) ? true : false;
} }
else else
{
compare = _bt_invokestrat(rel, i, strat, attrDatum1, attrDatum2); compare = _bt_invokestrat(rel, i, strat, attrDatum1, attrDatum2);
}
if (compare) /* true for one of ">, <, =" */ if (compare) /* true for one of ">, <, =" */
{ {
@@ -1430,9 +1420,7 @@ _bt_updateitem(Relation rel,
/* this should never happen (in theory) */ /* this should never happen (in theory) */
if (!BTItemSame(item, oldItem)) if (!BTItemSame(item, oldItem))
{
elog(FATAL, "_bt_getstackbuf was lying!!"); elog(FATAL, "_bt_getstackbuf was lying!!");
}
/* /*
* It's defined by caller (_bt_insertonpg) * It's defined by caller (_bt_insertonpg)

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* This file contains only the public interface routines. * This file contains only the public interface routines.
@@ -267,20 +267,14 @@ btbuild(Relation heap,
* into the btree. * into the btree.
*/ */
if (usefast) if (usefast)
{
_bt_spool(index, btitem, spool); _bt_spool(index, btitem, spool);
}
else else
{
res = _bt_doinsert(index, btitem, isunique, heap); res = _bt_doinsert(index, btitem, isunique, heap);
}
pfree(btitem); pfree(btitem);
pfree(itup); pfree(itup);
if (res) if (res)
{
pfree(res); pfree(res);
}
} }
/* okay, all heap tuples are indexed */ /* okay, all heap tuples are indexed */

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
@@ -72,9 +72,7 @@ _bt_dropscan(IndexScanDesc scan)
for (chk = BTScans; for (chk = BTScans;
chk != (BTScanList) NULL && chk->btsl_scan != scan; chk != (BTScanList) NULL && chk->btsl_scan != scan;
chk = chk->btsl_next) chk = chk->btsl_next)
{
last = chk; last = chk;
}
if (chk == (BTScanList) NULL) if (chk == (BTScanList) NULL)
elog(ERROR, "btree scan list trashed; can't find 0x%lx", scan); elog(ERROR, "btree scan list trashed; can't find 0x%lx", scan);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 while (offnum > limit
&& _bt_compare(rel, itupdesc, page, && _bt_compare(rel, itupdesc, page,
keysz, scankey, OffsetNumberPrev(offnum)) == 0) keysz, scankey, OffsetNumberPrev(offnum)) == 0)
{
offnum = OffsetNumberPrev(offnum); offnum = OffsetNumberPrev(offnum);
}
return (offnum); return (offnum);
} }
@@ -616,9 +614,7 @@ _bt_compare(Relation rel,
* - see new comments above... * - see new comments above...
*/ */
if (!P_RIGHTMOST(opaque)) if (!P_RIGHTMOST(opaque))
{
elog(ERROR, "_bt_compare: invalid comparison to high key"); elog(ERROR, "_bt_compare: invalid comparison to high key");
}
#if 0 #if 0
@@ -634,9 +630,7 @@ _bt_compare(Relation rel,
if (_bt_skeycmp(rel, keysz, scankey, page, itemid, if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber)) BTEqualStrategyNumber))
{
return (0); return (0);
}
return (1); return (1);
#endif #endif
} }
@@ -676,9 +670,7 @@ _bt_compare(Relation rel,
tmpres = (long) -1; /* NOT_NULL "<" NULL */ tmpres = (long) -1; /* NOT_NULL "<" NULL */
} }
else else
{
tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum); tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
}
result = tmpres; result = tmpres;
/* if the keys are unequal, return the difference */ /* if the keys are unequal, return the difference */
@@ -1090,9 +1082,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (ScanDirectionIsForward(dir)) if (ScanDirectionIsForward(dir))
{ {
if (!PageIsEmpty(page) && offnum < maxoff) if (!PageIsEmpty(page) && offnum < maxoff)
{
offnum = OffsetNumberNext(offnum); offnum = OffsetNumberNext(offnum);
}
else else
{ {
@@ -1119,9 +1109,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (!PageIsEmpty(page) && start <= maxoff) if (!PageIsEmpty(page) && start <= maxoff)
{
break; break;
}
else else
{ {
blkno = opaque->btpo_next; blkno = opaque->btpo_next;
@@ -1145,9 +1133,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (offnum > start) if (offnum > start)
{
offnum = OffsetNumberPrev(offnum); offnum = OffsetNumberPrev(offnum);
}
else else
{ {
@@ -1196,9 +1182,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
/* anything to look at here? */ /* anything to look at here? */
if (!PageIsEmpty(page) && maxoff >= start) if (!PageIsEmpty(page) && maxoff >= start)
{
break; break;
}
else else
{ {
blkno = opaque->btpo_prev; 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 we've hit end of scan we don't have to do any work */
if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque)) if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
{
return (false); return (false);
}
else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque)) else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque))
{
return (false); return (false);
}
/* /*
* Okay, it's off the page; let _bt_step() do the hard work, and we'll * Okay, it's off the page; let _bt_step() do the hard work, and we'll
@@ -1371,13 +1351,9 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
break; break;
if (ScanDirectionIsForward(dir)) if (ScanDirectionIsForward(dir))
{
offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
}
else else
{
offnum = PageGetMaxOffsetNumber(page); offnum = PageGetMaxOffsetNumber(page);
}
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum)); btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &(btitem->bti_itup); itup = &(btitem->bti_itup);
@@ -1461,9 +1437,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
} }
/* new stuff ends here */ /* new stuff ends here */
else else
{
ItemPointerSet(current, blkno, start); ItemPointerSet(current, blkno, start);
}
} }
else if (ScanDirectionIsBackward(dir)) else if (ScanDirectionIsBackward(dir))
{ {
@@ -1510,9 +1484,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
} }
} }
else else
{
elog(ERROR, "Illegal scan direction %d", dir); elog(ERROR, "Illegal scan direction %d", dir);
}
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, start)); btitem = (BTItem) PageGetItem(page, PageGetItemId(page, start));
itup = &(btitem->bti_itup); itup = &(btitem->bti_itup);

View File

@@ -5,7 +5,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *
@@ -288,9 +288,7 @@ _bt_pqsift(BTPriQueue *q, int parent)
if (child < q->btpq_nelem - 1) if (child < q->btpq_nelem - 1)
{ {
if (GREATER(&(q->btpq_queue[child]), &(q->btpq_queue[child + 1]))) if (GREATER(&(q->btpq_queue[child]), &(q->btpq_queue[child + 1])))
{
++child; ++child;
}
} }
if (GREATER(&(q->btpq_queue[parent]), &(q->btpq_queue[child]))) if (GREATER(&(q->btpq_queue[parent]), &(q->btpq_queue[child])))
{ {
@@ -300,9 +298,7 @@ _bt_pqsift(BTPriQueue *q, int parent)
parent = child; parent = child;
} }
else else
{
parent = child + 1; parent = child + 1;
}
} }
} }
@@ -331,18 +327,14 @@ _bt_pqadd(BTPriQueue *q, BTPriQueueElem *e)
parent; parent;
if (q->btpq_nelem >= MAXELEM) if (q->btpq_nelem >= MAXELEM)
{
elog(ERROR, "_bt_pqadd: queue overflow"); elog(ERROR, "_bt_pqadd: queue overflow");
}
child = q->btpq_nelem++; child = q->btpq_nelem++;
while (child > 0) while (child > 0)
{ {
parent = child / 2; parent = child / 2;
if (GREATER(e, &(q->btpq_queue[parent]))) if (GREATER(e, &(q->btpq_queue[parent])))
{
break; break;
}
else else
{ {
q->btpq_queue[child] = q->btpq_queue[parent]; /* struct = */ q->btpq_queue[child] = q->btpq_queue[parent]; /* struct = */
@@ -424,9 +416,7 @@ _bt_tapecreate(char *fname)
BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock)); BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
if (tape == (BTTapeBlock *) NULL) if (tape == (BTTapeBlock *) NULL)
{
elog(ERROR, "_bt_tapecreate: out of memory"); elog(ERROR, "_bt_tapecreate: out of memory");
}
tape->bttb_magic = BTTAPEMAGIC; tape->bttb_magic = BTTAPEMAGIC;
@@ -516,9 +506,7 @@ _bt_tapenext(BTTapeBlock *tape, char **pos)
BTItem bti; BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top) if (*pos >= tape->bttb_data + tape->bttb_top)
{
return ((BTItem) NULL); return ((BTItem) NULL);
}
bti = (BTItem) *pos; bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti); itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz); *pos += DOUBLEALIGN(itemsz);
@@ -561,9 +549,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
char *fname = (char *) palloc(sizeof(TAPETEMP) + 1); char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
if (btspool == (BTSpool *) NULL || fname == (char *) NULL) if (btspool == (BTSpool *) NULL || fname == (char *) NULL)
{
elog(ERROR, "_bt_spoolinit: out of memory"); elog(ERROR, "_bt_spoolinit: out of memory");
}
MemSet((char *) btspool, 0, sizeof(BTSpool)); MemSet((char *) btspool, 0, sizeof(BTSpool));
btspool->bts_ntapes = ntapes; btspool->bts_ntapes = ntapes;
btspool->bts_tape = 0; btspool->bts_tape = 0;
@@ -575,9 +561,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes); (BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
if (btspool->bts_itape == (BTTapeBlock **) NULL || if (btspool->bts_itape == (BTTapeBlock **) NULL ||
btspool->bts_otape == (BTTapeBlock **) NULL) btspool->bts_otape == (BTTapeBlock **) NULL)
{
elog(ERROR, "_bt_spoolinit: out of memory"); elog(ERROR, "_bt_spoolinit: out of memory");
}
for (i = 0; i < ntapes; ++i) for (i = 0; i < ntapes; ++i)
{ {
@@ -621,9 +605,7 @@ _bt_spoolflush(BTSpool *btspool)
for (i = 0; i < btspool->bts_ntapes; ++i) for (i = 0; i < btspool->bts_ntapes; ++i)
{ {
if (!EMPTYTAPE(btspool->bts_otape[i])) if (!EMPTYTAPE(btspool->bts_otape[i]))
{
_bt_tapewrite(btspool->bts_otape[i], 1); _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)); (BTSortKey *) palloc(it_ntup * sizeof(BTSortKey));
pos = itape->bttb_data; pos = itape->bttb_data;
for (i = 0; i < it_ntup; ++i) for (i = 0; i < it_ntup; ++i)
{
_bt_setsortkey(index, _bt_tapenext(itape, &pos), &(parray[i])); _bt_setsortkey(index, _bt_tapenext(itape, &pos), &(parray[i]));
}
/* /*
* qsort the pointer array. * qsort the pointer array.
@@ -790,9 +770,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
/* insert this item into the current buffer */ /* insert this item into the current buffer */
if (btitem != (BTItem) NULL) if (btitem != (BTItem) NULL)
{
_bt_tapeadd(itape, btitem, itemsz); _bt_tapeadd(itape, btitem, itemsz);
}
} }
/* /*
@@ -1008,9 +986,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
* shuffling). * shuffling).
*/ */
for (o = last_off; o > first_off; o = OffsetNumberPrev(o)) for (o = last_off; o > first_off; o = OffsetNumberPrev(o))
{
PageIndexTupleDelete(opage, o); PageIndexTupleDelete(opage, o);
}
hii = PageGetItemId(opage, P_HIKEY); hii = PageGetItemId(opage, P_HIKEY);
ii = PageGetItemId(opage, first_off); ii = PageGetItemId(opage, first_off);
*hii = *ii; *hii = *ii;
@@ -1085,14 +1061,10 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */ #endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
#endif #endif
if (last_bti == (BTItem) NULL) if (last_bti == (BTItem) NULL)
{
first_off = P_FIRSTKEY; first_off = P_FIRSTKEY;
}
else if (!_bt_itemcmp(index, _bt_nattr, else if (!_bt_itemcmp(index, _bt_nattr,
bti, last_bti, BTEqualStrategyNumber)) bti, last_bti, BTEqualStrategyNumber))
{
first_off = off; first_off = off;
}
last_off = off; last_off = off;
last_bti = (BTItem) PageGetItem(npage, PageGetItemId(npage, off)); last_bti = (BTItem) PageGetItem(npage, PageGetItemId(npage, off));
@@ -1226,9 +1198,7 @@ _bt_merge(Relation index, BTSpool *btspool)
do do
{ {
if (_bt_taperead(itape) == 0) if (_bt_taperead(itape) == 0)
{
tapedone[t] = 1; tapedone[t] = 1;
}
} while (!tapedone[t] && EMPTYTAPE(itape)); } while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t]) if (!tapedone[t])
{ {
@@ -1237,9 +1207,7 @@ _bt_merge(Relation index, BTSpool *btspool)
_bt_setsortkey(index, _bt_tapenext(itape, &tapepos[t]), _bt_setsortkey(index, _bt_tapenext(itape, &tapepos[t]),
&(e.btpqe_item)); &(e.btpqe_item));
if (e.btpqe_item.btsk_item != (BTItem) NULL) if (e.btpqe_item.btsk_item != (BTItem) NULL)
{
_bt_pqadd(&q, &e); _bt_pqadd(&q, &e);
}
} }
} }
@@ -1334,9 +1302,7 @@ _bt_merge(Relation index, BTSpool *btspool)
do do
{ {
if (_bt_taperead(itape) == 0) if (_bt_taperead(itape) == 0)
{
tapedone[t] = 1; tapedone[t] = 1;
}
} while (!tapedone[t] && EMPTYTAPE(itape)); } while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t]) if (!tapedone[t])
{ {
@@ -1372,9 +1338,7 @@ _bt_merge(Relation index, BTSpool *btspool)
* pages instead of merging into a tape file. * pages instead of merging into a tape file.
*/ */
if (nruns <= btspool->bts_ntapes) if (nruns <= btspool->bts_ntapes)
{
doleaf = true; doleaf = true;
}
} while (nruns > 0); /* pass */ } while (nruns > 0); /* pass */
_bt_uppershutdown(index, state); _bt_uppershutdown(index, state);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 (i == numberOfKeys || cur->sk_attno != attno)
{ {
if (cur->sk_attno != attno + 1 && i < numberOfKeys) if (cur->sk_attno != attno + 1 && i < numberOfKeys)
{
elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1); elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1);
}
/* /*
* If = has been specified, no other key will be used. In case * 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 */ /* btree doesn't support 'A is null' clauses, yet */
if (isNull || key[0].sk_flags & SK_ISNULL) if (isNull || key[0].sk_flags & SK_ISNULL)
{
return (false); return (false);
}
if (key[0].sk_flags & SK_COMMUTE) if (key[0].sk_flags & SK_COMMUTE)
{ {
@@ -391,9 +387,7 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
} }
if (!test == !(key[0].sk_flags & SK_NEGATE)) if (!test == !(key[0].sk_flags & SK_NEGATE))
{
return (false); return (false);
}
keysz -= 1; keysz -= 1;
key++; key++;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData))) if (ItemPointerIsValid(&(s->currentItemData)))
{
res = rtnext(s, dir); res = rtnext(s, dir);
}
else else
{
res = rtfirst(s, dir); res = rtfirst(s, dir);
}
return (res); return (res);
} }
@@ -98,13 +94,9 @@ rtfirst(IndexScanDesc s, ScanDirection dir)
maxoff = PageGetMaxOffsetNumber(p); maxoff = PageGetMaxOffsetNumber(p);
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->rts_child); n = OffsetNumberPrev(stk->rts_child);
}
else else
{
n = OffsetNumberNext(stk->rts_child); n = OffsetNumberNext(stk->rts_child);
}
so->s_stack = stk->rts_parent; so->s_stack = stk->rts_parent;
pfree(stk); pfree(stk);
@@ -158,13 +150,9 @@ rtnext(IndexScanDesc s, ScanDirection dir)
n = ItemPointerGetOffsetNumber(&(s->currentItemData)); n = ItemPointerGetOffsetNumber(&(s->currentItemData));
if (ScanDirectionIsForward(dir)) if (ScanDirectionIsForward(dir))
{
n = OffsetNumberNext(n); n = OffsetNumberNext(n);
}
else else
{
n = OffsetNumberPrev(n); n = OffsetNumberPrev(n);
}
b = ReadBuffer(s->relation, blk); b = ReadBuffer(s->relation, blk);
p = BufferGetPage(b); p = BufferGetPage(b);
@@ -190,13 +178,9 @@ rtnext(IndexScanDesc s, ScanDirection dir)
po = (RTreePageOpaque) PageGetSpecialPointer(p); po = (RTreePageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(stk->rts_child); n = OffsetNumberPrev(stk->rts_child);
}
else else
{
n = OffsetNumberNext(stk->rts_child); n = OffsetNumberNext(stk->rts_child);
}
so->s_stack = stk->rts_parent; so->s_stack = stk->rts_parent;
pfree(stk); pfree(stk);
@@ -230,13 +214,9 @@ rtnext(IndexScanDesc s, ScanDirection dir)
po = (RTreePageOpaque) PageGetSpecialPointer(p); po = (RTreePageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = PageGetMaxOffsetNumber(p); n = PageGetMaxOffsetNumber(p);
}
else else
{
n = FirstOffsetNumber; n = FirstOffsetNumber;
}
} }
} }
} }
@@ -283,13 +263,9 @@ findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
} }
if (ScanDirectionIsBackward(dir)) if (ScanDirectionIsBackward(dir))
{
n = OffsetNumberPrev(n); n = OffsetNumberPrev(n);
}
else else
{
n = OffsetNumberNext(n); n = OffsetNumberNext(n);
}
} }
return (n); return (n);
@@ -345,9 +321,7 @@ rtheapptr(Relation r, ItemPointer itemp)
ReleaseBuffer(b); ReleaseBuffer(b);
} }
else else
{
ItemPointerSetInvalid(ip); ItemPointerSetInvalid(ip);
}
return (ip); return (ip);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/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)); memmove(oldud, datum, VARSIZE(datum));
} }
else else
{
memmove(oldud, datum, att_size); memmove(oldud, datum, att_size);
}
WriteBuffer(b); WriteBuffer(b);
/* /*
@@ -467,9 +465,7 @@ rttighten(Relation r,
pfree(tdatum); pfree(tdatum);
} }
else else
{
ReleaseBuffer(b); ReleaseBuffer(b);
}
pfree(datum); pfree(datum);
} }
@@ -587,9 +583,7 @@ dosplit(Relation r,
} }
if ((bufblock = BufferGetBlockNumber(buffer)) != P_ROOT) if ((bufblock = BufferGetBlockNumber(buffer)) != P_ROOT)
{
PageRestoreTempPage(left, p); PageRestoreTempPage(left, p);
}
WriteBuffer(leftbuf); WriteBuffer(leftbuf);
WriteBuffer(rightbuf); WriteBuffer(rightbuf);
@@ -842,13 +836,9 @@ picksplit(Relation r,
/* okay, which page needs least enlargement? */ /* okay, which page needs least enlargement? */
if (i == maxoff) if (i == maxoff)
{
item_1 = itup; item_1 = itup;
}
else else
{
item_1 = (IndexTuple) PageGetItem(page, PageGetItemId(page, i)); item_1 = (IndexTuple) PageGetItem(page, PageGetItemId(page, i));
}
datum_alpha = ((char *) item_1) + sizeof(IndexTupleData); datum_alpha = ((char *) item_1) + sizeof(IndexTupleData);
union_dl = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_l, datum_alpha); union_dl = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_l, datum_alpha);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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. * Set flags.
*/ */
if (RelationGetNumberOfBlocks(s->relation) == 0) if (RelationGetNumberOfBlocks(s->relation) == 0)
{
s->flags = ScanUnmarked; s->flags = ScanUnmarked;
}
else if (fromEnd) else if (fromEnd)
{
s->flags = ScanUnmarked | ScanUncheckedPrevious; s->flags = ScanUnmarked | ScanUncheckedPrevious;
}
else else
{
s->flags = ScanUnmarked | ScanUncheckedNext; s->flags = ScanUnmarked | ScanUncheckedNext;
}
s->scanFromEnd = fromEnd; s->scanFromEnd = fromEnd;
@@ -133,9 +127,7 @@ rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
p->s_stack = p->s_markstk = (RTSTACK *) NULL; p->s_stack = p->s_markstk = (RTSTACK *) NULL;
p->s_flags = 0x0; p->s_flags = 0x0;
for (i = 0; i < s->numberOfKeys; i++) for (i = 0; i < s->numberOfKeys; i++)
{
p->s_internalKey[i].sk_argument = s->keyData[i].sk_argument; p->s_internalKey[i].sk_argument = s->keyData[i].sk_argument;
}
} }
else else
{ {
@@ -279,9 +271,7 @@ rtdropscan(IndexScanDesc s)
for (l = RTScans; for (l = RTScans;
l != (RTScanList) NULL && l->rtsl_scan != s; l != (RTScanList) NULL && l->rtsl_scan != s;
l = l->rtsl_next) l = l->rtsl_next)
{
prev = l; prev = l;
}
if (l == (RTScanList) NULL) if (l == (RTScanList) NULL)
elog(ERROR, "rtree scan list corrupted -- cannot find 0x%lx", s); elog(ERROR, "rtree scan list corrupted -- cannot find 0x%lx", s);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Transaction aborts can now occur two ways: * Transaction aborts can now occur two ways:
@@ -1450,9 +1450,7 @@ IsTransactionBlock()
if (s->blockState == TBLOCK_INPROGRESS if (s->blockState == TBLOCK_INPROGRESS
|| s->blockState == TBLOCK_ENDABORT) || s->blockState == TBLOCK_ENDABORT)
{
return (true); return (true);
}
return (false); return (false);
} }

View File

@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.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 */ } /* while */
if (argc - optind > 1) if (argc - optind > 1)
{
usage(); usage();
}
else if (argc - optind == 1) else if (argc - optind == 1)
{
dbName = argv[optind]; dbName = argv[optind];
}
if (!DataDir) if (!DataDir)
{ {
@@ -485,9 +481,7 @@ boot_openrel(char *relname)
} }
if (reldesc != NULL) if (reldesc != NULL)
{
closerel(NULL); closerel(NULL);
}
if (!Quiet) if (!Quiet)
printf("Amopen: relation %s. attrsize %d\n", relname ? relname : "(null)", printf("Amopen: relation %s. attrsize %d\n", relname ? relname : "(null)",
@@ -499,9 +493,7 @@ boot_openrel(char *relname)
for (i = 0; i < numattr; i++) for (i = 0; i < numattr; i++)
{ {
if (attrtypes[i] == NULL) if (attrtypes[i] == NULL)
{
attrtypes[i] = AllocateAttribute(); attrtypes[i] = AllocateAttribute();
}
memmove((char *) attrtypes[i], memmove((char *) attrtypes[i],
(char *) reldesc->rd_att->attrs[i], (char *) reldesc->rd_att->attrs[i],
ATTRIBUTE_TUPLE_SIZE); ATTRIBUTE_TUPLE_SIZE);
@@ -553,9 +545,7 @@ closerel(char *name)
} }
if (reldesc == NULL) if (reldesc == NULL)
{
elog(ERROR, "Warning: no opened relation to close.\n"); elog(ERROR, "Warning: no opened relation to close.\n");
}
else else
{ {
if (!Quiet) if (!Quiet)
@@ -639,9 +629,7 @@ InsertOneTuple(Oid objectid)
pfree(tupDesc); /* just free's tupDesc, not the attrtypes */ pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
if (objectid != (Oid) 0) if (objectid != (Oid) 0)
{
tuple->t_oid = objectid; tuple->t_oid = objectid;
}
heap_insert(reldesc, tuple); heap_insert(reldesc, tuple);
pfree(tuple); pfree(tuple);
if (DebugMode) if (DebugMode)
@@ -735,9 +723,7 @@ InsertOneNull(int i)
if (DebugMode) if (DebugMode)
printf("Inserting null\n"); printf("Inserting null\n");
if (i < 0 || i >= MAXATTR) if (i < 0 || i >= MAXATTR)
{
elog(FATAL, "i out of range (too many attrs): %d\n", i); elog(FATAL, "i out of range (too many attrs): %d\n", i);
}
values[i] = (char *) NULL; values[i] = (char *) NULL;
Blanks[i] = 'n'; Blanks[i] = 'n';
} }
@@ -787,9 +773,7 @@ cleanup()
exitpg(1); exitpg(1);
} }
if (reldesc != (Relation) NULL) if (reldesc != (Relation) NULL)
{
heap_close(reldesc); heap_close(reldesc);
}
CommitTransactionCommand(); CommitTransactionCommand();
exitpg(Warnings); exitpg(Warnings);
} }
@@ -823,9 +807,7 @@ gettype(char *type)
for (i = 0; i <= n_types; i++) for (i = 0; i <= n_types; i++)
{ {
if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0) if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0)
{
return (i); return (i);
}
} }
if (DebugMode) if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type); printf("bootstrap.c: External Type: %s\n", type);
@@ -869,9 +851,7 @@ AllocateAttribute()
(AttributeTupleForm) malloc(ATTRIBUTE_TUPLE_SIZE); (AttributeTupleForm) malloc(ATTRIBUTE_TUPLE_SIZE);
if (!PointerIsValid(attribute)) if (!PointerIsValid(attribute))
{
elog(FATAL, "AllocateAttribute: malloc failed"); elog(FATAL, "AllocateAttribute: malloc failed");
}
MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE); MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE);
return (attribute); return (attribute);
@@ -928,9 +908,7 @@ EnterString(char *str)
node = FindStr(str, len, 0); node = FindStr(str, len, 0);
if (node) if (node)
{
return (node->strnum); return (node->strnum);
}
else else
{ {
node = AddStr(str, len, 0); node = AddStr(str, len, 0);
@@ -997,9 +975,7 @@ FindStr(char *str, int length, hashnode *mderef)
return (node); /* no need to check */ return (node); /* no need to check */
} }
else else
{
node = node->next; node = node->next;
}
} }
/* Couldn't find it in the list */ /* Couldn't find it in the list */
return (NULL); return (NULL);
@@ -1056,9 +1032,7 @@ AddStr(char *str, int strlength, int mderef)
hashresult = CompHash(str, strlength); hashresult = CompHash(str, strlength);
if (hashtable[hashresult] == NULL) if (hashtable[hashresult] == NULL)
{
hashtable[hashresult] = newnode; hashtable[hashresult] = newnode;
}
else else
{ /* There is something in the list */ { /* There is something in the list */
trail = hashtable[hashresult]; trail = hashtable[hashresult];
@@ -1135,9 +1109,7 @@ index_register(char *heap,
} }
} }
else else
{
newind->il_params = (Datum *) NULL; newind->il_params = (Datum *) NULL;
}
if (finfo != (FuncIndexInfo *) NULL) if (finfo != (FuncIndexInfo *) NULL)
{ {
@@ -1145,9 +1117,7 @@ index_register(char *heap,
memmove(newind->il_finfo, finfo, sizeof(FuncIndexInfo)); memmove(newind->il_finfo, finfo, sizeof(FuncIndexInfo));
} }
else else
{
newind->il_finfo = (FuncIndexInfo *) NULL; newind->il_finfo = (FuncIndexInfo *) NULL;
}
if (predInfo != NULL) if (predInfo != NULL)
{ {
@@ -1156,9 +1126,7 @@ index_register(char *heap,
newind->il_predInfo->oldPred = predInfo->oldPred; newind->il_predInfo->oldPred = predInfo->oldPred;
} }
else else
{
newind->il_predInfo = NULL; newind->il_predInfo = NULL;
}
newind->il_next = ILHead; newind->il_next = ILHead;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* See acl.h. * See acl.h.
@@ -200,13 +200,9 @@ get_grosysid(char *groname)
htp = SearchSysCacheTuple(GRONAME, PointerGetDatum(groname), htp = SearchSysCacheTuple(GRONAME, PointerGetDatum(groname),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(htp)) if (HeapTupleIsValid(htp))
{
id = ((Form_pg_group) GETSTRUCT(htp))->grosysid; id = ((Form_pg_group) GETSTRUCT(htp))->grosysid;
}
else else
{
elog(ERROR, "non-existent group \"%s\"", groname); elog(ERROR, "non-existent group \"%s\"", groname);
}
return (id); return (id);
} }
@@ -219,13 +215,9 @@ get_groname(AclId grosysid)
htp = SearchSysCacheTuple(GROSYSID, PointerGetDatum(grosysid), htp = SearchSysCacheTuple(GROSYSID, PointerGetDatum(grosysid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(htp)) if (HeapTupleIsValid(htp))
{
name = (((Form_pg_group) GETSTRUCT(htp))->groname).data; name = (((Form_pg_group) GETSTRUCT(htp))->groname).data;
}
else else
{
elog(NOTICE, "get_groname: group %d not found", grosysid); elog(NOTICE, "get_groname: group %d not found", grosysid);
}
return (name); return (name);
} }
@@ -267,9 +259,7 @@ in_group(AclId uid, AclId gid)
} }
} }
else else
{
elog(NOTICE, "in_group: group %d not found", gid); elog(NOTICE, "in_group: group %d not found", gid);
}
heap_close(relation); heap_close(relation);
return (found); return (found);
} }
@@ -290,9 +280,7 @@ aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
/* if no acl is found, use world default */ /* if no acl is found, use world default */
if (!acl) if (!acl)
{
acl = acldefault(relname); acl = acldefault(relname);
}
num = ACL_NUM(acl); num = ACL_NUM(acl);
aidat = ACL_DAT(acl); aidat = ACL_DAT(acl);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation * heap_create() - Create an uncataloged heap relation
@@ -291,9 +291,7 @@ heap_create(char *name,
rdesc->rd_rel->relchecks = tupDesc->constr->num_check; rdesc->rd_rel->relchecks = tupDesc->constr->num_check;
for (i = 0; i < natts; i++) for (i = 0; i < natts; i++)
{
rdesc->rd_att->attrs[i]->attrelid = relid; rdesc->rd_att->attrs[i]->attrelid = relid;
}
rdesc->rd_id = relid; rdesc->rd_id = relid;
@@ -933,9 +931,7 @@ RelationRemoveInheritance(Relation relation)
{ {
tuple = heap_getnext(scan, 0, (Buffer *) NULL); tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{
break; break;
}
heap_delete(catalogRelation, &tuple->t_ctid); heap_delete(catalogRelation, &tuple->t_ctid);
} }
@@ -961,9 +957,7 @@ RelationRemoveInheritance(Relation relation)
{ {
tuple = heap_getnext(scan, 0, (Buffer *) NULL); tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{
break; break;
}
heap_delete(catalogRelation, &tuple->t_ctid); heap_delete(catalogRelation, &tuple->t_ctid);
} }
@@ -1000,9 +994,7 @@ RelationRemoveIndexes(Relation relation)
{ {
tuple = heap_getnext(scan, 0, (Buffer *) NULL); tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{
break; break;
}
index_destroy(((IndexTupleForm) GETSTRUCT(tuple))->indexrelid); index_destroy(((IndexTupleForm) GETSTRUCT(tuple))->indexrelid);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * INTERFACE ROUTINES
@@ -190,9 +190,7 @@ RelationNameGetObjectId(char *relationName,
pg_class_tuple = heap_getnext(pg_class_scan, 0, &buffer); pg_class_tuple = heap_getnext(pg_class_scan, 0, &buffer);
if (!HeapTupleIsValid(pg_class_tuple)) if (!HeapTupleIsValid(pg_class_tuple))
{
relationObjectId = InvalidOid; relationObjectId = InvalidOid;
}
else else
{ {
relationObjectId = pg_class_tuple->t_oid; relationObjectId = pg_class_tuple->t_oid;
@@ -385,9 +383,7 @@ ConstructTupleDescriptor(Oid heapoid,
IndexKeyType = IndexKey->tname; IndexKeyType = IndexKey->tname;
} }
else else
{
IndexKeyType = NULL; IndexKeyType = NULL;
}
indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE); indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
@@ -805,9 +801,7 @@ UpdateIndexRelation(Oid indexoid,
pfree(predString); pfree(predString);
} }
else else
{
predText = (text *) fmgr(F_TEXTIN, ""); predText = (text *) fmgr(F_TEXTIN, "");
}
predLen = VARSIZE(predText); predLen = VARSIZE(predText);
itupLen = predLen + sizeof(FormData_pg_index); itupLen = predLen + sizeof(FormData_pg_index);
indexForm = (IndexTupleForm) palloc(itupLen); indexForm = (IndexTupleForm) palloc(itupLen);
@@ -942,9 +936,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
pfree(predString); pfree(predString);
} }
else else
{
predText = (text *) fmgr(F_TEXTIN, ""); predText = (text *) fmgr(F_TEXTIN, "");
}
/* open the index system catalog relation */ /* open the index system catalog relation */
pg_index = heap_openr(IndexRelationName); pg_index = heap_openr(IndexRelationName);
@@ -1027,9 +1019,7 @@ InitIndexStrategy(int numatts,
strsize); strsize);
} }
else else
{
support = (RegProcedure *) NULL; support = (RegProcedure *) NULL;
}
/* ---------------- /* ----------------
* fill in the index strategy structure with information * fill in the index strategy structure with information
@@ -1269,9 +1259,7 @@ index_destroy(Oid indexId)
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL), while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple)) HeapTupleIsValid(tuple))
{
heap_delete(catalogRelation, &tuple->t_ctid); heap_delete(catalogRelation, &tuple->t_ctid);
}
heap_endscan(scan); heap_endscan(scan);
heap_close(catalogRelation); heap_close(catalogRelation);
@@ -1410,9 +1398,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
*/ */
pg_class = heap_openr(RelationRelationName); pg_class = heap_openr(RelationRelationName);
if (!RelationIsValid(pg_class)) if (!RelationIsValid(pg_class))
{
elog(ERROR, "UpdateStats: could not open RELATION relation"); elog(ERROR, "UpdateStats: could not open RELATION relation");
}
key[0].sk_argument = ObjectIdGetDatum(relid); key[0].sk_argument = ObjectIdGetDatum(relid);
pg_class_scan = pg_class_scan =

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; int i;
for (i = 0; i < nIndices; i++) for (i = 0; i < nIndices; i++)
{
idescs[i] = index_openr(names[i]); idescs[i] = index_openr(names[i]);
}
} }
/* /*

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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(strVal(t), "opaque") == 0)
{ {
if (strcmp(languageName, "sql") == 0) if (strcmp(languageName, "sql") == 0)
{
elog(ERROR, "ProcedureDefine: sql functions cannot take type \"opaque\""); elog(ERROR, "ProcedureDefine: sql functions cannot take type \"opaque\"");
}
toid = 0; toid = 0;
} }
else else
@@ -162,9 +160,7 @@ ProcedureCreate(char *procedureName,
if (strcmp(returnTypeName, "opaque") == 0) if (strcmp(returnTypeName, "opaque") == 0)
{ {
if (strcmp(languageName, "sql") == 0) if (strcmp(languageName, "sql") == 0)
{
elog(ERROR, "ProcedureCreate: sql functions cannot return type \"opaque\""); elog(ERROR, "ProcedureCreate: sql functions cannot return type \"opaque\"");
}
typeObjectId = 0; typeObjectId = 0;
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); typeObjectId = TypeGet(typeName, &defined);
if (OidIsValid(typeObjectId) && defined) if (OidIsValid(typeObjectId) && defined)
{
elog(ERROR, "TypeCreate: type %s already defined", typeName); elog(ERROR, "TypeCreate: type %s already defined", typeName);
}
/* ---------------- /* ----------------
* if this type has an associated elementType, then we check that * if this type has an associated elementType, then we check that
@@ -347,9 +345,7 @@ TypeCreate(char *typeName,
{ {
elementObjectId = TypeGet(elementTypeName, &defined); elementObjectId = TypeGet(elementTypeName, &defined);
if (!defined) if (!defined)
{
elog(ERROR, "TypeCreate: type %s is not defined", elementTypeName); elog(ERROR, "TypeCreate: type %s is not defined", elementTypeName);
}
} }
/* ---------------- /* ----------------
@@ -437,9 +433,7 @@ TypeCreate(char *typeName,
0); 0);
} }
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{
func_error("TypeCreate", procname, 1, argList, NULL); func_error("TypeCreate", procname, 1, argList, NULL);
}
} }
values[i++] = (Datum) tup->t_oid; /* 11 - 14 */ 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 */ /* check that that the new type is not already defined */
type_oid = TypeGet(newTypeName, &defined); type_oid = TypeGet(newTypeName, &defined);
if (OidIsValid(type_oid) && defined) if (OidIsValid(type_oid) && defined)
{
elog(ERROR, "TypeRename: type %s already defined", newTypeName); elog(ERROR, "TypeRename: type %s already defined", newTypeName);
}
/* get the type tuple from the catalog index scan manager */ /* get the type tuple from the catalog index scan manager */
pg_type_desc = heap_openr(TypeRelationName); pg_type_desc = heap_openr(TypeRelationName);
@@ -592,9 +584,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
} }
else else
{
elog(ERROR, "TypeRename: type %s not defined", oldTypeName); elog(ERROR, "TypeRename: type %s not defined", oldTypeName);
}
/* finish up */ /* finish up */
heap_close(pg_type_desc); heap_close(pg_type_desc);

View File

@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* At the point the version is defined, 2 physical relations are created * 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; attrname = (rdesc->rd_att->attrs[i]->attname).data;
if (notfirst == 1) if (notfirst == 1)
{
sprintf(temp_buf, ", %s = new.%s", attrname, attrname); sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
}
else else
{ {
sprintf(temp_buf, "%s = new.%s", attrname, attrname); sprintf(temp_buf, "%s = new.%s", attrname, attrname);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 (kill(DatumGetInt32(d), SIGUSR2) < 0)
{ {
if (errno == ESRCH) if (errno == ESRCH)
{
heap_delete(lRel, &lTuple->t_ctid); heap_delete(lRel, &lTuple->t_ctid);
}
} }
#endif #endif
} }
@@ -360,9 +358,7 @@ Async_NotifyAtAbort()
extern TransactionState CurrentTransactionState; extern TransactionState CurrentTransactionState;
if (notifyIssued) if (notifyIssued)
{
ClearPendingNotify(); ClearPendingNotify();
}
notifyIssued = 0; notifyIssued = 0;
if (pendingNotifies) if (pendingNotifies)
DLFreeList(pendingNotifies); DLFreeList(pendingNotifies);
@@ -446,9 +442,7 @@ Async_Listen(char *relname, int pid)
d = heap_getattr(htup, Anum_pg_listener_pid, tdesc, &isnull); d = heap_getattr(htup, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d); pid = DatumGetInt32(d);
if (pid == MyProcPid) if (pid == MyProcPid)
{
alreadyListener = 1; alreadyListener = 1;
}
} }
ReleaseBuffer(b); ReleaseBuffer(b);
} }
@@ -517,9 +511,7 @@ Async_Unlisten(char *relname, int pid)
RelationSetLockForWrite(lDesc); RelationSetLockForWrite(lDesc);
if (lTuple != NULL) if (lTuple != NULL)
{
heap_delete(lDesc, &lTuple->t_ctid); heap_delete(lDesc, &lTuple->t_ctid);
}
RelationUnsetLockForWrite(lDesc); RelationUnsetLockForWrite(lDesc);
heap_close(lDesc); heap_close(lDesc);
@@ -610,9 +602,7 @@ Async_NotifyFrontEnd()
pq_flush(); pq_flush();
} }
else else
{
elog(NOTICE, "Async_NotifyFrontEnd: no asynchronous notification to frontend on interactive sessions"); elog(NOTICE, "Async_NotifyFrontEnd: no asynchronous notification to frontend on interactive sessions");
}
ReleaseBuffer(b); ReleaseBuffer(b);
} }
CommitTransactionCommand(); CommitTransactionCommand();

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated * The PortalExecutorHeapMemory crap needs to be eliminated
@@ -475,9 +475,7 @@ PerformAddAttribute(char *relationName,
form = (TypeTupleForm) GETSTRUCT(typeTuple); form = (TypeTupleForm) GETSTRUCT(typeTuple);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
{
elog(ERROR, "Add: type \"%s\" nonexistent", p); elog(ERROR, "Add: type \"%s\" nonexistent", p);
}
namestrcpy(&(attribute->attname), (char *) key[1].sk_argument); namestrcpy(&(attribute->attname), (char *) key[1].sk_argument);
attribute->atttypid = typeTuple->t_oid; attribute->atttypid = typeTuple->t_oid;

View File

@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * 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 */ fputs("\\N", fp); /* null indicator */
if (i == attr_count - 1) if (i == attr_count - 1)
{
fputc('\n', fp); fputc('\n', fp);
}
else else
{ {
@@ -343,9 +341,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
heap_endscan(scandesc); heap_endscan(scandesc);
if (binary) if (binary)
{
pfree(nulls); pfree(nulls);
}
else else
{ {
pfree(out_functions); pfree(out_functions);
@@ -494,9 +490,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
} }
} }
else else
{
indexPred[i] = NULL; indexPred[i] = NULL;
}
} }
} }
} }
@@ -576,9 +570,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
nulls[i] = 'n'; nulls[i] = 'n';
} }
else if (string == NULL) else if (string == NULL)
{
done = 1; done = 1;
}
else else
{ {
values[i] = values[i] =
@@ -592,25 +584,19 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
*/ */
if (!PointerIsValid(values[i]) && if (!PointerIsValid(values[i]) &&
!(rel->rd_att->attrs[i]->attbyval)) !(rel->rd_att->attrs[i]->attbyval))
{
elog(ERROR, "copy from line %d: Bad file format", lineno); elog(ERROR, "copy from line %d: Bad file format", lineno);
}
} }
} }
#ifdef COPY_PATCH #ifdef COPY_PATCH
if (!done) if (!done)
{
CopyReadNewline(fp, &newline); CopyReadNewline(fp, &newline);
}
#endif #endif
} }
else else
{ /* binary */ { /* binary */
fread(&len, sizeof(int32), 1, fp); fread(&len, sizeof(int32), 1, fp);
if (feof(fp)) if (feof(fp))
{
done = 1; done = 1;
}
else else
{ {
if (oids) if (oids)
@@ -799,9 +785,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
pfree((void *) values[i]); pfree((void *) values[i]);
} }
else if (nulls[i] == 'n') else if (nulls[i] == 'n')
{
nulls[i] = ' '; nulls[i] = ' ';
}
} }
pfree(tuple); pfree(tuple);
@@ -959,9 +943,7 @@ GetIndexRelations(Oid main_relation_oid,
*index_rels = (Relation *) palloc(*n_indices * sizeof(Relation)); *index_rels = (Relation *) palloc(*n_indices * sizeof(Relation));
for (i = 0, scan = head; i < *n_indices; i++, scan = scan->next) for (i = 0, scan = head; i < *n_indices; i++, scan = scan->next)
{
(*index_rels)[i] = index_open(scan->index_rel_oid); (*index_rels)[i] = index_open(scan->index_rel_oid);
}
for (i = 0, scan = head; i < *n_indices + 1; i++) 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); val = (val << 3) + VALUE(c);
c = getc(fp); c = getc(fp);
if (ISOCTAL(c)) if (ISOCTAL(c))
{
val = (val << 3) + VALUE(c); val = (val << 3) + VALUE(c);
}
else else
{ {
if (feof(fp)) if (feof(fp))
@@ -1128,9 +1108,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
{ {
#ifdef COPY_PATCH #ifdef COPY_PATCH
if (c == '\n') if (c == '\n')
{
*newline = 1; *newline = 1;
}
#endif #endif
done = 1; done = 1;
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); "MergeAttr: Can't inherit from non-existent superclass '%s'", name);
} }
if (relation->rd_rel->relkind == 'S') if (relation->rd_rel->relkind == 'S')
{
elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name); elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name);
}
tupleDesc = RelationGetTupleDescriptor(relation); tupleDesc = RelationGetTupleDescriptor(relation);
constr = tupleDesc->constr; constr = tupleDesc->constr;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); sprintf(loc, "%s%c%s", dbpath, SEP_CHAR, dbname);
} }
else else
{
strcpy(loc, dbname); strcpy(loc, dbname);
}
lp = ExpandDatabasePath(loc); lp = ExpandDatabasePath(loc);
@@ -114,9 +112,7 @@ destroydb(char *dbname)
check_permissions("destroydb", dbpath, dbname, &db_id, &user_id); check_permissions("destroydb", dbpath, dbname, &db_id, &user_id);
if (!OidIsValid(db_id)) if (!OidIsValid(db_id))
{
elog(FATAL, "impossible: pg_database instance with invalid OID."); elog(FATAL, "impossible: pg_database instance with invalid OID.");
}
/* stop the vacuum daemon */ /* stop the vacuum daemon */
stop_vacuum(dbpath, dbname); stop_vacuum(dbpath, dbname);
@@ -224,15 +220,11 @@ check_permissions(char *command,
/* Make sure we are not mucking with the template database */ /* Make sure we are not mucking with the template database */
if (!strcmp(dbname, "template1")) if (!strcmp(dbname, "template1"))
{
elog(ERROR, "%s cannot be executed on the template database.", command); elog(ERROR, "%s cannot be executed on the template database.", command);
}
/* Check to make sure database is not the currently open database */ /* Check to make sure database is not the currently open database */
if (!strcmp(dbname, DatabaseName)) if (!strcmp(dbname, DatabaseName))
{
elog(ERROR, "%s cannot be executed on an open database", command); elog(ERROR, "%s cannot be executed on an open database", command);
}
/* Check to make sure database is owned by this user */ /* Check to make sure database is owned by this user */
@@ -272,9 +264,7 @@ check_permissions(char *command,
*(path + VARSIZE(dbtext) - VARHDRSZ) = '\0'; *(path + VARSIZE(dbtext) - VARHDRSZ) = '\0';
} }
else else
{
*dbIdP = InvalidOid; *dbIdP = InvalidOid;
}
heap_close(dbrel); heap_close(dbrel);
@@ -322,9 +312,7 @@ stop_vacuum(char *dbpath, char *dbname)
dbname, SEP_CHAR, dbname); dbname, SEP_CHAR, dbname);
} }
else else
{
sprintf(filename, "%s%c%s.vacuum", dbpath, SEP_CHAR, dbname); sprintf(filename, "%s%c%s.vacuum", dbpath, SEP_CHAR, dbname);
}
if ((fp = AllocateFile(filename, "r")) != NULL) if ((fp = AllocateFile(filename, "r")) != NULL)
{ {

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); numberOfAttributes = length(attributeList);
if (numberOfAttributes <= 0) if (numberOfAttributes <= 0)
{
elog(ERROR, "DefineIndex: must specify at least one attribute"); elog(ERROR, "DefineIndex: must specify at least one attribute");
}
/* /*
* compute heap relation id * compute heap relation id
@@ -369,9 +367,7 @@ CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid)
List *item; List *item;
foreach(item, predList) foreach(item, predList)
{
CheckPredExpr(lfirst(item), rangeTable, baseRelOid); CheckPredExpr(lfirst(item), rangeTable, baseRelOid);
}
} }
static void static void
@@ -391,9 +387,7 @@ CheckPredExpr(Node *predicate, List *rangeTable, Oid baseRelOid)
elog(ERROR, "Unsupported partial-index predicate expression type"); elog(ERROR, "Unsupported partial-index predicate expression type");
foreach(clause, clauses) foreach(clause, clauses)
{
CheckPredExpr(lfirst(clause), rangeTable, baseRelOid); CheckPredExpr(lfirst(clause), rangeTable, baseRelOid);
}
} }
static void static void
@@ -408,9 +402,7 @@ CheckPredClause(Expr *predicate, List *rangeTable, Oid baseRelOid)
if (!IsA(predicate->oper, Oper) || if (!IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) || !IsA(pred_var, Var) ||
!IsA(pred_const, Const)) !IsA(pred_const, Const))
{
elog(ERROR, "Unsupported partial-index predicate clause type"); elog(ERROR, "Unsupported partial-index predicate clause type");
}
if (getrelid(pred_var->varno, rangeTable) != baseRelOid) if (getrelid(pred_var->varno, rangeTable) != baseRelOid)
elog(ERROR, elog(ERROR,
@@ -538,9 +530,7 @@ GetDefaultOpClass(Oid atttypid)
ObjectIdGetDatum(atttypid), ObjectIdGetDatum(atttypid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{
return 0; return 0;
}
return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname)); return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname));
} }
@@ -564,9 +554,7 @@ RemoveIndex(char *name)
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{
elog(ERROR, "index \"%s\" nonexistent", name); elog(ERROR, "index \"%s\" nonexistent", name);
}
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX) if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
{ {

View File

@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * 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); ParamString *param = (ParamString *) lfirst(pl);
if (strcasecmp(param->name, "iscachable") == 0) if (strcasecmp(param->name, "iscachable") == 0)
{
*canCache_p = true; *canCache_p = true;
}
else if (strcasecmp(param->name, "trusted") == 0) 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) else if (strcasecmp(param->name, "outin_ratio") == 0)
{
*outin_ratio_p = atoi(param->val); *outin_ratio_p = atoi(param->val);
}
} }
} }
@@ -394,13 +390,9 @@ DefineOperator(char *oprName,
elog(ERROR, "setof type not implemented for leftarg"); elog(ERROR, "setof type not implemented for leftarg");
if (nodeTag(defel->arg) == T_String) if (nodeTag(defel->arg) == T_String)
{
typeName1 = defGetString(defel); typeName1 = defGetString(defel);
}
else else
{
elog(ERROR, "type for leftarg is malformed."); elog(ERROR, "type for leftarg is malformed.");
}
} }
else if (!strcasecmp(defel->defname, "rightarg")) else if (!strcasecmp(defel->defname, "rightarg"))
{ {
@@ -409,18 +401,12 @@ DefineOperator(char *oprName,
elog(ERROR, "setof type not implemented for rightarg"); elog(ERROR, "setof type not implemented for rightarg");
if (nodeTag(defel->arg) == T_String) if (nodeTag(defel->arg) == T_String)
{
typeName2 = defGetString(defel); typeName2 = defGetString(defel);
}
else else
{
elog(ERROR, "type for rightarg is malformed."); elog(ERROR, "type for rightarg is malformed.");
}
} }
else if (!strcasecmp(defel->defname, "procedure")) else if (!strcasecmp(defel->defname, "procedure"))
{
functionName = defGetString(defel); functionName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "precedence")) else if (!strcasecmp(defel->defname, "precedence"))
{ {
/* NOT IMPLEMENTED (never worked in v4.2) */ /* NOT IMPLEMENTED (never worked in v4.2) */
@@ -432,25 +418,15 @@ DefineOperator(char *oprName,
elog(NOTICE, "CREATE OPERATOR: associativity not implemented"); elog(NOTICE, "CREATE OPERATOR: associativity not implemented");
} }
else if (!strcasecmp(defel->defname, "commutator")) else if (!strcasecmp(defel->defname, "commutator"))
{
commutatorName = defGetString(defel); commutatorName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "negator")) else if (!strcasecmp(defel->defname, "negator"))
{
negatorName = defGetString(defel); negatorName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "restrict")) else if (!strcasecmp(defel->defname, "restrict"))
{
restrictionName = defGetString(defel); restrictionName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "join")) else if (!strcasecmp(defel->defname, "join"))
{
joinName = defGetString(defel); joinName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "hashes")) else if (!strcasecmp(defel->defname, "hashes"))
{
canHash = TRUE; canHash = TRUE;
}
else if (!strcasecmp(defel->defname, "sort1")) else if (!strcasecmp(defel->defname, "sort1"))
{ {
/* ---------------- /* ----------------
@@ -462,9 +438,7 @@ DefineOperator(char *oprName,
sortName1 = defGetString(defel); sortName1 = defGetString(defel);
} }
else if (!strcasecmp(defel->defname, "sort2")) else if (!strcasecmp(defel->defname, "sort2"))
{
sortName2 = defGetString(defel); sortName2 = defGetString(defel);
}
else else
{ {
elog(NOTICE, "DefineOperator: attribute \"%s\" not recognized", elog(NOTICE, "DefineOperator: attribute \"%s\" not recognized",
@@ -476,9 +450,7 @@ DefineOperator(char *oprName,
* make sure we have our required definitions * make sure we have our required definitions
*/ */
if (functionName == NULL) if (functionName == NULL)
{
elog(ERROR, "Define: \"procedure\" unspecified"); elog(ERROR, "Define: \"procedure\" unspecified");
}
/* ---------------- /* ----------------
* now have OperatorCreate do all the work.. * now have OperatorCreate do all the work..
@@ -528,13 +500,9 @@ DefineAggregate(char *aggName, List *parameters)
* sfunc1 * sfunc1
*/ */
if (!strcasecmp(defel->defname, "sfunc1")) if (!strcasecmp(defel->defname, "sfunc1"))
{
stepfunc1Name = defGetString(defel); stepfunc1Name = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "basetype")) else if (!strcasecmp(defel->defname, "basetype"))
{
baseType = defGetString(defel); baseType = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "stype1")) else if (!strcasecmp(defel->defname, "stype1"))
{ {
stepfunc1Type = defGetString(defel); stepfunc1Type = defGetString(defel);
@@ -544,9 +512,7 @@ DefineAggregate(char *aggName, List *parameters)
*/ */
} }
else if (!strcasecmp(defel->defname, "sfunc2")) else if (!strcasecmp(defel->defname, "sfunc2"))
{
stepfunc2Name = defGetString(defel); stepfunc2Name = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "stype2")) else if (!strcasecmp(defel->defname, "stype2"))
{ {
stepfunc2Type = defGetString(defel); stepfunc2Type = defGetString(defel);
@@ -564,13 +530,9 @@ DefineAggregate(char *aggName, List *parameters)
*/ */
} }
else if (!strcasecmp(defel->defname, "initcond1")) else if (!strcasecmp(defel->defname, "initcond1"))
{
init1 = defGetString(defel); init1 = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "initcond2")) else if (!strcasecmp(defel->defname, "initcond2"))
{
init2 = defGetString(defel); init2 = defGetString(defel);
}
else else
{ {
elog(NOTICE, "DefineAggregate: attribute \"%s\" not recognized", elog(NOTICE, "DefineAggregate: attribute \"%s\" not recognized",
@@ -647,25 +609,15 @@ DefineType(char *typeName, List *parameters)
DefElem *defel = (DefElem *) lfirst(pl); DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "internallength")) if (!strcasecmp(defel->defname, "internallength"))
{
internalLength = defGetTypeLength(defel); internalLength = defGetTypeLength(defel);
}
else if (!strcasecmp(defel->defname, "externallength")) else if (!strcasecmp(defel->defname, "externallength"))
{
externalLength = defGetTypeLength(defel); externalLength = defGetTypeLength(defel);
}
else if (!strcasecmp(defel->defname, "input")) else if (!strcasecmp(defel->defname, "input"))
{
inputName = defGetString(defel); inputName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "output")) else if (!strcasecmp(defel->defname, "output"))
{
outputName = defGetString(defel); outputName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "send")) else if (!strcasecmp(defel->defname, "send"))
{
sendName = defGetString(defel); sendName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "delimiter")) else if (!strcasecmp(defel->defname, "delimiter"))
{ {
char *p = defGetString(defel); char *p = defGetString(defel);
@@ -673,33 +625,21 @@ DefineType(char *typeName, List *parameters)
delimiter = p[0]; delimiter = p[0];
} }
else if (!strcasecmp(defel->defname, "receive")) else if (!strcasecmp(defel->defname, "receive"))
{
receiveName = defGetString(defel); receiveName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "element")) else if (!strcasecmp(defel->defname, "element"))
{
elemName = defGetString(defel); elemName = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "default")) else if (!strcasecmp(defel->defname, "default"))
{
defaultValue = defGetString(defel); defaultValue = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "passedbyvalue")) else if (!strcasecmp(defel->defname, "passedbyvalue"))
{
byValue = true; byValue = true;
}
else if (!strcasecmp(defel->defname, "alignment")) else if (!strcasecmp(defel->defname, "alignment"))
{ {
char *a = defGetString(defel); char *a = defGetString(defel);
if (!strcasecmp(a, "double")) if (!strcasecmp(a, "double"))
{
alignment = 'd'; alignment = 'd';
}
else if (!strcasecmp(a, "int")) else if (!strcasecmp(a, "int"))
{
alignment = 'i'; alignment = 'i';
}
else else
{ {
elog(ERROR, "DefineType: \"%s\" alignment not recognized", elog(ERROR, "DefineType: \"%s\" alignment not recognized",

View File

@@ -80,9 +80,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
PointerGetDatum(languageName), PointerGetDatum(languageName),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(langTup)) if (HeapTupleIsValid(langTup))
{
elog(ERROR, "Language %s already exists", languageName); elog(ERROR, "Language %s already exists", languageName);
}
/* ---------------- /* ----------------
* Lookup the PL handler function and check that it is * Lookup the PL handler function and check that it is
@@ -171,9 +169,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
PointerGetDatum(languageName), PointerGetDatum(languageName),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
{
elog(ERROR, "Language %s doesn't exist", languageName); elog(ERROR, "Language %s doesn't exist", languageName);
}
if (!((Form_pg_language) GETSTRUCT(langTup))->lanispl) if (!((Form_pg_language) GETSTRUCT(langTup))->lanispl)
{ {
@@ -195,9 +191,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL); tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{
elog(ERROR, "Language with name '%s' not found", languageName); elog(ERROR, "Language with name '%s' not found", languageName);
}
heap_delete(rdesc, &(tup->t_ctid)); heap_delete(rdesc, &(tup->t_ctid));

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); tle = lfirst(tl);
if (tle->resdom != NULL) if (tle->resdom != NULL)
{
tle->expr = tg_rewriteParamsInExpr(tle->expr, inputQlist); tle->expr = tg_rewriteParamsInExpr(tle->expr, inputQlist);
}
} }
} }
@@ -401,9 +399,7 @@ tg_rewriteQuery(TgRecipe * r,
if (orig->qual) if (orig->qual)
{ {
if (nodeTag(orig->qual) == T_List) if (nodeTag(orig->qual) == T_List)
{
elog(ERROR, "tg_rewriteQuery: Whoa! why is my qual a List???"); elog(ERROR, "tg_rewriteQuery: Whoa! why is my qual a List???");
}
orig->qual = tg_rewriteParamsInExpr(orig->qual, inputQlist); orig->qual = tg_rewriteParamsInExpr(orig->qual, inputQlist);
} }
@@ -514,9 +510,7 @@ tg_replaceNumberedParam(Node *expression,
} }
} }
else else
{
elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind); elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
}
} }
break; break;
case T_Expr: case T_Expr:
@@ -626,15 +620,11 @@ tg_rewriteParamsInExpr(Node *expression, QueryTreeList *inputQlist)
{ {
tle = lfirst(tl); tle = lfirst(tl);
if (strcmp(resname, tle->resdom->resname) == 0) if (strcmp(resname, tle->resdom->resname) == 0)
{
return tle->expr; return tle->expr;
}
} }
} }
else else
{
elog(ERROR, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid); elog(ERROR, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
}
} }
else else
@@ -648,9 +638,7 @@ tg_rewriteParamsInExpr(Node *expression, QueryTreeList *inputQlist)
} }
} }
else else
{
elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind); elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
}
} }
break; break;
case T_Expr: case T_Expr:
@@ -716,9 +704,7 @@ getParamTypes(TgElement * elem, Oid typev[])
parameterCount = 0; parameterCount = 0;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{
typev[i] = 0; typev[i] = 0;
}
for (j = 0; j < elem->inTypes->num; j++) for (j = 0; j < elem->inTypes->num; j++)
{ {
if (parameterCount == 8) if (parameterCount == 8)
@@ -736,13 +722,9 @@ getParamTypes(TgElement * elem, Oid typev[])
{ {
toid = TypeGet(elem->inTypes->val[j], &defined); toid = TypeGet(elem->inTypes->val[j], &defined);
if (!OidIsValid(toid)) if (!OidIsValid(toid))
{
elog(ERROR, "getParamTypes: arg type '%s' is not defined", t); elog(ERROR, "getParamTypes: arg type '%s' is not defined", t);
}
if (!defined) if (!defined)
{
elog(NOTICE, "getParamTypes: arg type '%s' is only a shell", t); elog(NOTICE, "getParamTypes: arg type '%s' is only a shell", t);
}
} }
typev[parameterCount++] = toid; typev[parameterCount++] = toid;
} }
@@ -904,9 +886,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
sprintf(newquery, "select %s($1", funcName); sprintf(newquery, "select %s($1", funcName);
for (i = 1; i < parameterCount; i++) for (i = 1; i < parameterCount; i++)
{
sprintf(newquery, "%s,$%d", newquery, i); sprintf(newquery, "%s,$%d", newquery, i);
}
sprintf(newquery, "%s)", newquery); sprintf(newquery, "%s)", newquery);
} }
else else
@@ -1071,9 +1051,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
"result", "result",
InvalidOid, InvalidOid,
-1, 0, false)) -1, 0, false))
{
elog(NOTICE, "tg_parseSubQuery: unexpected result from TupleDescInitEntry"); elog(NOTICE, "tg_parseSubQuery: unexpected result from TupleDescInitEntry");
}
else else
{ {
relid = heap_create_with_catalog( relid = heap_create_with_catalog(
@@ -1083,9 +1061,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
} }
} }
else if (n->nodeType == TG_RECIPE_NODE) else if (n->nodeType == TG_RECIPE_NODE)
{
elog(NOTICE, "tg_parseSubQuery: can't handle embedded recipes yet!"); elog(NOTICE, "tg_parseSubQuery: can't handle embedded recipes yet!");
}
else else
elog(NOTICE, "unknown nodeType: %d", n->nodeType); elog(NOTICE, "unknown nodeType: %d", n->nodeType);
@@ -1134,9 +1110,7 @@ OffsetVarAttno(Node *node, int varno, int offset)
List *l; List *l;
foreach(l, (List *) node) foreach(l, (List *) node)
{
OffsetVarAttno(lfirst(l), varno, offset); OffsetVarAttno(lfirst(l), varno, offset);
}
} }
break; break;
default: default:
@@ -1174,9 +1148,7 @@ appendQlist(QueryTreeList *q1, QueryTreeList *q2)
for (i = 0; i < q1->len; i++) for (i = 0; i < q1->len; i++)
newq->qtrees[i] = q1->qtrees[i]; newq->qtrees[i] = q1->qtrees[i];
for (j = 0; j < q2->len; j++) for (j = 0; j < q2->len; j++)
{
newq->qtrees[i + j] = q2->qtrees[j]; newq->qtrees[i + j] = q2->qtrees[j];
}
return newq; return newq;
} }
@@ -1225,9 +1197,7 @@ replaceSeqScan(Plan *plan, Plan *parent,
Result *newPlan; Result *newPlan;
if (plan == NULL) if (plan == NULL)
{
return; return;
}
if (plan->type == T_SeqScan) if (plan->type == T_SeqScan)
{ {
@@ -1288,13 +1258,9 @@ replaceSeqScan(Plan *plan, Plan *parent,
else else
{ {
if (plan->lefttree) if (plan->lefttree)
{
replaceSeqScan(plan->lefttree, plan, rt_ind, tplan); replaceSeqScan(plan->lefttree, plan, rt_ind, tplan);
}
if (plan->righttree) if (plan->righttree)
{
replaceSeqScan(plan->righttree, plan, rt_ind, tplan); 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, if (strcmp(teeInfo->val[i].tpi_relName,
rte->refname) == 0) rte->refname) == 0)
{
tplan = teeInfo->val[i].tpi_plan; tplan = teeInfo->val[i].tpi_plan;
}
} }
if (tplan == NULL) if (tplan == NULL)
{
elog(NOTICE, "replaceTeeScans didn't find the corresponding tee plan"); elog(NOTICE, "replaceTeeScans didn't find the corresponding tee plan");
}
/* /*
* replace the sequential scan node with that var number with * replace the sequential scan node with that var number with

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); 0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{
elog(ERROR, "RemoveFunction: type '%s' not found", typename); elog(ERROR, "RemoveFunction: type '%s' not found", typename);
}
argList[i] = tup->t_oid; argList[i] = tup->t_oid;
} }
} }
@@ -458,14 +456,10 @@ RemoveAggregate(char *aggName, char *aggType)
{ {
basetypeID = TypeGet(aggType, &defined); basetypeID = TypeGet(aggType, &defined);
if (!OidIsValid(basetypeID)) if (!OidIsValid(basetypeID))
{
elog(ERROR, "RemoveAggregate: type '%s' does not exist", aggType); elog(ERROR, "RemoveAggregate: type '%s' does not exist", aggType);
}
} }
else else
{
basetypeID = 0; basetypeID = 0;
}
/* /*
#ifndef NO_SECURITY #ifndef NO_SECURITY

View File

@@ -313,9 +313,7 @@ currval(struct varlena * seqin)
pfree(seqname); pfree(seqname);
if (elm->increment == 0) /* nextval/read_info were not called */ if (elm->increment == 0) /* nextval/read_info were not called */
{
elog(ERROR, "%s.currval is not yet defined in this session", elm->name); elog(ERROR, "%s.currval is not yet defined in this session", elm->name);
}
result = elm->last; result = elm->last;

View File

@@ -149,14 +149,10 @@ CreateTrigger(CreateTrigStmt *stmt)
ObjectIdGetDatum(((Form_pg_proc) GETSTRUCT(tuple))->prolang), ObjectIdGetDatum(((Form_pg_proc) GETSTRUCT(tuple))->prolang),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
{
elog(ERROR, "CreateTrigger: cache lookup for PL failed"); elog(ERROR, "CreateTrigger: cache lookup for PL failed");
}
if (((Form_pg_language) GETSTRUCT(langTup))->lanispl == false) if (((Form_pg_language) GETSTRUCT(langTup))->lanispl == false)
{
elog(ERROR, "CreateTrigger: only C and PL functions are supported"); elog(ERROR, "CreateTrigger: only C and PL functions are supported");
}
} }
MemSet(nulls, ' ', Natts_pg_trigger * sizeof(char)); MemSet(nulls, ' ', Natts_pg_trigger * sizeof(char));
@@ -598,9 +594,7 @@ ExecCallTriggerFunc(Trigger *trigger)
{ {
if (trigger->tgfunc.fn_addr == NULL) if (trigger->tgfunc.fn_addr == NULL)
{
fmgr_info(trigger->tgfoid, &trigger->tgfunc); fmgr_info(trigger->tgfoid, &trigger->tgfunc);
}
if (trigger->tgfunc.fn_plhandler != NULL) if (trigger->tgfunc.fn_plhandler != NULL)
{ {

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* get a relation list entry for this guy */
old = MemoryContextSwitchTo((MemoryContext) portalmem); old = MemoryContextSwitchTo((MemoryContext) portalmem);
if (vrl == (VRelList) NULL) if (vrl == (VRelList) NULL)
{
vrl = cur = (VRelList) palloc(sizeof(VRelListData)); vrl = cur = (VRelList) palloc(sizeof(VRelListData));
}
else else
{ {
cur->vrl_next = (VRelList) palloc(sizeof(VRelListData)); cur->vrl_next = (VRelList) palloc(sizeof(VRelListData));
@@ -1029,9 +1027,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
dowrite = true; dowrite = true;
} }
else else
{
Assert(isempty); Assert(isempty);
}
--Vnpages; --Vnpages;
Assert(Vnpages > 0); Assert(Vnpages > 0);
/* get prev reapped page from Vvpl */ /* get prev reapped page from Vvpl */
@@ -1054,9 +1050,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
} }
} }
else else
{
Assert(!isempty); Assert(!isempty);
}
vpc->vpd_blkno = blkno; vpc->vpd_blkno = blkno;
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
@@ -1529,9 +1523,7 @@ vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
index_delete(indrel, &res->index_iptr); index_delete(indrel, &res->index_iptr);
} }
else else
{
nitups++; nitups++;
}
/* be tidy */ /* be tidy */
pfree(res); pfree(res);
@@ -2219,9 +2211,7 @@ vc_clsindices(int nindices, Relation *Irel)
return; return;
while (nindices--) while (nindices--)
{
index_close(Irel[nindices]); index_close(Irel[nindices]);
}
pfree(Irel); pfree(Irel);
} /* vc_clsindices */ } /* vc_clsindices */

View File

@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', * Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements. * 'SHOW var' and 'RESET var' statements.
* *
* $Id: variable.c,v 1.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++; ecnt++;
} }
else else
{
elog(ERROR, "Bad value for date style (%s)", tok); elog(ERROR, "Bad value for date style (%s)", tok);
}
pfree(tok); pfree(tok);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 else
{
elog(ERROR, "attempted to define virtual relation with no attrs"); elog(ERROR, "attempted to define virtual relation with no attrs");
}
/* /*
* now create the parametesr for keys/inheritance etc. All of them are * now create the parametesr for keys/inheritance etc. All of them are

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) if (isindex)
{
relation = index_open(relationOid); relation = index_open(relationOid);
}
else else
relation = heap_open(relationOid); relation = heap_open(relationOid);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 else
{
cleanMap = NULL; cleanMap = NULL;
}
/* --------------------- /* ---------------------
* Finally create and initialize the JunkFilter. * Finally create and initialize the JunkFilter.

View File

@@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * 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; ++i;
} }
if (!ok) if (!ok)
{
elog(ERROR, "%s: %s", rname.data, aclcheck_error_strings[aclcheck_result]); elog(ERROR, "%s: %s", rname.data, aclcheck_error_strings[aclcheck_result]);
}
} }
/* =============================================================== /* ===============================================================
@@ -660,9 +658,7 @@ EndPlan(Plan *plan, EState *estate)
* ---------------- * ----------------
*/ */
if (intoRelationDesc != NULL) if (intoRelationDesc != NULL)
{
heap_close(intoRelationDesc); heap_close(intoRelationDesc);
}
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
@@ -1009,9 +1005,7 @@ ExecAppend(TupleTableSlot *slot,
*/ */
numIndices = resultRelationInfo->ri_NumIndices; numIndices = resultRelationInfo->ri_NumIndices;
if (numIndices > 0) if (numIndices > 0)
{
ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, false); ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, false);
}
(estate->es_processed)++; (estate->es_processed)++;
estate->es_lastoid = newId; estate->es_lastoid = newId;
@@ -1218,9 +1212,7 @@ ExecReplace(TupleTableSlot *slot,
numIndices = resultRelationInfo->ri_NumIndices; numIndices = resultRelationInfo->ri_NumIndices;
if (numIndices > 0) if (numIndices > 0)
{
ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, true); ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, true);
}
/* AFTER ROW UPDATE Triggers */ /* AFTER ROW UPDATE Triggers */
if (resultRelationDesc->trigdesc && if (resultRelationDesc->trigdesc &&

View File

@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * 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; return;
foreach(subp, node->initPlan) foreach(subp, node->initPlan)
{
ExecEndSubPlan((SubPlan *) lfirst(subp)); ExecEndSubPlan((SubPlan *) lfirst(subp));
}
foreach(subp, node->subPlan) foreach(subp, node->subPlan)
{
ExecEndSubPlan((SubPlan *) lfirst(subp)); ExecEndSubPlan((SubPlan *) lfirst(subp));
}
if (node->chgParam != NULL) if (node->chgParam != NULL)
{ {
freeList(node->chgParam); freeList(node->chgParam);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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: case PARAM_NAMED:
if (thisParameterKind == paramList->kind && if (thisParameterKind == paramList->kind &&
strcmp(paramList->name, thisParameterName) == 0) strcmp(paramList->name, thisParameterName) == 0)
{
matchFound = 1; matchFound = 1;
}
break; break;
case PARAM_NUM: case PARAM_NUM:
if (thisParameterKind == paramList->kind && if (thisParameterKind == paramList->kind &&
paramList->id == thisParameterId) paramList->id == thisParameterId)
{
matchFound = 1; matchFound = 1;
}
break; break;
case PARAM_OLD: case PARAM_OLD:
case PARAM_NEW: case PARAM_NEW:
@@ -454,9 +450,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
thisParameterKind); thisParameterKind);
} }
if (!matchFound) if (!matchFound)
{
paramList++; paramList++;
}
} /* while */ } /* while */
} /* if */ } /* if */
@@ -821,9 +815,7 @@ ExecMakeFunctionResult(Node *node,
* its func cache. * its func cache.
*/ */
if (*isDone) if (*isDone)
{
((Func *) node)->func_fcache = NULL; ((Func *) node)->func_fcache = NULL;
}
} }
return result; return result;
} }
@@ -1558,9 +1550,7 @@ ExecTargetList(List *targetlist,
#endif #endif
resind = fjRes->resno - 1; resind = fjRes->resno - 1;
if (fjIsNull[curNode]) if (fjIsNull[curNode])
{
null_head[resind] = 'n'; null_head[resind] = 'n';
}
else else
{ {
null_head[resind] = ' '; null_head[resind] = ' ';

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); pfree(predString);
} }
else else
{
predicate = NULL; predicate = NULL;
}
/* ---------------- /* ----------------
* save the index information into lists * save the index information into lists
@@ -916,9 +914,7 @@ ExecOpenIndices(Oid resultRelationOid,
i = 0; i = 0;
foreach(indexpreds, predList) foreach(indexpreds, predList)
{
indexInfoArray[i++]->ii_Predicate = lfirst(indexpreds); indexInfoArray[i++]->ii_Predicate = lfirst(indexpreds);
}
/* ---------------- /* ----------------
* store the index info array into relation info * store the index info array into relation info
* ---------------- * ----------------
@@ -1117,9 +1113,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
if (predicate != NULL) if (predicate != NULL)
{ {
if (econtext == NULL) if (econtext == NULL)
{
econtext = makeNode(ExprContext); econtext = makeNode(ExprContext);
}
econtext->ecxt_scantuple = slot; econtext->ecxt_scantuple = slot;
/* Skip this index-update if the predicate isn't satisfied */ /* Skip this index-update if the predicate isn't satisfied */

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * 30-8-1996
*/ */
if (es->qd->operation == CMD_UTILITY) if (es->qd->operation == CMD_UTILITY)
{
return (TupleDesc) NULL; return (TupleDesc) NULL;
}
#endif #endif
return ExecutorStart(es->qd, es->estate); return ExecutorStart(es->qd, es->estate);
} }
@@ -218,9 +216,7 @@ postquel_end(execution_state *es)
* 30-8-1996 * 30-8-1996
*/ */
if (es->qd->operation == CMD_UTILITY) if (es->qd->operation == CMD_UTILITY)
{
return; return;
}
#endif #endif
ExecutorEnd(es->qd, es->estate); ExecutorEnd(es->qd, es->estate);
} }

View File

@@ -405,9 +405,7 @@ ExecAgg(Agg *node)
* the tuples we aggregate over share the same group column) * the tuples we aggregate over share the same group column)
*/ */
if (!oneTuple) if (!oneTuple)
{
oneTuple = heap_copytuple(outerslot->val); oneTuple = heap_copytuple(outerslot->val);
}
nTuplesAgged++; nTuplesAgged++;
} }
@@ -437,13 +435,9 @@ ExecAgg(Agg *node)
args[1] = (char *) value2[i]; args[1] = (char *) value2[i];
} }
else if (aggfns->xfn1.fn_addr != NULL) else if (aggfns->xfn1.fn_addr != NULL)
{
args[0] = (char *) value1[i]; args[0] = (char *) value1[i];
}
else if (aggfns->xfn2.fn_addr != NULL) else if (aggfns->xfn2.fn_addr != NULL)
{
args[0] = (char *) value2[i]; args[0] = (char *) value2[i];
}
else else
elog(NOTICE, "ExecAgg: no valid transition functions??"); elog(NOTICE, "ExecAgg: no valid transition functions??");
value1[i] = (Datum) fmgr_c(&aggfns->finalfn, value1[i] = (Datum) fmgr_c(&aggfns->finalfn,
@@ -458,9 +452,7 @@ ExecAgg(Agg *node)
*/ */
} }
else if (aggfns->xfn2.fn_addr != NULL) else if (aggfns->xfn2.fn_addr != NULL)
{
value1[i] = value2[i]; value1[i] = value2[i];
}
else else
elog(ERROR, "ExecAgg: no valid transition functions??"); elog(ERROR, "ExecAgg: no valid transition functions??");
} }
@@ -475,9 +467,7 @@ ExecAgg(Agg *node)
aggstate->agg_done = ((Group *) outerPlan)->grpstate->grp_done; aggstate->agg_done = ((Group *) outerPlan)->grpstate->grp_done;
} }
else else
{
aggstate->agg_done = TRUE; aggstate->agg_done = TRUE;
}
/* ---------------- /* ----------------
* form a projection tuple, store it in the result tuple * form a projection tuple, store it in the result tuple

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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; int nSlots = 0;
foreach(plan, unionplans) foreach(plan, unionplans)
{
nSlots += ExecCountSlotsNode((Plan *) lfirst(plan)); nSlots += ExecCountSlotsNode((Plan *) lfirst(plan));
}
return nSlots + APPEND_NSLOTS; return nSlots + APPEND_NSLOTS;
} }
@@ -426,13 +424,9 @@ ExecProcAppend(Append *node)
whichplan = unionstate->as_whichplan; whichplan = unionstate->as_whichplan;
if (ScanDirectionIsForward(direction)) if (ScanDirectionIsForward(direction))
{
unionstate->as_whichplan = whichplan + 1; unionstate->as_whichplan = whichplan + 1;
}
else else
{
unionstate->as_whichplan = whichplan - 1; unionstate->as_whichplan = whichplan - 1;
}
/* ---------------- /* ----------------
* return something from next node or an empty slot * return something from next node or an empty slot
@@ -484,9 +478,7 @@ ExecEndAppend(Append *node)
for (i = 0; i < nplans; i++) for (i = 0; i < nplans; i++)
{ {
if (initialized[i] == TRUE) if (initialized[i] == TRUE)
{
ExecEndNode((Plan *) nth(i, unionplans), (Plan *) node); ExecEndNode((Plan *) nth(i, unionplans), (Plan *) node);
}
} }
/* ---------------- /* ----------------

View File

@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive) * columns. (ie. tuples from the same group are consecutive)
* *
* IDENTIFICATION * 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; firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */ /* this should occur on the first call only */
if (firsttuple == NULL) if (firsttuple == NULL)
{
grpstate->grp_firstTuple = heap_copytuple(outerTuple); grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
else else
{ {

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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; shmid = 0;
if (hashtable == NULL) if (hashtable == NULL)
{
elog(ERROR, "not enough memory for hashjoin."); elog(ERROR, "not enough memory for hashjoin.");
}
/* ---------------- /* ----------------
* initialize the hash table header * initialize the hash table header
* ---------------- * ----------------

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); ExecEvalExpr(scanexpr, exprCtxt, &isNull, &isDone);
scan_keys[j].sk_argument = scanvalue; scan_keys[j].sk_argument = scanvalue;
if (isNull) if (isNull)
{
scan_keys[j].sk_flags |= SK_ISNULL; scan_keys[j].sk_flags |= SK_ISNULL;
}
else else
{
scan_keys[j].sk_flags &= ~SK_ISNULL; scan_keys[j].sk_flags &= ~SK_ISNULL;
}
} }
} }
} }
@@ -885,9 +881,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* ---------------- * ----------------
*/ */
if (have_runtime_keys) if (have_runtime_keys)
{
indexstate->iss_RuntimeKeyInfo = (Pointer) runtimeKeyInfo; indexstate->iss_RuntimeKeyInfo = (Pointer) runtimeKeyInfo;
}
else else
{ {
indexstate->iss_RuntimeKeyInfo = NULL; indexstate->iss_RuntimeKeyInfo = NULL;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); MJ_DEBUG_QUAL(mergeclauses, qualResult);
if (qualResult) if (qualResult)
{
mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES; mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
}
else else
{
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER; mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
}
break; break;
/* /*
@@ -634,13 +630,9 @@ ExecMergeJoin(MergeJoin *node)
econtext->ecxt_innertuple = innerTupleSlot; econtext->ecxt_innertuple = innerTupleSlot;
if (TupIsNull(innerTupleSlot)) if (TupIsNull(innerTupleSlot))
{
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER; mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
}
else else
{
mergestate->mj_JoinState = EXEC_MJ_JOINTEST; mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
}
break; break;
/* /*
@@ -863,13 +855,9 @@ ExecMergeJoin(MergeJoin *node)
MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult); MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
if (compareResult) if (compareResult)
{
mergestate->mj_JoinState = EXEC_MJ_SKIPINNER; mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
}
else else
{
mergestate->mj_JoinState = EXEC_MJ_JOINMARK; mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
}
break; break;
/* /*
@@ -986,13 +974,9 @@ ExecMergeJoin(MergeJoin *node)
MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult); MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
if (compareResult) if (compareResult)
{
mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER; mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
}
else else
{
mergestate->mj_JoinState = EXEC_MJ_JOINMARK; mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
}
break; break;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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; needNewOuterTuple = false;
if (!TupIsNull(outerTupleSlot)) if (!TupIsNull(outerTupleSlot))
{
ENL1_printf("have outer tuple, deal with it"); ENL1_printf("have outer tuple, deal with it");
}
else else
{ {
ENL1_printf("outer tuple is nil, need new outer tuple"); ENL1_printf("outer tuple is nil, need new outer tuple");
@@ -196,9 +194,7 @@ ExecNestLoop(NestLoop *node, Plan *parent)
econtext->ecxt_innertuple = innerTupleSlot; econtext->ecxt_innertuple = innerTupleSlot;
if (TupIsNull(innerTupleSlot)) if (TupIsNull(innerTupleSlot))
{
ENL1_printf("couldn't get inner tuple - need new outer tuple"); ENL1_printf("couldn't get inner tuple - need new outer tuple");
}
else else
{ {
ENL1_printf("got inner and outer tuples"); ENL1_printf("got inner and outer tuples");

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) if ((outerPlan = outerPlan((Plan *) node)) != NULL)
{
slot = ExecProcNode(outerPlan, (Plan *) node); slot = ExecProcNode(outerPlan, (Plan *) node);
}
else else
{
slot = ExecScan(node, SeqNext); slot = ExecScan(node, SeqNext);
}
S1_printf("ExecSeqScan: returned tuple slot: %d\n", slot); S1_printf("ExecSeqScan: returned tuple slot: %d\n", slot);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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"); SO1_printf(stderr, "ExecSort: sorting done.\n");
} }
else else
{
slot = (TupleTableSlot *) sortstate->csstate.cstate.cs_ResultTupleSlot; slot = (TupleTableSlot *) sortstate->csstate.cstate.cs_ResultTupleSlot;
}
SO1_printf("ExecSort: %s\n", SO1_printf("ExecSort: %s\n",
"retrieving tuple from sorted relation"); "retrieving tuple from sorted relation");

View File

@@ -15,7 +15,7 @@
* ExecEndTee * ExecEndTee
* *
* IDENTIFICATION * 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 */ /* XXX doesn't handle backwards direction yet */
if (parent == node->leftParent) if (parent == node->leftParent)
{
branch = leftPlace; branch = leftPlace;
}
else if ((parent == node->rightParent) || (parent == (Plan *) node)) else if ((parent == node->rightParent) || (parent == (Plan *) node))
/* /*
* the tee node could be the root node of the plan, in which case, * the tee node could be the root node of the plan, in which case,
* we treat it like a right-parent pull * we treat it like a right-parent pull
*/ */
{
branch = rightPlace; branch = rightPlace;
}
else else
{ {
elog(ERROR, "A Tee node can only be executed from its left or right parent\n"); 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) if (parent == node->leftParent)
{
teeState->tee_leftPlace = leftPlace + 1; teeState->tee_leftPlace = leftPlace + 1;
}
else else
{
teeState->tee_rightPlace = rightPlace + 1; teeState->tee_rightPlace = rightPlace + 1;
}
return result; return result;
} }

View File

@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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; result = l->dll_head;
if (l->dll_head->dle_next) if (l->dll_head->dle_next)
{
l->dll_head->dle_next->dle_prev = 0; l->dll_head->dle_next->dle_prev = 0;
}
l->dll_head = l->dll_head->dle_next; l->dll_head = l->dll_head->dle_next;
@@ -199,9 +197,7 @@ DLRemTail(Dllist *l)
result = l->dll_tail; result = l->dll_tail;
if (l->dll_tail->dle_prev) if (l->dll_tail->dle_prev)
{
l->dll_tail->dle_prev->dle_next = 0; l->dll_tail->dle_prev->dle_next = 0;
}
l->dll_tail = l->dll_tail->dle_prev; l->dll_tail = l->dll_tail->dle_prev;
result->dle_prev = 0; result->dle_prev = 0;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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)); AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top)) if (!PointerIsValid(stack->top))
{
return (NULL); return (NULL);
}
pointer = FixedStackGetItemBase(stack, stack->top); pointer = FixedStackGetItemBase(stack, stack->top);
stack->top = stack->top->next; stack->top = stack->top->next;
@@ -110,9 +108,7 @@ FixedStackContains(FixedStack stack, Pointer pointer)
for (next = stack->top; FixedItemIsValid(next); next = next->next) for (next = stack->top; FixedItemIsValid(next); next = next->next)
{ {
if (next == item) if (next == item)
{
return (true); return (true);
}
} }
return (false); return (false);
} }
@@ -125,9 +121,7 @@ FixedStackGetTop(FixedStack stack)
AssertArg(FixedStackIsValid(stack)); AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top)) if (!PointerIsValid(stack->top))
{
return (NULL); return (NULL);
}
return (FixedStackGetItemBase(stack, stack->top)); return (FixedStackGetItemBase(stack, stack->top));
} }
@@ -144,9 +138,7 @@ FixedStackGetNext(FixedStack stack, Pointer pointer)
item = FixedStackGetItem(stack, pointer)->next; item = FixedStackGetItem(stack, pointer)->next;
if (!PointerIsValid(item)) if (!PointerIsValid(item))
{
return (NULL); return (NULL);
}
return (FixedStackGetItemBase(stack, item)); return (FixedStackGetItemBase(stack, item));
} }

View File

@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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)); res = (StringInfo) palloc(sizeof(StringInfoData));
if (res == NULL) if (res == NULL)
{
elog(ERROR, "makeStringInfo: Out of memory!"); elog(ERROR, "makeStringInfo: Out of memory!");
}
size = 100; size = 100;
res->data = palloc(size); res->data = palloc(size);
@@ -95,9 +93,7 @@ appendStringInfo(StringInfo str, char *buffer)
*/ */
newlen = 2 * str->len; newlen = 2 * str->len;
while (buflen + str->len >= newlen - 1) while (buflen + str->len >= newlen - 1)
{
newlen = 2 * newlen; newlen = 2 * newlen;
}
/* /*
* allocate enough space. * allocate enough space.

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* This should be moved to a more appropriate place. It is here * This should be moved to a more appropriate place. It is here
@@ -69,9 +69,7 @@ lo_open(Oid lobjId, int mode)
#endif #endif
if (fscxt == NULL) if (fscxt == NULL)
{
fscxt = CreateGlobalMemory("Filesystem"); fscxt = CreateGlobalMemory("Filesystem");
}
currentContext = MemoryContextSwitchTo((MemoryContext) fscxt); currentContext = MemoryContextSwitchTo((MemoryContext) fscxt);
lobjDesc = inv_open(lobjId, mode); lobjDesc = inv_open(lobjId, mode);
@@ -171,9 +169,7 @@ lo_creat(int mode)
Oid lobjId; Oid lobjId;
if (fscxt == NULL) if (fscxt == NULL)
{
fscxt = CreateGlobalMemory("Filesystem"); fscxt = CreateGlobalMemory("Filesystem");
}
currentContext = MemoryContextSwitchTo((MemoryContext) fscxt); currentContext = MemoryContextSwitchTo((MemoryContext) fscxt);

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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++) for (i = 0; i < nargs; i++)
{ {
if (args[i].len == VAR_LENGTH_ARG) if (args[i].len == VAR_LENGTH_ARG)
{
arg[i] = (char *) args[i].u.ptr; arg[i] = (char *) args[i].u.ptr;
}
else if (args[i].len > sizeof(int4)) else if (args[i].len > sizeof(int4))
{
elog(ERROR, "arg_length of argument %d too long", i); elog(ERROR, "arg_length of argument %d too long", i);
}
else else
{
arg[i] = (char *) args[i].u.integer; arg[i] = (char *) args[i].u.integer;
}
} }
/* ---------------- /* ----------------
@@ -107,13 +101,9 @@ PQfn(int fnid,
return "0"; return "0";
if (result_is_int) if (result_is_int)
{
*result_buf = (int) retval; *result_buf = (int) retval;
}
else else
{
memmove(result_buf, retval, result_len); memmove(result_buf, retval, result_len);
}
return "G"; return "G";
} }

View File

@@ -145,9 +145,7 @@ crypt_loadpwdfile()
{ /* free the old data only if this is a { /* free the old data only if this is a
* reload */ * reload */
while (pwd_cache_count--) while (pwd_cache_count--)
{
free((void *) pwd_cache[pwd_cache_count]); free((void *) pwd_cache[pwd_cache_count]);
}
free((void *) pwd_cache); free((void *) pwd_cache);
pwd_cache = NULL; pwd_cache = NULL;
pwd_cache_count = 0; pwd_cache_count = 0;

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* Read the charset */
next_token(file, buf, sizeof(buf)); next_token(file, buf, sizeof(buf));
if (buf[0] != '\0') if (buf[0] != '\0')
{
strcpy(HostCharset, buf); strcpy(HostCharset, buf);
}
} }
} }
break; break;
@@ -1005,9 +1003,7 @@ GetCharSetByHost(char TableName[], int host, const char DataDir[])
/* Read the base charset */ /* Read the base charset */
next_token(file, buf, sizeof(buf)); next_token(file, buf, sizeof(buf));
if (buf[0] != '\0') if (buf[0] != '\0')
{
strcpy(BaseCharset, buf); strcpy(BaseCharset, buf);
}
break; break;
case KEY_TABLE: case KEY_TABLE:
/* Read the original charset */ /* Read the original charset */
@@ -1046,9 +1042,7 @@ GetCharSetByHost(char TableName[], int host, const char DataDir[])
{ {
if (!strcasecmp(BaseCharset, ChArray[i]->Orig) && if (!strcasecmp(BaseCharset, ChArray[i]->Orig) &&
!strcasecmp(HostCharset, ChArray[i]->Dest)) !strcasecmp(HostCharset, ChArray[i]->Dest))
{
strncpy(TableName, ChArray[i]->Table, 79); strncpy(TableName, ChArray[i]->Table, 79);
}
free((struct CharsetItem *) ChArray[i]); free((struct CharsetItem *) ChArray[i]);
} }
} }

View File

@@ -48,9 +48,7 @@ verify_password(char *auth_arg, char *user, char *password)
test_pw = strtok(NULL, ":"); test_pw = strtok(NULL, ":");
if (!test_user || !test_pw || if (!test_user || !test_pw ||
test_user[0] == '\0' || test_pw[0] == '\0') test_user[0] == '\0' || test_pw[0] == '\0')
{
continue; continue;
}
/* kill the newline */ /* kill the newline */
if (test_pw[strlen(test_pw) - 1] == '\n') if (test_pw[strlen(test_pw) - 1] == '\n')

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 (portals[i] && portals[i]->portal)
{ {
if (!rule_p || portals[i]->portal->rule_p) if (!rule_p || portals[i]->portal->rule_p)
{
++n; ++n;
}
} }
} }
return (n); return (n);
@@ -690,9 +688,7 @@ PQnotifies_init()
PQNotifyList *p; PQNotifyList *p;
if (pqNotifyList == NULL) if (pqNotifyList == NULL)
{
pqNotifyList = DLNewList(); pqNotifyList = DLNewList();
}
else else
{ {
/* clean all notifies */ /* clean all notifies */

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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"); elog(FATAL, "pq_init: Couldn't initialize socket connection");
PQnotifies_init(); PQnotifies_init();
if (getenv("LIBPQ_DEBUG")) if (getenv("LIBPQ_DEBUG"))
{
Pfdebug = stderr; Pfdebug = stderr;
}
else else
{
Pfdebug = NULL; Pfdebug = NULL;
}
} }
/* ------------------------- /* -------------------------
@@ -229,9 +225,7 @@ PQgetline(char *s, int maxlen)
return (EOF); return (EOF);
if (fgets(s, maxlen - 1, Pfin) == NULL) if (fgets(s, maxlen - 1, Pfin) == NULL)
{
return feof(Pfin) ? EOF : 1; return feof(Pfin) ? EOF : 1;
}
else else
{ {
for (; *s; s++) for (; *s; s++)
@@ -643,9 +637,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
*fdP = fd; *fdP = fd;
if (family == AF_UNIX) if (family == AF_UNIX)
{
chmod(sock_path, 0777); chmod(sock_path, 0777);
}
return (STATUS_OK); return (STATUS_OK);
} }

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* This shouldn't be in libpq, but the monitor and some other * This shouldn't be in libpq, but the monitor and some other
@@ -56,9 +56,7 @@ pqsignal(int signo, pqsigfunc func)
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
act.sa_flags = 0; act.sa_flags = 0;
if (signo != SIGALRM) if (signo != SIGALRM)
{
act.sa_flags |= SA_RESTART; act.sa_flags |= SA_RESTART;
}
if (sigaction(signo, &act, &oact) < 0) if (sigaction(signo, &act, &oact) < 0)
return (SIG_ERR); return (SIG_ERR);
return (oact.sa_handler); return (oact.sa_handler);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 defined(__alpha)
if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL, if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
(unsigned long) NULL) < 0) (unsigned long) NULL) < 0)
{
elog(NOTICE, "setsysinfo failed: %d\n", errno); elog(NOTICE, "setsysinfo failed: %d\n", errno);
}
#endif #endif
#endif /* NOFIXADE || NOPRINTADE */ #endif /* NOFIXADE || NOPRINTADE */

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) foreach(l, list)
{ {
if (newlist == NIL) if (newlist == NIL)
{
newlist = nl = lcons(lfirst(l), NIL); newlist = nl = lcons(lfirst(l), NIL);
}
else else
{ {
lnext(nl) = lcons(lfirst(l), NIL); lnext(nl) = lcons(lfirst(l), NIL);
@@ -842,9 +840,7 @@ _copyConst(Const *from)
} }
} }
else else
{
newnode->constvalue = from->constvalue; newnode->constvalue = from->constvalue;
}
newnode->constisnull = from->constisnull; newnode->constisnull = from->constisnull;
newnode->constbyval = from->constbyval; newnode->constbyval = from->constbyval;
newnode->constisset = from->constisset; newnode->constisset = from->constisset;
@@ -1108,9 +1104,7 @@ CopyPathFields(Path *from, Path *newnode)
} }
} }
else else
{
Node_Copy(from, newnode, p_ordering.ord.merge); Node_Copy(from, newnode, p_ordering.ord.merge);
}
Node_Copy(from, newnode, keys); Node_Copy(from, newnode, keys);
@@ -1829,9 +1823,7 @@ copyObject(void *from)
foreach(l, list) foreach(l, list)
{ {
if (newlist == NIL) if (newlist == NIL)
{
newlist = nl = lcons(copyObject(lfirst(l)), NIL); newlist = nl = lcons(copyObject(lfirst(l)), NIL);
}
else else
{ {
lnext(nl) = lcons(copyObject(lfirst(l)), NIL); lnext(nl) = lcons(copyObject(lfirst(l)), NIL);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* XXX a few of the following functions are duplicated to handle * XXX a few of the following functions are duplicated to handle
@@ -122,9 +122,7 @@ nreverse(List *list)
return (list); return (list);
for (p = list; p != NULL; p = lnext(p)) for (p = list; p != NULL; p = lnext(p))
{
rlist = lcons(lfirst(p), rlist); rlist = lcons(lfirst(p), rlist);
}
lfirst(list) = lfirst(rlist); lfirst(list) = lfirst(rlist);
lnext(list) = lnext(rlist); lnext(list) = lnext(rlist);
@@ -324,9 +322,7 @@ LispUnion(List *l1, List *l2)
} }
} }
foreach(i, l2) foreach(i, l2)
{
retval = lappend(retval, lfirst(i)); retval = lappend(retval, lfirst(i));
}
return (retval); return (retval);
} }
@@ -356,9 +352,7 @@ LispUnioni(List *l1, List *l2)
} }
} }
foreach(i, l2) foreach(i, l2)
{
retval = lappendi(retval, lfirsti(i)); retval = lappendi(retval, lfirsti(i));
}
return (retval); return (retval);
} }
@@ -410,13 +404,9 @@ lremove(void *elem, List *list)
if (l != NULL) if (l != NULL)
{ {
if (prev == NIL) if (prev == NIL)
{
result = lnext(list); result = lnext(list);
}
else else
{
lnext(prev) = lnext(l); lnext(prev) = lnext(l);
}
} }
return result; return result;
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
@@ -690,9 +690,7 @@ _outFjoin(StringInfo str, Fjoin *node)
appendStringInfo(str, " :alwaysdone "); appendStringInfo(str, " :alwaysdone ");
for (i = 0; i < node->fj_nNodes; i++) for (i = 0; i < node->fj_nNodes; i++)
{
appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false"); 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, node->constisnull ? "true" : "false");
appendStringInfo(str, " :constvalue "); appendStringInfo(str, " :constvalue ");
if (node->constisnull) if (node->constisnull)
{
appendStringInfo(str, "<>"); appendStringInfo(str, "<>");
}
else else
{
_outDatum(str, node->constvalue, node->consttype); _outDatum(str, node->constvalue, node->consttype);
}
appendStringInfo(str, " :constbyval "); appendStringInfo(str, " :constbyval ");
appendStringInfo(str, node->constbyval ? "true" : "false"); 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 * without casting it to int first!! -mer 8 Jan 1991
*/ */
if (((int) length) <= -1) if (((int) length) <= -1)
{
length = VARSIZE(s); length = VARSIZE(s);
}
sprintf(buf, " %d [ ", length); sprintf(buf, " %d [ ", length);
appendStringInfo(str, buf); appendStringInfo(str, buf);
for (i = 0; i < length; i++) for (i = 0; i < length; i++)

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
@@ -69,9 +69,7 @@ pprint(void *obj)
for (;;) for (;;)
{ {
for (j = 0; j < indentLev * 3; j++) for (j = 0; j < indentLev * 3; j++)
{
line[j] = ' '; line[j] = ' ';
}
for (; j < 75 && s[i] != '\0'; i++, j++) for (; j < 75 && s[i] != '\0'; i++, j++)
{ {
line[j] = s[i]; line[j] = s[i];
@@ -109,9 +107,7 @@ pprint(void *obj)
printf("%s\n", line); printf("%s\n", line);
/* print the line before : and resets */ /* print the line before : and resets */
for (j = 0; j < indentLev * 3; j++) for (j = 0; j < indentLev * 3; j++)
{
line[j] = ' '; line[j] = ' ';
}
} }
line[j] = s[i]; line[j] = s[i];
break; break;
@@ -123,9 +119,7 @@ pprint(void *obj)
printf("%s\n", line); printf("%s\n", line);
} }
if (j != 0) if (j != 0)
{
printf("%s\n", line); printf("%s\n", line);
}
fflush(stdout); fflush(stdout);
return; return;
} }
@@ -211,14 +205,10 @@ print_expr(Node *expr, List *rtable)
print_expr((Node *) get_rightop(e), rtable); print_expr((Node *) get_rightop(e), rtable);
} }
else else
{
printf("an expr"); printf("an expr");
}
} }
else else
{
printf("not an expr"); 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); printf("\t%d %s\t", tle->resdom->resno, tle->resdom->resname);
if (tle->resdom->reskey != 0) if (tle->resdom->reskey != 0)
{
printf("(%d):\t", tle->resdom->reskey); printf("(%d):\t", tle->resdom->reskey);
}
else else
{
printf(" :\t"); printf(" :\t");
}
print_expr(tle->expr, rtable); print_expr(tle->expr, rtable);
printf("\n"); printf("\n");
} }

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
@@ -78,9 +78,7 @@ nodeTokenType(char *token, int length)
* skip the optional '-' (i.e. negative number) * skip the optional '-' (i.e. negative number)
*/ */
if (*token == '-') if (*token == '-')
{
token++; token++;
}
/* /*
* See if there is a decimal point * See if there is a decimal point
@@ -127,9 +125,7 @@ lsptok(char *string, int *length)
{ {
local_str = string; local_str = string;
if (length == NULL) if (length == NULL)
{
return (NULL); return (NULL);
}
} }
for (; *local_str == ' ' for (; *local_str == ' '
@@ -159,9 +155,7 @@ lsptok(char *string, int *length)
} }
else if (*local_str == ')' || *local_str == '(' || else if (*local_str == ')' || *local_str == '(' ||
*local_str == '}' || *local_str == '{') *local_str == '}' || *local_str == '{')
{
local_str++; local_str++;
}
else else
{ {
for (; *local_str != ' ' for (; *local_str != ' '
@@ -223,9 +217,7 @@ nodeRead(bool read_car_only)
this_value = (Node *) l; this_value = (Node *) l;
} }
else else
{
this_value = nodeRead(false); this_value = nodeRead(false);
}
break; break;
case RIGHT_PAREN: case RIGHT_PAREN:
this_value = NULL; this_value = NULL;
@@ -241,13 +233,9 @@ nodeRead(bool read_car_only)
* It might be NULL but it is an atom! * It might be NULL but it is an atom!
*/ */
if (read_car_only) if (read_car_only)
{
make_dotted_pair_cell = false; make_dotted_pair_cell = false;
}
else else
{
make_dotted_pair_cell = true; make_dotted_pair_cell = true;
}
} }
else else
{ {
@@ -293,18 +281,12 @@ nodeRead(bool read_car_only)
lfirst(l) = this_value; lfirst(l) = this_value;
if (!read_car_only) if (!read_car_only)
{
lnext(l) = nodeRead(false); lnext(l) = nodeRead(false);
}
else else
{
lnext(l) = NULL; lnext(l) = NULL;
}
return_value = (Node *) l; return_value = (Node *) l;
} }
else else
{
return_value = this_value; return_value = this_value;
}
return (return_value); return (return_value);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Most of the read functions for plan nodes are tested. (In fact, they * 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 */ token = lsptok(NULL, &length); /* now get the state */
if (length == 0) if (length == 0)
{
node->state = (EState *) NULL; node->state = (EState *) NULL;
}
else else
{ /* Disgusting hack until I figure out what { /* Disgusting hack until I figure out what
* to do here */ * to do here */
@@ -758,29 +756,17 @@ _readExpr()
token = lsptok(NULL, &length); /* eat :opType */ token = lsptok(NULL, &length); /* eat :opType */
token = lsptok(NULL, &length); /* get opType */ token = lsptok(NULL, &length); /* get opType */
if (!strncmp(token, "op", 2)) if (!strncmp(token, "op", 2))
{
local_node->opType = OP_EXPR; local_node->opType = OP_EXPR;
}
else if (!strncmp(token, "func", 4)) else if (!strncmp(token, "func", 4))
{
local_node->opType = FUNC_EXPR; local_node->opType = FUNC_EXPR;
}
else if (!strncmp(token, "or", 2)) else if (!strncmp(token, "or", 2))
{
local_node->opType = OR_EXPR; local_node->opType = OR_EXPR;
}
else if (!strncmp(token, "and", 3)) else if (!strncmp(token, "and", 3))
{
local_node->opType = AND_EXPR; local_node->opType = AND_EXPR;
}
else if (!strncmp(token, "not", 3)) else if (!strncmp(token, "not", 3))
{
local_node->opType = NOT_EXPR; local_node->opType = NOT_EXPR;
}
else if (!strncmp(token, "subp", 4)) else if (!strncmp(token, "subp", 4))
{
local_node->opType = SUBPLAN_EXPR; local_node->opType = SUBPLAN_EXPR;
}
token = lsptok(NULL, &length); /* eat :oper */ token = lsptok(NULL, &length); /* eat :oper */
local_node->oper = nodeRead(true); local_node->oper = nodeRead(true);
@@ -953,13 +939,9 @@ _readConst()
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->constisnull = true; local_node->constisnull = true;
}
else else
{
local_node->constisnull = false; local_node->constisnull = false;
}
token = lsptok(NULL, &length); /* get :constvalue */ token = lsptok(NULL, &length); /* get :constvalue */
@@ -981,13 +963,9 @@ _readConst()
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->constbyval = true; local_node->constbyval = true;
}
else else
{
local_node->constbyval = false; local_node->constbyval = false;
}
return (local_node); return (local_node);
} }
@@ -1019,13 +997,9 @@ _readFunc()
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->funcisindex = true; local_node->funcisindex = true;
}
else else
{
local_node->funcisindex = false; local_node->funcisindex = false;
}
token = lsptok(NULL, &length); /* get :funcsize */ token = lsptok(NULL, &length); /* get :funcsize */
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
@@ -1264,13 +1238,9 @@ _readRel()
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->indexed = true; local_node->indexed = true;
}
else else
{
local_node->indexed = false; local_node->indexed = false;
}
token = lsptok(NULL, &length); /* get :pages */ token = lsptok(NULL, &length); /* get :pages */
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
@@ -1817,13 +1787,9 @@ _readCInfo()
token = lsptok(NULL, &length); /* now read it */ token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->notclause = true; local_node->notclause = true;
}
else else
{
local_node->notclause = false; local_node->notclause = false;
}
token = lsptok(NULL, &length); /* get :indexids */ token = lsptok(NULL, &length); /* get :indexids */
local_node->indexids = nodeRead(true); /* now read it */ local_node->indexids = nodeRead(true); /* now read it */
@@ -1917,24 +1883,16 @@ _readJInfo()
token = lsptok(NULL, &length); /* get :mergesortable */ token = lsptok(NULL, &length); /* get :mergesortable */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->mergesortable = true; local_node->mergesortable = true;
}
else else
{
local_node->mergesortable = false; local_node->mergesortable = false;
}
token = lsptok(NULL, &length); /* get :hashjoinable */ token = lsptok(NULL, &length); /* get :hashjoinable */
if (!strncmp(token, "true", 4)) if (!strncmp(token, "true", 4))
{
local_node->hashjoinable = true; local_node->hashjoinable = true;
}
else else
{
local_node->hashjoinable = false; local_node->hashjoinable = false;
}
return (local_node); return (local_node);
} }
@@ -1979,193 +1937,99 @@ parsePlanString(void)
token = lsptok(NULL, &length); token = lsptok(NULL, &length);
if (!strncmp(token, "PLAN", length)) if (!strncmp(token, "PLAN", length))
{
return_value = _readPlan(); return_value = _readPlan();
}
else if (!strncmp(token, "RESULT", length)) else if (!strncmp(token, "RESULT", length))
{
return_value = _readResult(); return_value = _readResult();
}
else if (!strncmp(token, "APPEND", length)) else if (!strncmp(token, "APPEND", length))
{
return_value = _readAppend(); return_value = _readAppend();
}
else if (!strncmp(token, "JOIN", length)) else if (!strncmp(token, "JOIN", length))
{
return_value = _readJoin(); return_value = _readJoin();
}
else if (!strncmp(token, "NESTLOOP", length)) else if (!strncmp(token, "NESTLOOP", length))
{
return_value = _readNestLoop(); return_value = _readNestLoop();
}
else if (!strncmp(token, "MERGEJOIN", length)) else if (!strncmp(token, "MERGEJOIN", length))
{
return_value = _readMergeJoin(); return_value = _readMergeJoin();
}
else if (!strncmp(token, "HASHJOIN", length)) else if (!strncmp(token, "HASHJOIN", length))
{
return_value = _readHashJoin(); return_value = _readHashJoin();
}
else if (!strncmp(token, "SCAN", length)) else if (!strncmp(token, "SCAN", length))
{
return_value = _readScan(); return_value = _readScan();
}
else if (!strncmp(token, "SEQSCAN", length)) else if (!strncmp(token, "SEQSCAN", length))
{
return_value = _readSeqScan(); return_value = _readSeqScan();
}
else if (!strncmp(token, "INDEXSCAN", length)) else if (!strncmp(token, "INDEXSCAN", length))
{
return_value = _readIndexScan(); return_value = _readIndexScan();
}
else if (!strncmp(token, "TEMP", length)) else if (!strncmp(token, "TEMP", length))
{
return_value = _readTemp(); return_value = _readTemp();
}
else if (!strncmp(token, "SORT", length)) else if (!strncmp(token, "SORT", length))
{
return_value = _readSort(); return_value = _readSort();
}
else if (!strncmp(token, "AGGREG", length)) else if (!strncmp(token, "AGGREG", length))
{
return_value = _readAggreg(); return_value = _readAggreg();
}
else if (!strncmp(token, "SUBLINK", length)) else if (!strncmp(token, "SUBLINK", length))
{
return_value = _readSubLink(); return_value = _readSubLink();
}
else if (!strncmp(token, "AGG", length)) else if (!strncmp(token, "AGG", length))
{
return_value = _readAgg(); return_value = _readAgg();
}
else if (!strncmp(token, "UNIQUE", length)) else if (!strncmp(token, "UNIQUE", length))
{
return_value = _readUnique(); return_value = _readUnique();
}
else if (!strncmp(token, "HASH", length)) else if (!strncmp(token, "HASH", length))
{
return_value = _readHash(); return_value = _readHash();
}
else if (!strncmp(token, "RESDOM", length)) else if (!strncmp(token, "RESDOM", length))
{
return_value = _readResdom(); return_value = _readResdom();
}
else if (!strncmp(token, "EXPR", length)) else if (!strncmp(token, "EXPR", length))
{
return_value = _readExpr(); return_value = _readExpr();
}
else if (!strncmp(token, "ARRAYREF", length)) else if (!strncmp(token, "ARRAYREF", length))
{
return_value = _readArrayRef(); return_value = _readArrayRef();
}
else if (!strncmp(token, "ARRAY", length)) else if (!strncmp(token, "ARRAY", length))
{
return_value = _readArray(); return_value = _readArray();
}
else if (!strncmp(token, "VAR", length)) else if (!strncmp(token, "VAR", length))
{
return_value = _readVar(); return_value = _readVar();
}
else if (!strncmp(token, "CONST", length)) else if (!strncmp(token, "CONST", length))
{
return_value = _readConst(); return_value = _readConst();
}
else if (!strncmp(token, "FUNC", length)) else if (!strncmp(token, "FUNC", length))
{
return_value = _readFunc(); return_value = _readFunc();
}
else if (!strncmp(token, "OPER", length)) else if (!strncmp(token, "OPER", length))
{
return_value = _readOper(); return_value = _readOper();
}
else if (!strncmp(token, "PARAM", length)) else if (!strncmp(token, "PARAM", length))
{
return_value = _readParam(); return_value = _readParam();
}
else if (!strncmp(token, "ESTATE", length)) else if (!strncmp(token, "ESTATE", length))
{
return_value = _readEState(); return_value = _readEState();
}
else if (!strncmp(token, "REL", length)) else if (!strncmp(token, "REL", length))
{
return_value = _readRel(); return_value = _readRel();
}
else if (!strncmp(token, "TLE", length)) else if (!strncmp(token, "TLE", length))
{
return_value = _readTargetEntry(); return_value = _readTargetEntry();
}
else if (!strncmp(token, "RTE", length)) else if (!strncmp(token, "RTE", length))
{
return_value = _readRangeTblEntry(); return_value = _readRangeTblEntry();
}
else if (!strncmp(token, "PATH", length)) else if (!strncmp(token, "PATH", length))
{
return_value = _readPath(); return_value = _readPath();
}
else if (!strncmp(token, "INDEXPATH", length)) else if (!strncmp(token, "INDEXPATH", length))
{
return_value = _readIndexPath(); return_value = _readIndexPath();
}
else if (!strncmp(token, "JOINPATH", length)) else if (!strncmp(token, "JOINPATH", length))
{
return_value = _readJoinPath(); return_value = _readJoinPath();
}
else if (!strncmp(token, "MERGEPATH", length)) else if (!strncmp(token, "MERGEPATH", length))
{
return_value = _readMergePath(); return_value = _readMergePath();
}
else if (!strncmp(token, "HASHPATH", length)) else if (!strncmp(token, "HASHPATH", length))
{
return_value = _readHashPath(); return_value = _readHashPath();
}
else if (!strncmp(token, "ORDERKEY", length)) else if (!strncmp(token, "ORDERKEY", length))
{
return_value = _readOrderKey(); return_value = _readOrderKey();
}
else if (!strncmp(token, "JOINKEY", length)) else if (!strncmp(token, "JOINKEY", length))
{
return_value = _readJoinKey(); return_value = _readJoinKey();
}
else if (!strncmp(token, "MERGEORDER", length)) else if (!strncmp(token, "MERGEORDER", length))
{
return_value = _readMergeOrder(); return_value = _readMergeOrder();
}
else if (!strncmp(token, "CINFO", length)) else if (!strncmp(token, "CINFO", length))
{
return_value = _readCInfo(); return_value = _readCInfo();
}
else if (!strncmp(token, "JOINMETHOD", length)) else if (!strncmp(token, "JOINMETHOD", length))
{
return_value = _readJoinMethod(); return_value = _readJoinMethod();
}
else if (!strncmp(token, "JINFO", length)) else if (!strncmp(token, "JINFO", length))
{
return_value = _readJInfo(); return_value = _readJInfo();
}
else if (!strncmp(token, "HINFO", length)) else if (!strncmp(token, "HINFO", length))
{
return_value = _readHInfo(); return_value = _readHInfo();
}
else if (!strncmp(token, "ITER", length)) else if (!strncmp(token, "ITER", length))
{
return_value = _readIter(); return_value = _readIter();
}
else if (!strncmp(token, "QUERY", length)) else if (!strncmp(token, "QUERY", length))
{
return_value = _readQuery(); return_value = _readQuery();
}
else if (!strncmp(token, "SORTCLAUSE", length)) else if (!strncmp(token, "SORTCLAUSE", length))
{
return_value = _readSortClause(); return_value = _readSortClause();
}
else if (!strncmp(token, "GROUPCLAUSE", length)) else if (!strncmp(token, "GROUPCLAUSE", length))
{
return_value = _readGroupClause(); return_value = _readGroupClause();
}
else else
{
elog(ERROR, "badly formatted planstring \"%.10s\"...\n", token); elog(ERROR, "badly formatted planstring \"%.10s\"...\n", token);
}
return ((Node *) return_value); return ((Node *) return_value);
} }
@@ -2202,9 +2066,7 @@ readDatum(Oid type)
if (byValue) if (byValue)
{ {
if (length > sizeof(Datum)) if (length > sizeof(Datum))
{
elog(ERROR, "readValue: byval & length = %d", length); elog(ERROR, "readValue: byval & length = %d", length);
}
s = (char *) (&res); s = (char *) (&res);
for (i = 0; i < sizeof(Datum); i++) for (i = 0; i < sizeof(Datum); i++)
{ {
@@ -2213,9 +2075,7 @@ readDatum(Oid type)
} }
} }
else if (length <= 0) else if (length <= 0)
{
s = NULL; s = NULL;
}
else if (length >= 1) else if (length >= 1)
{ {
s = (char *) palloc(length); s = (char *) palloc(length);
@@ -2230,9 +2090,7 @@ readDatum(Oid type)
token = lsptok(NULL, &tokenLength); /* skip the ']' */ token = lsptok(NULL, &tokenLength); /* skip the ']' */
if (token[0] != ']') if (token[0] != ']')
{
elog(ERROR, "readValue: ']' expected, length =%d", length); elog(ERROR, "readValue: ']' expected, length =%d", length);
}
return (res); return (res);
} }

View File

@@ -3,7 +3,7 @@
* geqo_erx.c-- * geqo_erx.c--
* edge recombination crossover [ER] * 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 */ /* find destination for the newly entered point */
if (edge_table[new_gene[i - 1]].unused_edges > 0) if (edge_table[new_gene[i - 1]].unused_edges > 0)
{
new_gene[i] = gimme_gene(edge_table[(int) new_gene[i - 1]], edge_table); new_gene[i] = gimme_gene(edge_table[(int) new_gene[i - 1]], edge_table);
}
else else
{ /* cope with fault */ { /* cope with fault */

View File

@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 */ new_rels = lcons(gimme_clauseless_join(outer_rel, outer_rel), NIL); /* ??? MAU */
} }
else else
{
new_rels = lcons(gimme_clauseless_join(outer_rel, inner_rel), NIL); new_rels = lcons(gimme_clauseless_join(outer_rel, inner_rel), NIL);
}
} }
/* process new_rel->pathlist */ /* 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); rel = init_join_rel(outer_rel, get_join_rel(root, other_rels), joininfo);
} }
else else
{
rel = NULL; rel = NULL;
}
if (rel != NULL) if (rel != NULL)
join_list = lappend(join_list, rel); 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 */ temp = (Cost) inner_rel->tuples * (Cost) outer_rel->tuples; /* cartesian product */
if (joinrel->clauseinfo) if (joinrel->clauseinfo)
{
temp = temp * product_selec(joinrel->clauseinfo); temp = temp * product_selec(joinrel->clauseinfo);
}
if (temp >= (MAXINT - 1)) if (temp >= (MAXINT - 1))
{
ntuples = ceil(geqo_log((double) temp, (double) GEQO_LOG_BASE)); ntuples = ceil(geqo_log((double) temp, (double) GEQO_LOG_BASE));
}
else else
{
ntuples = ceil((double) temp); ntuples = ceil((double) temp);
}
if (ntuples < 1) if (ntuples < 1)
ntuples = 1; /* make the best case 1 instead of 0 */ ntuples = 1; /* make the best case 1 instead of 0 */

View File

@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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("______________________________\n");
printf("("); printf("(");
foreach(l, rel->relids) foreach(l, rel->relids)
{
printf("%d ", lfirsti(l)); printf("%d ", lfirsti(l));
}
printf("): size=%d width=%d\n", rel->size, rel->width); printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n"); printf("\tpath list:\n");
foreach(l, rel->pathlist) foreach(l, rel->pathlist)
{
geqo_print_path(root, lfirst(l), 1); geqo_print_path(root, lfirst(l), 1);
}
printf("\tcheapest path:\n"); printf("\tcheapest path:\n");
geqo_print_path(root, rel->cheapestpath, 1); geqo_print_path(root, rel->cheapestpath, 1);

View File

@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 else
{
elog(DEBUG, "geqo_params: ga parameter file\n\'%s\'\ndoes not exist or permissions are not setup correctly", conf_file); elog(DEBUG, "geqo_params: ga parameter file\n\'%s\'\ndoes not exist or permissions are not setup correctly", conf_file);
}
/* /*
* parameter checkings follow * parameter checkings follow
@@ -317,13 +315,9 @@ gimme_pool_size(int string_length)
size = pow(2.0, exponent); size = pow(2.0, exponent);
if (size < MIN_POOL) if (size < MIN_POOL)
{
return (MIN_POOL); return (MIN_POOL);
}
else if (size > MAX_POOL) else if (size > MAX_POOL)
{
return (MAX_POOL); return (MAX_POOL);
}
else else
return ((int) ceil(size)); return ((int) ceil(size));
} }

View File

@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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); rel->pathlist = lremove(unorderedpath, rel->pathlist);
} }
else else
{
rel->unorderedpath = (Path *) unorderedpath; rel->unorderedpath = (Path *) unorderedpath;
}
return (cheapest); return (cheapest);
} }

View File

@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 */ /* all gene */
chromo = (Chromosome *) new_pool->data; /* vector of all chromos */ chromo = (Chromosome *) new_pool->data; /* vector of all chromos */
for (i = 0; i < pool_size; i++) for (i = 0; i < pool_size; i++)
{
chromo[i].string = palloc((string_length + 1) * sizeof(Gene)); chromo[i].string = palloc((string_length + 1) * sizeof(Gene));
}
return (new_pool); return (new_pool);
} }

View File

@@ -6,7 +6,7 @@
* PX operator according to Syswerda * PX operator according to Syswerda
* (The Genetic Algorithms Handbook, L Davis, ed) * (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 */ /* initialize city table */
for (i = 1; i <= num_gene; i++) for (i = 1; i <= num_gene; i++)
{
city_table[i].used = 0; city_table[i].used = 0;
}
/* choose random positions that will be inherited directly from parent */ /* choose random positions that will be inherited directly from parent */
num_positions = geqo_randint(2 * num_gene / 3, num_gene / 3); num_positions = geqo_randint(2 * num_gene / 3, num_gene / 3);

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); id2 = (int) lsecond(joinrel->relids);
if (id1 > id2) if (id1 > id2)
{
tmprel_array[id2][id1] = *(Rel *) joinrel; tmprel_array[id2][id1] = *(Rel *) joinrel;
}
else else
{ {
tmprel_array[id1][id2] = *(Rel *) joinrel; /* ever reached? */ 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]; garel[1] = tmprel_array[1][3];
if (rel12->cheapestpath->path_cost > rel23->cheapestpath->path_cost) if (rel12->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
{
garel[2] = tmprel_array[2][3]; garel[2] = tmprel_array[2][3];
}
else else
{
garel[2] = tmprel_array[1][2]; garel[2] = tmprel_array[1][2];
}
} }
else else
{ {
garel[1] = tmprel_array[1][2]; garel[1] = tmprel_array[1][2];
if (rel13->cheapestpath->path_cost > rel23->cheapestpath->path_cost) if (rel13->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
{
garel[2] = tmprel_array[2][3]; garel[2] = tmprel_array[2][3];
}
else else
{
garel[2] = tmprel_array[1][3]; garel[2] = tmprel_array[1][3];
}
} }
} }
@@ -169,13 +159,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
if (connectto[tempn] != 0) if (connectto[tempn] != 0)
{ {
if (n > tempn) if (n > tempn)
{
joinrel = (Rel *) &tmprel_array[tempn][n]; joinrel = (Rel *) &tmprel_array[tempn][n];
}
else else
{
joinrel = (Rel *) &tmprel_array[n][tempn]; joinrel = (Rel *) &tmprel_array[n][tempn];
}
dist = joinrel->cheapestpath->path_cost; dist = joinrel->cheapestpath->path_cost;
if (dist < disttoconnect[tempn]) if (dist < disttoconnect[tempn])
@@ -192,13 +178,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
} }
n = nextn; n = nextn;
if (n > connectto[n]) if (n > connectto[n])
{
garel[i] = tmprel_array[connectto[n]][n]; garel[i] = tmprel_array[connectto[n]][n];
}
else else
{
garel[i] = tmprel_array[n][connectto[n]]; garel[i] = tmprel_array[n][connectto[n]];
}
i++; i++;
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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; root->join_relation_list_ = outer_rels;
} }
else else
{
root->join_relation_list_ = new_rels; root->join_relation_list_ = new_rels;
}
if (!BushyPlanFlag) if (!BushyPlanFlag)
outer_rels = new_rels; outer_rels = new_rels;
} }
@@ -407,16 +405,12 @@ debug_print_rel(Query *root, Rel *rel)
printf("("); printf("(");
foreach(l, rel->relids) foreach(l, rel->relids)
{
printf("%d ", lfirsti(l)); printf("%d ", lfirsti(l));
}
printf("): size=%d width=%d\n", rel->size, rel->width); printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n"); printf("\tpath list:\n");
foreach(l, rel->pathlist) foreach(l, rel->pathlist)
{
print_path(root, lfirst(l), 1); print_path(root, lfirst(l), 1);
}
printf("\tcheapest path:\n"); printf("\tcheapest path:\n");
print_path(root, rel->cheapestpath, 1); print_path(root, rel->cheapestpath, 1);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); clausenode = (CInfo *) lfirst(temp);
cost_clause = clausenode->selectivity; cost_clause = clausenode->selectivity;
if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause) if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause)
{
clausenode->selectivity = new_selectivity; clausenode->selectivity = new_selectivity;
}
} }
} }
@@ -225,18 +223,14 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
List *clause = lfirst(clauses); List *clause = lfirst(clauses);
if (clauses == NULL) if (clauses == NULL)
{
s1 = 1.0; s1 = 1.0;
}
else if (IsA(clause, Param)) else if (IsA(clause, Param))
{ {
/* XXX How're we handling this before?? -ay */ /* XXX How're we handling this before?? -ay */
s1 = 1.0; s1 = 1.0;
} }
else if (IsA(clause, Const)) else if (IsA(clause, Const))
{
s1 = ((bool) ((Const *) clause)->constvalue) ? 1.0 : 0.0; s1 = ((bool) ((Const *) clause)->constvalue) ? 1.0 : 0.0;
}
else if (IsA(clause, Var)) else if (IsA(clause, Var))
{ {
Oid relid = getrelid(((Var *) clause)->varno, Oid relid = getrelid(((Var *) clause)->varno,
@@ -369,9 +363,7 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
*/ */
if (length(clauses) < 2) if (length(clauses) < 2)
{
return (s1); return (s1);
}
else else
{ {
/* Compute selectivity of the 'or'ed subclauses. */ /* Compute selectivity of the 'or'ed subclauses. */

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); temp = rel->tuples * product_selec(rel->clauseinfo);
Assert(temp >= 0); Assert(temp >= 0);
if (temp >= (MAXINT - 1)) if (temp >= (MAXINT - 1))
{
temp1 = MAXINT; temp1 = MAXINT;
}
else else
{
temp1 = ceil((double) temp); temp1 = ceil((double) temp);
}
Assert(temp1 >= 0); Assert(temp1 >= 0);
Assert(temp1 <= MAXINT); Assert(temp1 <= MAXINT);
return (temp1); return (temp1);
@@ -449,9 +445,7 @@ compute_joinrel_size(JoinPath *joinpath)
temp = temp * product_selec(joinpath->pathclauseinfo); temp = temp * product_selec(joinpath->pathclauseinfo);
if (temp >= (MAXINT - 1)) if (temp >= (MAXINT - 1))
{
temp1 = MAXINT; temp1 = MAXINT;
}
else else
{ {

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 else if (leftop
&& match_index_to_operand(indexkey, && match_index_to_operand(indexkey,
(Expr *) leftop, rel, index)) (Expr *) leftop, rel, index))
{
join_op = ((Oper *) ((Expr *) clause)->oper)->opno; join_op = ((Oper *) ((Expr *) clause)->oper)->opno;
}
if (join_op && op_class(join_op, xclass, index->relam) && if (join_op && op_class(join_op, xclass, index->relam) &&
join_clause_p((Node *) clause)) join_clause_p((Node *) clause))
@@ -943,9 +941,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
!IsA(predicate->oper, Oper) || !IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) || !IsA(pred_var, Var) ||
!IsA(pred_const, Const)) !IsA(pred_const, Const))
{
return false; return false;
}
/* /*
* The implication can't be determined unless the predicate and the * The implication can't be determined unless the predicate and the
@@ -1161,9 +1157,7 @@ extract_restrict_clauses(List *clausegroup)
CInfo *cinfo = lfirst(l); CInfo *cinfo = lfirst(l);
if (!join_clause_p((Node *) cinfo->clause)) if (!join_clause_p((Node *) cinfo->clause))
{
restrict_cls = lappend(restrict_cls, cinfo); restrict_cls = lappend(restrict_cls, cinfo);
}
} }
return restrict_cls; return restrict_cls;
} }
@@ -1293,9 +1287,7 @@ create_index_paths(Query *root,
if (!(join_clause_p((Node *) clauseinfo->clause) && if (!(join_clause_p((Node *) clauseinfo->clause) &&
equal_path_merge_ordering(index->ordering, equal_path_merge_ordering(index->ordering,
clauseinfo->mergesortorder))) clauseinfo->mergesortorder)))
{
temp = false; temp = false;
}
} }
if (!join || temp) if (!join || temp)

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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. * wierd behavior.
*/ */
if (IsA_JoinPath(path)) if (IsA_JoinPath(path))
{
((Path *) lfirst(path))->outerjoincost = (Cost) 0; ((Path *) lfirst(path))->outerjoincost = (Cost) 0;
}
/* /*
* do it iff it is a join path, which is not always true, esp * 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) if (xmergeinfo)
{
clauses = xmergeinfo->jmethod.clauses; clauses = xmergeinfo->jmethod.clauses;
}
if (clauses) if (clauses)
{ {
@@ -374,19 +370,13 @@ match_unsorted_outer(Rel *joinrel,
joinrel->targetlist, clauses); joinrel->targetlist, clauses);
} }
else else
{
merge_pathkeys = outerpath->keys; merge_pathkeys = outerpath->keys;
}
if (best_innerjoin && if (best_innerjoin &&
path_is_cheaper(best_innerjoin, cheapest_inner)) path_is_cheaper(best_innerjoin, cheapest_inner))
{
nestinnerpath = best_innerjoin; nestinnerpath = best_innerjoin;
}
else else
{
nestinnerpath = cheapest_inner; nestinnerpath = cheapest_inner;
}
paths = lcons(create_nestloop_path(joinrel, paths = lcons(create_nestloop_path(joinrel,
outerrel, outerrel,
@@ -429,13 +419,9 @@ match_unsorted_outer(Rel *joinrel,
* wouldn't otherwise be considered. * wouldn't otherwise be considered.
*/ */
if (path_is_cheaper_than_sort) if (path_is_cheaper_than_sort)
{
mergeinnerpath->outerjoincost = outerpath->path_cost; mergeinnerpath->outerjoincost = outerpath->path_cost;
}
else else
{
mergeinnerpath = cheapest_inner; mergeinnerpath = cheapest_inner;
}
temp_node = temp_node =
lcons(create_mergesort_path(joinrel, lcons(create_mergesort_path(joinrel,
@@ -453,9 +439,7 @@ match_unsorted_outer(Rel *joinrel,
paths); paths);
} }
else else
{
temp_node = paths; temp_node = paths;
}
jp_list = nconc(jp_list, temp_node); jp_list = nconc(jp_list, temp_node);
} }
return (jp_list); return (jp_list);
@@ -518,9 +502,7 @@ match_unsorted_inner(Rel *joinrel,
} }
if (xmergeinfo) if (xmergeinfo)
{
clauses = ((JoinMethod *) xmergeinfo)->clauses; clauses = ((JoinMethod *) xmergeinfo)->clauses;
}
if (clauses) if (clauses)
{ {

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); joininfo);
} }
else else
{
rel = NULL; rel = NULL;
}
if (rel != NULL) if (rel != NULL)
join_list = lappend(join_list, rel); join_list = lappend(join_list, rel);

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