{
result = (int) (*proc_fn) (p, value);
if (typlen > 0)
- {
p += typlen;
- }
else
- {
p += INTALIGN(*(int32 *) p);
- }
}
if (result)
{
if (!and)
- {
return (1);
- }
}
else
{
if (and)
- {
return (0);
- }
}
}
if (and && result)
- {
return (1);
- }
else
- {
return (0);
- }
}
/*
tm->tm_sec = (((int) *time) % 60);
if (tm->tm_sec == 0)
- {
sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min);
- }
else
- {
sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
- }
result = palloc(strlen(buf) + 1);
}
if (size < 0)
- {
size = strlen(data);
- }
/* adjust string length for escapes */
len = size;
break;
default:
if (NOTPRINTABLE(*p))
- {
len += 3;
- }
}
}
len++;
r += 3;
}
else
- {
*r++ = c;
- }
}
}
*r = '\0';
int len;
if ((str == NULL) || (hdrsize < 0))
- {
return (char *) NULL;
- }
/* Compute result size */
len = strlen(str);
/* result has variable length */
if (size == 0)
- {
size = len + 1;
- }
else
/* result has variable length with maximum size */
if (size < 0)
- {
size = MIN(len, -size) + 1;
- }
result = (char *) palloc(hdrsize + size);
memset(result, 0, hdrsize + size);
if (rtn_size)
- {
*rtn_size = size;
- }
r = result + hdrsize;
for (p = str; *p;)
case '7':
c = VALUE(c);
if (isdigit(*p))
- {
c = (c << 3) + VALUE(*p++);
- }
if (isdigit(*p))
- {
c = (c << 3) + VALUE(*p++);
- }
*r++ = c;
break;
case 'b':
}
}
else
- {
*r++ = c;
- }
}
return ((char *) result);
int len;
if (str == NULL)
- {
return ((struct varlena *) NULL);
- }
result = (struct varlena *) string_input(str, 0, VARHDRSZ, &len);
VARSIZE(result) = len;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.37 1998/02/26 04:29:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.38 1998/06/15 19:27:44 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
if (bit != NULL)
{
if (bitmask != CSIGNBIT)
- {
bitmask <<= 1;
- }
else
{
bitP += 1;
case -1:
*infomask |= HEAP_HASVARLENA;
if (att[i]->attalign == 'd')
- {
data = (char *) DOUBLEALIGN(data);
- }
else
- {
data = (char *) INTALIGN(data);
- }
data_length = VARSIZE(DatumGetPointer(value[i]));
memmove(data, DatumGetPointer(value[i]), data_length);
data += data_length;
return (0);
if (attnum > 0)
- {
return (att_isnull(attnum - 1, tup->t_bits));
- }
else
switch (attnum)
{
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
- {
return ((Datum) fetchatt(&(att[0]), (char *) tp));
- }
else if (!HeapTupleAllFixed(tup))
{
int j = 0;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* first attribute is always at position zero */
if (attnum == 1)
- {
return (Datum) fetchatt(&(att[0]), (char *) tup + data_off);
- }
if (att[attnum]->attcacheoff != -1)
{
return (Datum) fetchatt(&(att[attnum]),
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
- {
return ((Datum) fetchatt(&(att[0]), (char *) tp));
- }
else if (!IndexTupleAllFixed(tup))
{
int j = 0;
size = IndexTupleSize(source);
if (*target == NULL)
- {
*target = (IndexTuple) palloc(size);
- }
ret = *target;
memmove((char *) ret, (char *) source, size);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
if (key[0].sk_flags & SK_ISNULL)
- {
return (false);
- }
if (key[0].sk_flags & SK_COMMUTE)
{
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- {
return (false);
- }
scanKeySize -= 1;
key++;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.39 1998/04/26 04:05:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.40 1998/06/15 19:27:45 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
* ----------------
*/
if (!strcmp(typename, relname))
- {
TupleDescMakeSelfReference(desc, attnum, relname);
- }
else
elog(ERROR, "DefineRelation: no such type %s",
typename);
pfree(datum);
}
else
- {
ReleaseBuffer(b);
- }
pfree(evec);
}
}
if ((bufblock = BufferGetBlockNumber(buffer)) != GISTP_ROOT)
- {
PageRestoreTempPage(left, p);
- }
WriteBuffer(leftbuf);
WriteBuffer(rightbuf);
/* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData)))
- {
res = gistnext(s, dir);
- }
else
- {
res = gistfirst(s, dir);
- }
return (res);
}
maxoff = PageGetMaxOffsetNumber(p);
if (ScanDirectionIsBackward(dir))
- {
n = OffsetNumberPrev(stk->gs_child);
- }
else
- {
n = OffsetNumberNext(stk->gs_child);
- }
so->s_stack = stk->gs_parent;
pfree(stk);
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
if (ScanDirectionIsForward(dir))
- {
n = OffsetNumberNext(n);
- }
else
- {
n = OffsetNumberPrev(n);
- }
b = ReadBuffer(s->relation, blk);
p = BufferGetPage(b);
po = (GISTPageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
- {
n = OffsetNumberPrev(stk->gs_child);
- }
else
- {
n = OffsetNumberNext(stk->gs_child);
- }
so->s_stack = stk->gs_parent;
pfree(stk);
po = (GISTPageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
- {
n = PageGetMaxOffsetNumber(p);
- }
else
- {
n = FirstOffsetNumber;
- }
}
}
}
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- {
return (false);
- }
scanKeySize -= 1;
key++;
break;
if (ScanDirectionIsBackward(dir))
- {
n = OffsetNumberPrev(n);
- }
else
- {
n = OffsetNumberNext(n);
- }
}
return (n);
ReleaseBuffer(b);
}
else
- {
ItemPointerSetInvalid(ip);
- }
return (ip);
}
* Set flags.
*/
if (RelationGetNumberOfBlocks(s->relation) == 0)
- {
s->flags = ScanUnmarked;
- }
else if (fromEnd)
- {
s->flags = ScanUnmarked | ScanUncheckedPrevious;
- }
else
- {
s->flags = ScanUnmarked | ScanUncheckedNext;
- }
s->scanFromEnd = fromEnd;
for (l = GISTScans;
l != (GISTScanList) NULL && l->gsl_scan != s;
l = l->gsl_next)
- {
prev = l;
- }
if (l == (GISTScanList) NULL)
elog(ERROR, "GiST scan list corrupted -- cannot find 0x%lx", s);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (do_expand ||
(metap->hashm_nkeys / (metap->hashm_maxbucket + 1))
> metap->hashm_ffactor)
- {
_hash_expandtable(rel, metabuf);
- }
_hash_relbuf(rel, metabuf, HASH_READ);
return (res);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.15 1998/01/07 21:01:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.16 1998/06/15 19:27:49 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
/* allocate an empty overflow page */
oaddr = _hash_getovfladdr(rel, metabufp);
if (oaddr == InvalidOvflAddress)
- {
elog(ERROR, "_hash_addovflpage: problem with _hash_getovfladdr.");
- }
ovflblkno = OADDR_TO_BLKNO(OADDR_OF(SPLITNUM(oaddr), OPAGENUM(oaddr)));
Assert(BlockNumberIsValid(ovflblkno));
ovflbuf = _hash_getbuf(rel, ovflblkno, HASH_WRITE);
if (offset > SPLITMASK)
{
if (++splitnum >= NCACHED)
- {
elog(ERROR, OVMSG);
- }
metap->OVFL_POINT = splitnum;
metap->SPARES[splitnum] = metap->SPARES[splitnum - 1];
metap->SPARES[splitnum - 1]--;
free_page++;
if (free_page >= NCACHED)
- {
elog(ERROR, OVMSG);
- }
/*
* This is tricky. The 1 indicates that you want the new page
*/
if (_hash_initbitmap(rel, metap, OADDR_OF(splitnum, offset),
1, free_page))
- {
elog(ERROR, "overflow_page: problem with _hash_initbitmap.");
- }
metap->SPARES[splitnum]++;
offset++;
if (offset > SPLITMASK)
{
if (++splitnum >= NCACHED)
- {
elog(ERROR, OVMSG);
- }
metap->OVFL_POINT = splitnum;
metap->SPARES[splitnum] = metap->SPARES[splitnum - 1];
metap->SPARES[splitnum - 1]--;
bit = 1 + bit + (i * BMPGSZ_BIT(metap));
if (bit >= metap->LAST_FREED)
- {
metap->LAST_FREED = bit - 1;
- }
/* Calculate the split number for this page */
for (i = 0; (i < splitnum) && (bit > metap->SPARES[i]); i++)
;
offset = (i ? bit - metap->SPARES[i - 1] : bit);
if (offset >= SPLITMASK)
- {
elog(ERROR, OVMSG);
- }
/* initialize this page */
oaddr = OADDR_OF(i, offset);
(splitnum ? metap->SPARES[splitnum - 1] : 0) + (addr & SPLITMASK) - 1;
if (ovflpgno < metap->LAST_FREED)
- {
metap->LAST_FREED = ovflpgno;
- }
bitmappage = (ovflpgno >> (metap->BSHIFT + BYTE_TO_BIT));
bitmapbit = ovflpgno & (BMPGSZ_BIT(metap) - 1);
* return that buffer with a write lock.
*/
if (BlockNumberIsValid(nextblkno))
- {
return (_hash_getbuf(rel, nextblkno, HASH_WRITE));
- }
else
- {
return (InvalidBuffer);
- }
}
{
rblkno = ropaque->hasho_nextblkno;
if (ropaque != wopaque)
- {
_hash_relbuf(rel, rbuf, HASH_WRITE);
- }
rbuf = _hash_getbuf(rel, rblkno, HASH_WRITE);
rpage = BufferGetPage(rbuf);
_hash_checkpage(rpage, LH_OVERFLOW_PAGE);
*/
rbuf = _hash_freeovflpage(rel, rbuf);
if (BufferIsValid(rbuf))
- {
_hash_relbuf(rel, rbuf, HASH_WRITE);
- }
if (rblkno == wblkno)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.15 1998/01/07 21:01:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.16 1998/06/15 19:27:49 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
if ((1 << i) < (metap->hashm_bsize -
(DOUBLEALIGN(sizeof(PageHeaderData)) +
DOUBLEALIGN(sizeof(HashPageOpaqueData)))))
- {
break;
- }
}
Assert(i);
metap->hashm_bmsize = 1 << i;
Buffer buf;
if (blkno == P_NEW)
- {
elog(ERROR, "_hash_getbuf: internal error: hash AM does not use P_NEW");
- }
switch (access)
{
case HASH_WRITE:
{
buf = _hash_freeovflpage(rel, buf);
if (BufferIsValid(buf))
- {
_hash_relbuf(rel, buf, HASH_WRITE);
- }
}
else
- {
_hash_relbuf(rel, buf, HASH_WRITE);
- }
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_WRITE);
metap = (HashMetaPage) BufferGetPage(metabuf);
opage = BufferGetPage(obuf);
_hash_checkpage(opage, LH_OVERFLOW_PAGE);
if (PageIsEmpty(opage))
- {
elog(ERROR, "_hash_splitpage: empty overflow page %d", oblkno);
- }
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.13 1998/01/07 21:01:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.14 1998/06/15 19:27:50 momjian Exp $
*
* NOTES
* Because we can be doing an index scan on a relation while we
for (chk = HashScans;
chk != (HashScanList) NULL && chk->hashsl_scan != scan;
chk = chk->hashsl_next)
- {
last = chk;
- }
if (chk == (HashScanList) NULL)
elog(ERROR, "hash scan list trashed; can't find 0x%lx", scan);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
bucket = 0;
}
else
- {
bucket = _hash_call(rel, metap, keyDatum);
- }
blkno = BUCKET_TO_BLKNO(bucket);
* next tuple, we come back with a lock on that buffer.
*/
if (!_hash_step(scan, &buf, dir, metabuf))
- {
return ((RetrieveIndexResult) NULL);
- }
/* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData);
if (PageIsEmpty(page))
{
if (BlockNumberIsValid(opaque->hasho_nextblkno))
- {
_hash_readnext(rel, &buf, &page, &opaque);
- }
else
{
ItemPointerSetInvalid(current);
if (ScanDirectionIsBackward(dir))
{
while (BlockNumberIsValid(opaque->hasho_nextblkno))
- {
_hash_readnext(rel, &buf, &page, &opaque);
- }
}
if (!_hash_step(scan, &buf, dir, metabuf))
- {
return ((RetrieveIndexResult) NULL);
- }
/* if we're here, _hash_step found a valid tuple */
current = &(scan->currentItemData);
*/
maxoff = PageGetMaxOffsetNumber(page);
if (ItemPointerIsValid(current))
- {
offnum = ItemPointerGetOffsetNumber(current);
- }
else
- {
offnum = InvalidOffsetNumber;
- }
/*
* 'offnum' now points to the last tuple we have seen (if any).
Assert(opaque->hasho_bucket == bucket);
while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno))
- {
_hash_readnext(rel, &buf, &page, &opaque);
- }
maxoff = PageGetMaxOffsetNumber(page);
offnum = FirstOffsetNumber;
}
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
Assert(opaque->hasho_bucket == bucket);
while (BlockNumberIsValid(opaque->hasho_nextblkno))
- {
_hash_readnext(rel, &buf, &page, &opaque);
- }
maxoff = offnum = PageGetMaxOffsetNumber(page);
}
else
*
*
* 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
unpinsdesc(HeapScanDesc sdesc)
{
if (BufferIsValid(sdesc->rs_pbuf))
- {
ReleaseBuffer(sdesc->rs_pbuf);
- }
/* ------------------------------------
* Scan will pin buffer one for each non-NULL tuple pointer
* ------------------------------------
*/
if (BufferIsValid(sdesc->rs_cbuf))
- {
ReleaseBuffer(sdesc->rs_cbuf);
- }
if (BufferIsValid(sdesc->rs_nbuf))
- {
ReleaseBuffer(sdesc->rs_nbuf);
- }
}
/* ------------------------------------------
#endif /* !defined(HEAPDEBUGALL) */
if (!ItemPointerIsValid(tid))
- {
Assert(!PointerIsValid(tid));
- }
/* ----------------
* return null immediately if relation is empty
* ----------------
*/
if (ItemPointerIsValid(tid) == false)
- {
tid = NULL;
- }
if (tid == NULL)
{
page = pages - 1; /* final page */
*b = RelationGetBufferWithBuffer(relation, page, *b);
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
- {
elog(ERROR, "heapgettup: failed ReadBuffer");
- }
#endif
dp = (Page) BufferGetPage(*b);
*b = RelationGetBufferWithBuffer(relation, page, *b);
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
- {
elog(ERROR, "heapgettup: failed ReadBuffer");
- }
#endif
dp = (Page) BufferGetPage(*b);
*/
lpp = PageGetItemId(dp, lineoff);
if (dir < 0)
- {
linesleft = lineoff - 1;
- }
else
- {
linesleft = lines - lineoff;
- }
/* ----------------
* advance the scan until we find a qualifying tuple or
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
- {
elog(ERROR, "heapgettup: failed ReadBuffer");
- }
#endif
dp = (Page) BufferGetPage(*b);
lines = lineoff = PageGetMaxOffsetNumber((Page) dp);
linesleft = lines - 1;
if (dir < 0)
- {
lpp = PageGetItemId(dp, lineoff);
- }
else
- {
lpp = PageGetItemId(dp, FirstOffsetNumber);
- }
}
}
r = (Relation) RelationIdGetRelation(relationId);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
- {
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
- }
return (r);
}
r = RelationNameGetRelation(relationName);
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
- {
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
- }
return (r);
}
*/
if (PointerIsValid(b))
- {
*b = buffer;
- }
else
{
tuple = heap_copytuple(tuple);
* ----------------
*/
if ((unsigned) DOUBLEALIGN(tup->t_len) <= PageGetFreeSpace((Page) dp))
- {
RelationPutHeapTuple(relation, BufferGetBlockNumber(buffer), tup);
- }
else
{
/* ----------------
* ----------------
*/
if (sdesc->rs_ptup != NULL)
- {
sdesc->rs_mptid = sdesc->rs_ptup->t_ctid;
- }
else
- {
ItemPointerSetInvalid(&sdesc->rs_mptid);
- }
if (sdesc->rs_ctup != NULL)
- {
sdesc->rs_mctid = sdesc->rs_ctup->t_ctid;
- }
else
- {
ItemPointerSetInvalid(&sdesc->rs_mctid);
- }
if (sdesc->rs_ntup != NULL)
- {
sdesc->rs_mntid = sdesc->rs_ntup->t_ctid;
- }
else
- {
ItemPointerSetInvalid(&sdesc->rs_mntid);
- }
}
/* ----------------
sdesc->rs_nbuf = InvalidBuffer;
if (!ItemPointerIsValid(&sdesc->rs_mptid))
- {
sdesc->rs_ptup = NULL;
- }
else
{
sdesc->rs_ptup = (HeapTuple)
}
if (!ItemPointerIsValid(&sdesc->rs_mctid))
- {
sdesc->rs_ctup = NULL;
- }
else
{
sdesc->rs_ctup = (HeapTuple)
}
if (!ItemPointerIsValid(&sdesc->rs_mntid))
- {
sdesc->rs_ntup = NULL;
- }
else
{
sdesc->rs_ntup = (HeapTuple)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.11 1998/01/07 21:01:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.12 1998/06/15 19:27:53 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
ItemPointerSetInvalid(&scan->nextMarkData);
if (numberOfKeys > 0)
- {
scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * numberOfKeys);
- }
else
- {
scan->keyData = NULL;
- }
index_rescan(scan, scanFromEnd, key);
index_getnext(scan, BackwardScanDirection);
if (result != NULL)
- {
scan->previousItemData = result->index_iptr;
- }
else
- {
ItemPointerSetInvalid(&scan->previousItemData);
- }
}
else if (scan->flags & ScanUncheckedNext)
index_getnext(scan, ForwardScanDirection);
if (result != NULL)
- {
scan->nextItemData = result->index_iptr;
- }
else
- {
ItemPointerSetInvalid(&scan->nextItemData);
- }
}
scan->previousMarkData = scan->previousItemData;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
for (index = 0; index < evaluation->maxStrategy; index += 1)
{
if (strategyMap->entry[index].sk_procedure == procedure)
- {
break;
- }
}
if (index == evaluation->maxStrategy)
if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy))
{
if (!StrategyNumberIsValid(strategy))
- {
elog(ERROR, "RelationGetStrategy: corrupted evaluation");
- }
}
return strategy;
(*termP)->operatorData[index].strategy);
if (!RegProcedureIsValid(entry->sk_procedure))
- {
break;
- }
}
if (index == (*termP)->degree)
if (!OidIsValid(iform->indkey[attributeIndex]))
{
if (attributeIndex == 0)
- {
elog(ERROR, "IndexSupportInitialize: no pg_index tuple");
- }
break;
}
loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)];
for (support = maxSupportNumber; --support >= 0;)
- {
loc[support] = InvalidOid;
- }
entry[1].sk_argument =
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
/* get next offnum */
if (offset < maxoff)
- {
offset = OffsetNumberNext(offset);
- }
else
{ /* move right ? */
if (P_RIGHTMOST(opaque))
*/
if (P_RIGHTMOST(ropaque))
- {
itemid = PageGetItemId(rightpage, P_HIKEY);
- }
else
- {
itemid = PageGetItemId(rightpage, P_FIRSTKEY);
- }
itemsz = ItemIdGetLength(itemid);
item = (BTItem) PageGetItem(rightpage, itemid);
first = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (afteritem == (BTItem) NULL)
- {
itup_off = _bt_binsrch(rel, buf, keysz, itup_scankey, BT_INSERTION);
- }
else
{
itup_off = first;
compare = (strat == BTLessStrategyNumber) ? true : false;
}
else
- {
compare = _bt_invokestrat(rel, i, strat, attrDatum1, attrDatum2);
- }
if (compare) /* true for one of ">, <, =" */
{
/* this should never happen (in theory) */
if (!BTItemSame(item, oldItem))
- {
elog(FATAL, "_bt_getstackbuf was lying!!");
- }
/*
* It's defined by caller (_bt_insertonpg)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.25 1998/02/26 04:29:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.26 1998/06/15 19:27:56 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
* into the btree.
*/
if (usefast)
- {
_bt_spool(index, btitem, spool);
- }
else
- {
res = _bt_doinsert(index, btitem, isunique, heap);
- }
pfree(btitem);
pfree(itup);
if (res)
- {
pfree(res);
- }
}
/* okay, all heap tuples are indexed */
*
*
* 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
for (chk = BTScans;
chk != (BTScanList) NULL && chk->btsl_scan != scan;
chk = chk->btsl_next)
- {
last = chk;
- }
if (chk == (BTScanList) NULL)
elog(ERROR, "btree scan list trashed; can't find 0x%lx", scan);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
while (offnum > limit
&& _bt_compare(rel, itupdesc, page,
keysz, scankey, OffsetNumberPrev(offnum)) == 0)
- {
offnum = OffsetNumberPrev(offnum);
- }
return (offnum);
}
* - see new comments above...
*/
if (!P_RIGHTMOST(opaque))
- {
elog(ERROR, "_bt_compare: invalid comparison to high key");
- }
#if 0
if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber))
- {
return (0);
- }
return (1);
#endif
}
tmpres = (long) -1; /* NOT_NULL "<" NULL */
}
else
- {
tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
- }
result = tmpres;
/* if the keys are unequal, return the difference */
if (ScanDirectionIsForward(dir))
{
if (!PageIsEmpty(page) && offnum < maxoff)
- {
offnum = OffsetNumberNext(offnum);
- }
else
{
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (!PageIsEmpty(page) && start <= maxoff)
- {
break;
- }
else
{
blkno = opaque->btpo_next;
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (offnum > start)
- {
offnum = OffsetNumberPrev(offnum);
- }
else
{
/* anything to look at here? */
if (!PageIsEmpty(page) && maxoff >= start)
- {
break;
- }
else
{
blkno = opaque->btpo_prev;
/* if we've hit end of scan we don't have to do any work */
if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
- {
return (false);
- }
else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque))
- {
return (false);
- }
/*
* Okay, it's off the page; let _bt_step() do the hard work, and we'll
break;
if (ScanDirectionIsForward(dir))
- {
offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
- }
else
- {
offnum = PageGetMaxOffsetNumber(page);
- }
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &(btitem->bti_itup);
}
/* new stuff ends here */
else
- {
ItemPointerSet(current, blkno, start);
- }
}
else if (ScanDirectionIsBackward(dir))
{
}
}
else
- {
elog(ERROR, "Illegal scan direction %d", dir);
- }
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, start));
itup = &(btitem->bti_itup);
*
*
* 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
*
if (child < q->btpq_nelem - 1)
{
if (GREATER(&(q->btpq_queue[child]), &(q->btpq_queue[child + 1])))
- {
++child;
- }
}
if (GREATER(&(q->btpq_queue[parent]), &(q->btpq_queue[child])))
{
parent = child;
}
else
- {
parent = child + 1;
- }
}
}
parent;
if (q->btpq_nelem >= MAXELEM)
- {
elog(ERROR, "_bt_pqadd: queue overflow");
- }
child = q->btpq_nelem++;
while (child > 0)
{
parent = child / 2;
if (GREATER(e, &(q->btpq_queue[parent])))
- {
break;
- }
else
{
q->btpq_queue[child] = q->btpq_queue[parent]; /* struct = */
BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
if (tape == (BTTapeBlock *) NULL)
- {
elog(ERROR, "_bt_tapecreate: out of memory");
- }
tape->bttb_magic = BTTAPEMAGIC;
BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
- {
return ((BTItem) NULL);
- }
bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz);
char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
if (btspool == (BTSpool *) NULL || fname == (char *) NULL)
- {
elog(ERROR, "_bt_spoolinit: out of memory");
- }
MemSet((char *) btspool, 0, sizeof(BTSpool));
btspool->bts_ntapes = ntapes;
btspool->bts_tape = 0;
(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
if (btspool->bts_itape == (BTTapeBlock **) NULL ||
btspool->bts_otape == (BTTapeBlock **) NULL)
- {
elog(ERROR, "_bt_spoolinit: out of memory");
- }
for (i = 0; i < ntapes; ++i)
{
for (i = 0; i < btspool->bts_ntapes; ++i)
{
if (!EMPTYTAPE(btspool->bts_otape[i]))
- {
_bt_tapewrite(btspool->bts_otape[i], 1);
- }
}
}
(BTSortKey *) palloc(it_ntup * sizeof(BTSortKey));
pos = itape->bttb_data;
for (i = 0; i < it_ntup; ++i)
- {
_bt_setsortkey(index, _bt_tapenext(itape, &pos), &(parray[i]));
- }
/*
* qsort the pointer array.
/* insert this item into the current buffer */
if (btitem != (BTItem) NULL)
- {
_bt_tapeadd(itape, btitem, itemsz);
- }
}
/*
* shuffling).
*/
for (o = last_off; o > first_off; o = OffsetNumberPrev(o))
- {
PageIndexTupleDelete(opage, o);
- }
hii = PageGetItemId(opage, P_HIKEY);
ii = PageGetItemId(opage, first_off);
*hii = *ii;
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
#endif
if (last_bti == (BTItem) NULL)
- {
first_off = P_FIRSTKEY;
- }
else if (!_bt_itemcmp(index, _bt_nattr,
bti, last_bti, BTEqualStrategyNumber))
- {
first_off = off;
- }
last_off = off;
last_bti = (BTItem) PageGetItem(npage, PageGetItemId(npage, off));
do
{
if (_bt_taperead(itape) == 0)
- {
tapedone[t] = 1;
- }
} while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t])
{
_bt_setsortkey(index, _bt_tapenext(itape, &tapepos[t]),
&(e.btpqe_item));
if (e.btpqe_item.btsk_item != (BTItem) NULL)
- {
_bt_pqadd(&q, &e);
- }
}
}
do
{
if (_bt_taperead(itape) == 0)
- {
tapedone[t] = 1;
- }
} while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t])
{
* pages instead of merging into a tape file.
*/
if (nruns <= btspool->bts_ntapes)
- {
doleaf = true;
- }
} while (nruns > 0); /* pass */
_bt_uppershutdown(index, state);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (i == numberOfKeys || cur->sk_attno != attno)
{
if (cur->sk_attno != attno + 1 && i < numberOfKeys)
- {
elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1);
- }
/*
* If = has been specified, no other key will be used. In case
/* btree doesn't support 'A is null' clauses, yet */
if (isNull || key[0].sk_flags & SK_ISNULL)
- {
return (false);
- }
if (key[0].sk_flags & SK_COMMUTE)
{
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- {
return (false);
- }
keysz -= 1;
key++;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* not cached, so we'll have to do some work */
if (ItemPointerIsValid(&(s->currentItemData)))
- {
res = rtnext(s, dir);
- }
else
- {
res = rtfirst(s, dir);
- }
return (res);
}
maxoff = PageGetMaxOffsetNumber(p);
if (ScanDirectionIsBackward(dir))
- {
n = OffsetNumberPrev(stk->rts_child);
- }
else
- {
n = OffsetNumberNext(stk->rts_child);
- }
so->s_stack = stk->rts_parent;
pfree(stk);
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
if (ScanDirectionIsForward(dir))
- {
n = OffsetNumberNext(n);
- }
else
- {
n = OffsetNumberPrev(n);
- }
b = ReadBuffer(s->relation, blk);
p = BufferGetPage(b);
po = (RTreePageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
- {
n = OffsetNumberPrev(stk->rts_child);
- }
else
- {
n = OffsetNumberNext(stk->rts_child);
- }
so->s_stack = stk->rts_parent;
pfree(stk);
po = (RTreePageOpaque) PageGetSpecialPointer(p);
if (ScanDirectionIsBackward(dir))
- {
n = PageGetMaxOffsetNumber(p);
- }
else
- {
n = FirstOffsetNumber;
- }
}
}
}
}
if (ScanDirectionIsBackward(dir))
- {
n = OffsetNumberPrev(n);
- }
else
- {
n = OffsetNumberNext(n);
- }
}
return (n);
ReleaseBuffer(b);
}
else
- {
ItemPointerSetInvalid(ip);
- }
return (ip);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
memmove(oldud, datum, VARSIZE(datum));
}
else
- {
memmove(oldud, datum, att_size);
- }
WriteBuffer(b);
/*
pfree(tdatum);
}
else
- {
ReleaseBuffer(b);
- }
pfree(datum);
}
}
if ((bufblock = BufferGetBlockNumber(buffer)) != P_ROOT)
- {
PageRestoreTempPage(left, p);
- }
WriteBuffer(leftbuf);
WriteBuffer(rightbuf);
/* okay, which page needs least enlargement? */
if (i == maxoff)
- {
item_1 = itup;
- }
else
- {
item_1 = (IndexTuple) PageGetItem(page, PageGetItemId(page, i));
- }
datum_alpha = ((char *) item_1) + sizeof(IndexTupleData);
union_dl = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_l, datum_alpha);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* Set flags.
*/
if (RelationGetNumberOfBlocks(s->relation) == 0)
- {
s->flags = ScanUnmarked;
- }
else if (fromEnd)
- {
s->flags = ScanUnmarked | ScanUncheckedPrevious;
- }
else
- {
s->flags = ScanUnmarked | ScanUncheckedNext;
- }
s->scanFromEnd = fromEnd;
p->s_stack = p->s_markstk = (RTSTACK *) NULL;
p->s_flags = 0x0;
for (i = 0; i < s->numberOfKeys; i++)
- {
p->s_internalKey[i].sk_argument = s->keyData[i].sk_argument;
- }
}
else
{
for (l = RTScans;
l != (RTScanList) NULL && l->rtsl_scan != s;
l = l->rtsl_next)
- {
prev = l;
- }
if (l == (RTScanList) NULL)
elog(ERROR, "rtree scan list corrupted -- cannot find 0x%lx", s);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.19 1998/01/07 21:02:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.20 1998/06/15 19:28:02 momjian Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
if (s->blockState == TBLOCK_INPROGRESS
|| s->blockState == TBLOCK_ENDABORT)
- {
return (true);
- }
return (false);
}
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.42 1998/05/29 17:00:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.43 1998/06/15 19:28:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
} /* while */
if (argc - optind > 1)
- {
usage();
- }
else if (argc - optind == 1)
- {
dbName = argv[optind];
- }
if (!DataDir)
{
}
if (reldesc != NULL)
- {
closerel(NULL);
- }
if (!Quiet)
printf("Amopen: relation %s. attrsize %d\n", relname ? relname : "(null)",
for (i = 0; i < numattr; i++)
{
if (attrtypes[i] == NULL)
- {
attrtypes[i] = AllocateAttribute();
- }
memmove((char *) attrtypes[i],
(char *) reldesc->rd_att->attrs[i],
ATTRIBUTE_TUPLE_SIZE);
}
if (reldesc == NULL)
- {
elog(ERROR, "Warning: no opened relation to close.\n");
- }
else
{
if (!Quiet)
pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
if (objectid != (Oid) 0)
- {
tuple->t_oid = objectid;
- }
heap_insert(reldesc, tuple);
pfree(tuple);
if (DebugMode)
if (DebugMode)
printf("Inserting null\n");
if (i < 0 || i >= MAXATTR)
- {
elog(FATAL, "i out of range (too many attrs): %d\n", i);
- }
values[i] = (char *) NULL;
Blanks[i] = 'n';
}
exitpg(1);
}
if (reldesc != (Relation) NULL)
- {
heap_close(reldesc);
- }
CommitTransactionCommand();
exitpg(Warnings);
}
for (i = 0; i <= n_types; i++)
{
if (strncmp(type, Procid[i].name, NAMEDATALEN) == 0)
- {
return (i);
- }
}
if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type);
(AttributeTupleForm) malloc(ATTRIBUTE_TUPLE_SIZE);
if (!PointerIsValid(attribute))
- {
elog(FATAL, "AllocateAttribute: malloc failed");
- }
MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE);
return (attribute);
node = FindStr(str, len, 0);
if (node)
- {
return (node->strnum);
- }
else
{
node = AddStr(str, len, 0);
return (node); /* no need to check */
}
else
- {
node = node->next;
- }
}
/* Couldn't find it in the list */
return (NULL);
hashresult = CompHash(str, strlength);
if (hashtable[hashresult] == NULL)
- {
hashtable[hashresult] = newnode;
- }
else
{ /* There is something in the list */
trail = hashtable[hashresult];
}
}
else
- {
newind->il_params = (Datum *) NULL;
- }
if (finfo != (FuncIndexInfo *) NULL)
{
memmove(newind->il_finfo, finfo, sizeof(FuncIndexInfo));
}
else
- {
newind->il_finfo = (FuncIndexInfo *) NULL;
- }
if (predInfo != NULL)
{
newind->il_predInfo->oldPred = predInfo->oldPred;
}
else
- {
newind->il_predInfo = NULL;
- }
newind->il_next = ILHead;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.10 1998/05/09 23:42:58 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.11 1998/06/15 19:28:06 momjian Exp $
*
* NOTES
* See acl.h.
htp = SearchSysCacheTuple(GRONAME, PointerGetDatum(groname),
0, 0, 0);
if (HeapTupleIsValid(htp))
- {
id = ((Form_pg_group) GETSTRUCT(htp))->grosysid;
- }
else
- {
elog(ERROR, "non-existent group \"%s\"", groname);
- }
return (id);
}
htp = SearchSysCacheTuple(GROSYSID, PointerGetDatum(grosysid),
0, 0, 0);
if (HeapTupleIsValid(htp))
- {
name = (((Form_pg_group) GETSTRUCT(htp))->groname).data;
- }
else
- {
elog(NOTICE, "get_groname: group %d not found", grosysid);
- }
return (name);
}
}
}
else
- {
elog(NOTICE, "in_group: group %d not found", gid);
- }
heap_close(relation);
return (found);
}
/* if no acl is found, use world default */
if (!acl)
- {
acl = acldefault(relname);
- }
num = ACL_NUM(acl);
aidat = ACL_DAT(acl);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.50 1998/06/14 13:31:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.51 1998/06/15 19:28:07 momjian Exp $
*
* INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation
rdesc->rd_rel->relchecks = tupDesc->constr->num_check;
for (i = 0; i < natts; i++)
- {
rdesc->rd_att->attrs[i]->attrelid = relid;
- }
rdesc->rd_id = relid;
{
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
- {
break;
- }
heap_delete(catalogRelation, &tuple->t_ctid);
}
{
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
- {
break;
- }
heap_delete(catalogRelation, &tuple->t_ctid);
}
{
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
- {
break;
- }
index_destroy(((IndexTupleForm) GETSTRUCT(tuple))->indexrelid);
}
*
*
* 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
pg_class_tuple = heap_getnext(pg_class_scan, 0, &buffer);
if (!HeapTupleIsValid(pg_class_tuple))
- {
relationObjectId = InvalidOid;
- }
else
{
relationObjectId = pg_class_tuple->t_oid;
IndexKeyType = IndexKey->tname;
}
else
- {
IndexKeyType = NULL;
- }
indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
pfree(predString);
}
else
- {
predText = (text *) fmgr(F_TEXTIN, "");
- }
predLen = VARSIZE(predText);
itupLen = predLen + sizeof(FormData_pg_index);
indexForm = (IndexTupleForm) palloc(itupLen);
pfree(predString);
}
else
- {
predText = (text *) fmgr(F_TEXTIN, "");
- }
/* open the index system catalog relation */
pg_index = heap_openr(IndexRelationName);
strsize);
}
else
- {
support = (RegProcedure *) NULL;
- }
/* ----------------
* fill in the index strategy structure with information
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
- {
heap_delete(catalogRelation, &tuple->t_ctid);
- }
heap_endscan(scan);
heap_close(catalogRelation);
*/
pg_class = heap_openr(RelationRelationName);
if (!RelationIsValid(pg_class))
- {
elog(ERROR, "UpdateStats: could not open RELATION relation");
- }
key[0].sk_argument = ObjectIdGetDatum(relid);
pg_class_scan =
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
int i;
for (i = 0; i < nIndices; i++)
- {
idescs[i] = index_openr(names[i]);
- }
}
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (strcmp(strVal(t), "opaque") == 0)
{
if (strcmp(languageName, "sql") == 0)
- {
elog(ERROR, "ProcedureDefine: sql functions cannot take type \"opaque\"");
- }
toid = 0;
}
else
if (strcmp(returnTypeName, "opaque") == 0)
{
if (strcmp(languageName, "sql") == 0)
- {
elog(ERROR, "ProcedureCreate: sql functions cannot return type \"opaque\"");
- }
typeObjectId = 0;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
typeObjectId = TypeGet(typeName, &defined);
if (OidIsValid(typeObjectId) && defined)
- {
elog(ERROR, "TypeCreate: type %s already defined", typeName);
- }
/* ----------------
* if this type has an associated elementType, then we check that
{
elementObjectId = TypeGet(elementTypeName, &defined);
if (!defined)
- {
elog(ERROR, "TypeCreate: type %s is not defined", elementTypeName);
- }
}
/* ----------------
0);
}
if (!HeapTupleIsValid(tup))
- {
func_error("TypeCreate", procname, 1, argList, NULL);
- }
}
values[i++] = (Datum) tup->t_oid; /* 11 - 14 */
/* check that that the new type is not already defined */
type_oid = TypeGet(newTypeName, &defined);
if (OidIsValid(type_oid) && defined)
- {
elog(ERROR, "TypeRename: type %s already defined", newTypeName);
- }
/* get the type tuple from the catalog index scan manager */
pg_type_desc = heap_openr(TypeRelationName);
}
else
- {
elog(ERROR, "TypeRename: type %s not defined", oldTypeName);
- }
/* finish up */
heap_close(pg_type_desc);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.12 1998/06/04 17:26:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.13 1998/06/15 19:28:17 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
attrname = (rdesc->rd_att->attrs[i]->attname).data;
if (notfirst == 1)
- {
sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
- }
else
{
sprintf(temp_buf, "%s = new.%s", attrname, attrname);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (kill(DatumGetInt32(d), SIGUSR2) < 0)
{
if (errno == ESRCH)
- {
heap_delete(lRel, &lTuple->t_ctid);
- }
}
#endif
}
extern TransactionState CurrentTransactionState;
if (notifyIssued)
- {
ClearPendingNotify();
- }
notifyIssued = 0;
if (pendingNotifies)
DLFreeList(pendingNotifies);
d = heap_getattr(htup, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d);
if (pid == MyProcPid)
- {
alreadyListener = 1;
- }
}
ReleaseBuffer(b);
}
RelationSetLockForWrite(lDesc);
if (lTuple != NULL)
- {
heap_delete(lDesc, &lTuple->t_ctid);
- }
RelationUnsetLockForWrite(lDesc);
heap_close(lDesc);
pq_flush();
}
else
- {
elog(NOTICE, "Async_NotifyFrontEnd: no asynchronous notification to frontend on interactive sessions");
- }
ReleaseBuffer(b);
}
CommitTransactionCommand();
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.27 1998/04/27 04:05:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.28 1998/06/15 19:28:12 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
form = (TypeTupleForm) GETSTRUCT(typeTuple);
if (!HeapTupleIsValid(typeTuple))
- {
elog(ERROR, "Add: type \"%s\" nonexistent", p);
- }
namestrcpy(&(attribute->attname), (char *) key[1].sk_argument);
attribute->atttypid = typeTuple->t_oid;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
fputs("\\N", fp); /* null indicator */
if (i == attr_count - 1)
- {
fputc('\n', fp);
- }
else
{
heap_endscan(scandesc);
if (binary)
- {
pfree(nulls);
- }
else
{
pfree(out_functions);
}
}
else
- {
indexPred[i] = NULL;
- }
}
}
}
nulls[i] = 'n';
}
else if (string == NULL)
- {
done = 1;
- }
else
{
values[i] =
*/
if (!PointerIsValid(values[i]) &&
!(rel->rd_att->attrs[i]->attbyval))
- {
elog(ERROR, "copy from line %d: Bad file format", lineno);
- }
}
}
#ifdef COPY_PATCH
if (!done)
- {
CopyReadNewline(fp, &newline);
- }
#endif
}
else
{ /* binary */
fread(&len, sizeof(int32), 1, fp);
if (feof(fp))
- {
done = 1;
- }
else
{
if (oids)
pfree((void *) values[i]);
}
else if (nulls[i] == 'n')
- {
nulls[i] = ' ';
- }
}
pfree(tuple);
*index_rels = (Relation *) palloc(*n_indices * sizeof(Relation));
for (i = 0, scan = head; i < *n_indices; i++, scan = scan->next)
- {
(*index_rels)[i] = index_open(scan->index_rel_oid);
- }
for (i = 0, scan = head; i < *n_indices + 1; i++)
{
val = (val << 3) + VALUE(c);
c = getc(fp);
if (ISOCTAL(c))
- {
val = (val << 3) + VALUE(c);
- }
else
{
if (feof(fp))
{
#ifdef COPY_PATCH
if (c == '\n')
- {
*newline = 1;
- }
#endif
done = 1;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
"MergeAttr: Can't inherit from non-existent superclass '%s'", name);
}
if (relation->rd_rel->relkind == 'S')
- {
elog(ERROR, "MergeAttr: Can't inherit from sequence superclass '%s'", name);
- }
tupleDesc = RelationGetTupleDescriptor(relation);
constr = tupleDesc->constr;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
sprintf(loc, "%s%c%s", dbpath, SEP_CHAR, dbname);
}
else
- {
strcpy(loc, dbname);
- }
lp = ExpandDatabasePath(loc);
check_permissions("destroydb", dbpath, dbname, &db_id, &user_id);
if (!OidIsValid(db_id))
- {
elog(FATAL, "impossible: pg_database instance with invalid OID.");
- }
/* stop the vacuum daemon */
stop_vacuum(dbpath, dbname);
/* Make sure we are not mucking with the template database */
if (!strcmp(dbname, "template1"))
- {
elog(ERROR, "%s cannot be executed on the template database.", command);
- }
/* Check to make sure database is not the currently open database */
if (!strcmp(dbname, DatabaseName))
- {
elog(ERROR, "%s cannot be executed on an open database", command);
- }
/* Check to make sure database is owned by this user */
*(path + VARSIZE(dbtext) - VARHDRSZ) = '\0';
}
else
- {
*dbIdP = InvalidOid;
- }
heap_close(dbrel);
dbname, SEP_CHAR, dbname);
}
else
- {
sprintf(filename, "%s%c%s.vacuum", dbpath, SEP_CHAR, dbname);
- }
if ((fp = AllocateFile(filename, "r")) != NULL)
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
numberOfAttributes = length(attributeList);
if (numberOfAttributes <= 0)
- {
elog(ERROR, "DefineIndex: must specify at least one attribute");
- }
/*
* compute heap relation id
List *item;
foreach(item, predList)
- {
CheckPredExpr(lfirst(item), rangeTable, baseRelOid);
- }
}
static void
elog(ERROR, "Unsupported partial-index predicate expression type");
foreach(clause, clauses)
- {
CheckPredExpr(lfirst(clause), rangeTable, baseRelOid);
- }
}
static void
if (!IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) ||
!IsA(pred_const, Const))
- {
elog(ERROR, "Unsupported partial-index predicate clause type");
- }
if (getrelid(pred_var->varno, rangeTable) != baseRelOid)
elog(ERROR,
ObjectIdGetDatum(atttypid),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
- {
return 0;
- }
return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname));
}
0, 0, 0);
if (!HeapTupleIsValid(tuple))
- {
elog(ERROR, "index \"%s\" nonexistent", name);
- }
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.24 1998/02/26 04:30:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.25 1998/06/15 19:28:15 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
ParamString *param = (ParamString *) lfirst(pl);
if (strcasecmp(param->name, "iscachable") == 0)
- {
*canCache_p = true;
- }
else if (strcasecmp(param->name, "trusted") == 0)
{
}
}
else if (strcasecmp(param->name, "outin_ratio") == 0)
- {
*outin_ratio_p = atoi(param->val);
- }
}
}
elog(ERROR, "setof type not implemented for leftarg");
if (nodeTag(defel->arg) == T_String)
- {
typeName1 = defGetString(defel);
- }
else
- {
elog(ERROR, "type for leftarg is malformed.");
- }
}
else if (!strcasecmp(defel->defname, "rightarg"))
{
elog(ERROR, "setof type not implemented for rightarg");
if (nodeTag(defel->arg) == T_String)
- {
typeName2 = defGetString(defel);
- }
else
- {
elog(ERROR, "type for rightarg is malformed.");
- }
}
else if (!strcasecmp(defel->defname, "procedure"))
- {
functionName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "precedence"))
{
/* NOT IMPLEMENTED (never worked in v4.2) */
elog(NOTICE, "CREATE OPERATOR: associativity not implemented");
}
else if (!strcasecmp(defel->defname, "commutator"))
- {
commutatorName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "negator"))
- {
negatorName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "restrict"))
- {
restrictionName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "join"))
- {
joinName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "hashes"))
- {
canHash = TRUE;
- }
else if (!strcasecmp(defel->defname, "sort1"))
{
/* ----------------
sortName1 = defGetString(defel);
}
else if (!strcasecmp(defel->defname, "sort2"))
- {
sortName2 = defGetString(defel);
- }
else
{
elog(NOTICE, "DefineOperator: attribute \"%s\" not recognized",
* make sure we have our required definitions
*/
if (functionName == NULL)
- {
elog(ERROR, "Define: \"procedure\" unspecified");
- }
/* ----------------
* now have OperatorCreate do all the work..
* sfunc1
*/
if (!strcasecmp(defel->defname, "sfunc1"))
- {
stepfunc1Name = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "basetype"))
- {
baseType = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "stype1"))
{
stepfunc1Type = defGetString(defel);
*/
}
else if (!strcasecmp(defel->defname, "sfunc2"))
- {
stepfunc2Name = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "stype2"))
{
stepfunc2Type = defGetString(defel);
*/
}
else if (!strcasecmp(defel->defname, "initcond1"))
- {
init1 = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "initcond2"))
- {
init2 = defGetString(defel);
- }
else
{
elog(NOTICE, "DefineAggregate: attribute \"%s\" not recognized",
DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "internallength"))
- {
internalLength = defGetTypeLength(defel);
- }
else if (!strcasecmp(defel->defname, "externallength"))
- {
externalLength = defGetTypeLength(defel);
- }
else if (!strcasecmp(defel->defname, "input"))
- {
inputName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "output"))
- {
outputName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "send"))
- {
sendName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "delimiter"))
{
char *p = defGetString(defel);
delimiter = p[0];
}
else if (!strcasecmp(defel->defname, "receive"))
- {
receiveName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "element"))
- {
elemName = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "default"))
- {
defaultValue = defGetString(defel);
- }
else if (!strcasecmp(defel->defname, "passedbyvalue"))
- {
byValue = true;
- }
else if (!strcasecmp(defel->defname, "alignment"))
{
char *a = defGetString(defel);
if (!strcasecmp(a, "double"))
- {
alignment = 'd';
- }
else if (!strcasecmp(a, "int"))
- {
alignment = 'i';
- }
else
{
elog(ERROR, "DefineType: \"%s\" alignment not recognized",
PointerGetDatum(languageName),
0, 0, 0);
if (HeapTupleIsValid(langTup))
- {
elog(ERROR, "Language %s already exists", languageName);
- }
/* ----------------
* Lookup the PL handler function and check that it is
PointerGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(langTup))
- {
elog(ERROR, "Language %s doesn't exist", languageName);
- }
if (!((Form_pg_language) GETSTRUCT(langTup))->lanispl)
{
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tup))
- {
elog(ERROR, "Language with name '%s' not found", languageName);
- }
heap_delete(rdesc, &(tup->t_ctid));
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
tle = lfirst(tl);
if (tle->resdom != NULL)
- {
tle->expr = tg_rewriteParamsInExpr(tle->expr, inputQlist);
- }
}
}
if (orig->qual)
{
if (nodeTag(orig->qual) == T_List)
- {
elog(ERROR, "tg_rewriteQuery: Whoa! why is my qual a List???");
- }
orig->qual = tg_rewriteParamsInExpr(orig->qual, inputQlist);
}
}
}
else
- {
elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
- }
}
break;
case T_Expr:
{
tle = lfirst(tl);
if (strcmp(resname, tle->resdom->resname) == 0)
- {
return tle->expr;
- }
}
}
else
- {
elog(ERROR, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
- }
}
else
}
}
else
- {
elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
- }
}
break;
case T_Expr:
parameterCount = 0;
for (i = 0; i < 8; i++)
- {
typev[i] = 0;
- }
for (j = 0; j < elem->inTypes->num; j++)
{
if (parameterCount == 8)
{
toid = TypeGet(elem->inTypes->val[j], &defined);
if (!OidIsValid(toid))
- {
elog(ERROR, "getParamTypes: arg type '%s' is not defined", t);
- }
if (!defined)
- {
elog(NOTICE, "getParamTypes: arg type '%s' is only a shell", t);
- }
}
typev[parameterCount++] = toid;
}
sprintf(newquery, "select %s($1", funcName);
for (i = 1; i < parameterCount; i++)
- {
sprintf(newquery, "%s,$%d", newquery, i);
- }
sprintf(newquery, "%s)", newquery);
}
else
"result",
InvalidOid,
-1, 0, false))
- {
elog(NOTICE, "tg_parseSubQuery: unexpected result from TupleDescInitEntry");
- }
else
{
relid = heap_create_with_catalog(
}
}
else if (n->nodeType == TG_RECIPE_NODE)
- {
elog(NOTICE, "tg_parseSubQuery: can't handle embedded recipes yet!");
- }
else
elog(NOTICE, "unknown nodeType: %d", n->nodeType);
List *l;
foreach(l, (List *) node)
- {
OffsetVarAttno(lfirst(l), varno, offset);
- }
}
break;
default:
for (i = 0; i < q1->len; i++)
newq->qtrees[i] = q1->qtrees[i];
for (j = 0; j < q2->len; j++)
- {
newq->qtrees[i + j] = q2->qtrees[j];
- }
return newq;
}
Result *newPlan;
if (plan == NULL)
- {
return;
- }
if (plan->type == T_SeqScan)
{
else
{
if (plan->lefttree)
- {
replaceSeqScan(plan->lefttree, plan, rt_ind, tplan);
- }
if (plan->righttree)
- {
replaceSeqScan(plan->righttree, plan, rt_ind, tplan);
- }
}
}
{
if (strcmp(teeInfo->val[i].tpi_relName,
rte->refname) == 0)
- {
tplan = teeInfo->val[i].tpi_plan;
- }
}
if (tplan == NULL)
- {
elog(NOTICE, "replaceTeeScans didn't find the corresponding tee plan");
- }
/*
* replace the sequential scan node with that var number with
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
0, 0, 0);
if (!HeapTupleIsValid(tup))
- {
elog(ERROR, "RemoveFunction: type '%s' not found", typename);
- }
argList[i] = tup->t_oid;
}
}
{
basetypeID = TypeGet(aggType, &defined);
if (!OidIsValid(basetypeID))
- {
elog(ERROR, "RemoveAggregate: type '%s' does not exist", aggType);
- }
}
else
- {
basetypeID = 0;
- }
/*
#ifndef NO_SECURITY
pfree(seqname);
if (elm->increment == 0) /* nextval/read_info were not called */
- {
elog(ERROR, "%s.currval is not yet defined in this session", elm->name);
- }
result = elm->last;
ObjectIdGetDatum(((Form_pg_proc) GETSTRUCT(tuple))->prolang),
0, 0, 0);
if (!HeapTupleIsValid(langTup))
- {
elog(ERROR, "CreateTrigger: cache lookup for PL failed");
- }
if (((Form_pg_language) GETSTRUCT(langTup))->lanispl == false)
- {
elog(ERROR, "CreateTrigger: only C and PL functions are supported");
- }
}
MemSet(nulls, ' ', Natts_pg_trigger * sizeof(char));
{
if (trigger->tgfunc.fn_addr == NULL)
- {
fmgr_info(trigger->tgfoid, &trigger->tgfunc);
- }
if (trigger->tgfunc.fn_plhandler != NULL)
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* get a relation list entry for this guy */
old = MemoryContextSwitchTo((MemoryContext) portalmem);
if (vrl == (VRelList) NULL)
- {
vrl = cur = (VRelList) palloc(sizeof(VRelListData));
- }
else
{
cur->vrl_next = (VRelList) palloc(sizeof(VRelListData));
dowrite = true;
}
else
- {
Assert(isempty);
- }
--Vnpages;
Assert(Vnpages > 0);
/* get prev reapped page from Vvpl */
}
}
else
- {
Assert(!isempty);
- }
vpc->vpd_blkno = blkno;
maxoff = PageGetMaxOffsetNumber(page);
index_delete(indrel, &res->index_iptr);
}
else
- {
nitups++;
- }
/* be tidy */
pfree(res);
return;
while (nindices--)
- {
index_close(Irel[nindices]);
- }
pfree(Irel);
} /* vc_clsindices */
* Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements.
*
- * $Id: variable.c,v 1.5 1998/03/30 16:45:59 momjian Exp $
+ * $Id: variable.c,v 1.6 1998/06/15 19:28:17 momjian Exp $
*
*/
ecnt++;
}
else
- {
elog(ERROR, "Bad value for date style (%s)", tok);
- }
pfree(tok);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
}
else
- {
elog(ERROR, "attempted to define virtual relation with no attrs");
- }
/*
* now create the parametesr for keys/inheritance etc. All of them are
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------
*/
if (isindex)
- {
relation = index_open(relationOid);
- }
else
relation = heap_open(relationOid);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
}
else
- {
cleanMap = NULL;
- }
/* ---------------------
* Finally create and initialize the JunkFilter.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
++i;
}
if (!ok)
- {
elog(ERROR, "%s: %s", rname.data, aclcheck_error_strings[aclcheck_result]);
- }
}
/* ===============================================================
* ----------------
*/
if (intoRelationDesc != NULL)
- {
heap_close(intoRelationDesc);
- }
}
/* ----------------------------------------------------------------
*/
numIndices = resultRelationInfo->ri_NumIndices;
if (numIndices > 0)
- {
ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, false);
- }
(estate->es_processed)++;
estate->es_lastoid = newId;
numIndices = resultRelationInfo->ri_NumIndices;
if (numIndices > 0)
- {
ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, true);
- }
/* AFTER ROW UPDATE Triggers */
if (resultRelationDesc->trigdesc &&
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
return;
foreach(subp, node->initPlan)
- {
ExecEndSubPlan((SubPlan *) lfirst(subp));
- }
foreach(subp, node->subPlan)
- {
ExecEndSubPlan((SubPlan *) lfirst(subp));
- }
if (node->chgParam != NULL)
{
freeList(node->chgParam);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
case PARAM_NAMED:
if (thisParameterKind == paramList->kind &&
strcmp(paramList->name, thisParameterName) == 0)
- {
matchFound = 1;
- }
break;
case PARAM_NUM:
if (thisParameterKind == paramList->kind &&
paramList->id == thisParameterId)
- {
matchFound = 1;
- }
break;
case PARAM_OLD:
case PARAM_NEW:
thisParameterKind);
}
if (!matchFound)
- {
paramList++;
- }
} /* while */
} /* if */
* its func cache.
*/
if (*isDone)
- {
((Func *) node)->func_fcache = NULL;
- }
}
return result;
}
#endif
resind = fjRes->resno - 1;
if (fjIsNull[curNode])
- {
null_head[resind] = 'n';
- }
else
{
null_head[resind] = ' ';
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
pfree(predString);
}
else
- {
predicate = NULL;
- }
/* ----------------
* save the index information into lists
i = 0;
foreach(indexpreds, predList)
- {
indexInfoArray[i++]->ii_Predicate = lfirst(indexpreds);
- }
/* ----------------
* store the index info array into relation info
* ----------------
if (predicate != NULL)
{
if (econtext == NULL)
- {
econtext = makeNode(ExprContext);
- }
econtext->ecxt_scantuple = slot;
/* Skip this index-update if the predicate isn't satisfied */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* 30-8-1996
*/
if (es->qd->operation == CMD_UTILITY)
- {
return (TupleDesc) NULL;
- }
#endif
return ExecutorStart(es->qd, es->estate);
}
* 30-8-1996
*/
if (es->qd->operation == CMD_UTILITY)
- {
return;
- }
#endif
ExecutorEnd(es->qd, es->estate);
}
* the tuples we aggregate over share the same group column)
*/
if (!oneTuple)
- {
oneTuple = heap_copytuple(outerslot->val);
- }
nTuplesAgged++;
}
args[1] = (char *) value2[i];
}
else if (aggfns->xfn1.fn_addr != NULL)
- {
args[0] = (char *) value1[i];
- }
else if (aggfns->xfn2.fn_addr != NULL)
- {
args[0] = (char *) value2[i];
- }
else
elog(NOTICE, "ExecAgg: no valid transition functions??");
value1[i] = (Datum) fmgr_c(&aggfns->finalfn,
*/
}
else if (aggfns->xfn2.fn_addr != NULL)
- {
value1[i] = value2[i];
- }
else
elog(ERROR, "ExecAgg: no valid transition functions??");
}
aggstate->agg_done = ((Group *) outerPlan)->grpstate->grp_done;
}
else
- {
aggstate->agg_done = TRUE;
- }
/* ----------------
* form a projection tuple, store it in the result tuple
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
int nSlots = 0;
foreach(plan, unionplans)
- {
nSlots += ExecCountSlotsNode((Plan *) lfirst(plan));
- }
return nSlots + APPEND_NSLOTS;
}
whichplan = unionstate->as_whichplan;
if (ScanDirectionIsForward(direction))
- {
unionstate->as_whichplan = whichplan + 1;
- }
else
- {
unionstate->as_whichplan = whichplan - 1;
- }
/* ----------------
* return something from next node or an empty slot
for (i = 0; i < nplans; i++)
{
if (initialized[i] == TRUE)
- {
ExecEndNode((Plan *) nth(i, unionplans), (Plan *) node);
- }
}
/* ----------------
* columns. (ie. tuples from the same group are consecutive)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.18 1998/02/26 04:31:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.19 1998/06/15 19:28:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */
if (firsttuple == NULL)
- {
grpstate->grp_firstTuple = heap_copytuple(outerTuple);
- }
else
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
shmid = 0;
if (hashtable == NULL)
- {
elog(ERROR, "not enough memory for hashjoin.");
- }
/* ----------------
* initialize the hash table header
* ----------------
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
ExecEvalExpr(scanexpr, exprCtxt, &isNull, &isDone);
scan_keys[j].sk_argument = scanvalue;
if (isNull)
- {
scan_keys[j].sk_flags |= SK_ISNULL;
- }
else
- {
scan_keys[j].sk_flags &= ~SK_ISNULL;
- }
}
}
}
* ----------------
*/
if (have_runtime_keys)
- {
indexstate->iss_RuntimeKeyInfo = (Pointer) runtimeKeyInfo;
- }
else
{
indexstate->iss_RuntimeKeyInfo = NULL;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
MJ_DEBUG_QUAL(mergeclauses, qualResult);
if (qualResult)
- {
mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
- }
else
- {
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
- }
break;
/*
econtext->ecxt_innertuple = innerTupleSlot;
if (TupIsNull(innerTupleSlot))
- {
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
- }
else
- {
mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
- }
break;
/*
MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
if (compareResult)
- {
mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
- }
else
- {
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
- }
break;
/*
MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
if (compareResult)
- {
mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
- }
else
- {
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
- }
break;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
needNewOuterTuple = false;
if (!TupIsNull(outerTupleSlot))
- {
ENL1_printf("have outer tuple, deal with it");
- }
else
{
ENL1_printf("outer tuple is nil, need new outer tuple");
econtext->ecxt_innertuple = innerTupleSlot;
if (TupIsNull(innerTupleSlot))
- {
ENL1_printf("couldn't get inner tuple - need new outer tuple");
- }
else
{
ENL1_printf("got inner and outer tuples");
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------
*/
if ((outerPlan = outerPlan((Plan *) node)) != NULL)
- {
slot = ExecProcNode(outerPlan, (Plan *) node);
- }
else
- {
slot = ExecScan(node, SeqNext);
- }
S1_printf("ExecSeqScan: returned tuple slot: %d\n", slot);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
SO1_printf(stderr, "ExecSort: sorting done.\n");
}
else
- {
slot = (TupleTableSlot *) sortstate->csstate.cstate.cs_ResultTupleSlot;
- }
SO1_printf("ExecSort: %s\n",
"retrieving tuple from sorted relation");
* ExecEndTee
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.17 1998/04/24 14:41:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.18 1998/06/15 19:28:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* XXX doesn't handle backwards direction yet */
if (parent == node->leftParent)
- {
branch = leftPlace;
- }
else if ((parent == node->rightParent) || (parent == (Plan *) node))
/*
* the tee node could be the root node of the plan, in which case,
* we treat it like a right-parent pull
*/
- {
branch = rightPlace;
- }
else
{
elog(ERROR, "A Tee node can only be executed from its left or right parent\n");
}
if (parent == node->leftParent)
- {
teeState->tee_leftPlace = leftPlace + 1;
- }
else
- {
teeState->tee_rightPlace = rightPlace + 1;
- }
return result;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
result = l->dll_head;
if (l->dll_head->dle_next)
- {
l->dll_head->dle_next->dle_prev = 0;
- }
l->dll_head = l->dll_head->dle_next;
result = l->dll_tail;
if (l->dll_tail->dle_prev)
- {
l->dll_tail->dle_prev->dle_next = 0;
- }
l->dll_tail = l->dll_tail->dle_prev;
result->dle_prev = 0;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top))
- {
return (NULL);
- }
pointer = FixedStackGetItemBase(stack, stack->top);
stack->top = stack->top->next;
for (next = stack->top; FixedItemIsValid(next); next = next->next)
{
if (next == item)
- {
return (true);
- }
}
return (false);
}
AssertArg(FixedStackIsValid(stack));
if (!PointerIsValid(stack->top))
- {
return (NULL);
- }
return (FixedStackGetItemBase(stack, stack->top));
}
item = FixedStackGetItem(stack, pointer)->next;
if (!PointerIsValid(item))
- {
return (NULL);
- }
return (FixedStackGetItemBase(stack, item));
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
res = (StringInfo) palloc(sizeof(StringInfoData));
if (res == NULL)
- {
elog(ERROR, "makeStringInfo: Out of memory!");
- }
size = 100;
res->data = palloc(size);
*/
newlen = 2 * str->len;
while (buflen + str->len >= newlen - 1)
- {
newlen = 2 * newlen;
- }
/*
* allocate enough space.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.20 1998/05/12 21:43:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.21 1998/06/15 19:28:25 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
#endif
if (fscxt == NULL)
- {
fscxt = CreateGlobalMemory("Filesystem");
- }
currentContext = MemoryContextSwitchTo((MemoryContext) fscxt);
lobjDesc = inv_open(lobjId, mode);
Oid lobjId;
if (fscxt == NULL)
- {
fscxt = CreateGlobalMemory("Filesystem");
- }
currentContext = MemoryContextSwitchTo((MemoryContext) fscxt);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < nargs; i++)
{
if (args[i].len == VAR_LENGTH_ARG)
- {
arg[i] = (char *) args[i].u.ptr;
- }
else if (args[i].len > sizeof(int4))
- {
elog(ERROR, "arg_length of argument %d too long", i);
- }
else
- {
arg[i] = (char *) args[i].u.integer;
- }
}
/* ----------------
return "0";
if (result_is_int)
- {
*result_buf = (int) retval;
- }
else
- {
memmove(result_buf, retval, result_len);
- }
return "G";
}
{ /* free the old data only if this is a
* reload */
while (pwd_cache_count--)
- {
free((void *) pwd_cache[pwd_cache_count]);
- }
free((void *) pwd_cache);
pwd_cache = NULL;
pwd_cache_count = 0;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* Read the charset */
next_token(file, buf, sizeof(buf));
if (buf[0] != '\0')
- {
strcpy(HostCharset, buf);
- }
}
}
break;
/* Read the base charset */
next_token(file, buf, sizeof(buf));
if (buf[0] != '\0')
- {
strcpy(BaseCharset, buf);
- }
break;
case KEY_TABLE:
/* Read the original charset */
{
if (!strcasecmp(BaseCharset, ChArray[i]->Orig) &&
!strcasecmp(HostCharset, ChArray[i]->Dest))
- {
strncpy(TableName, ChArray[i]->Table, 79);
- }
free((struct CharsetItem *) ChArray[i]);
}
}
test_pw = strtok(NULL, ":");
if (!test_user || !test_pw ||
test_user[0] == '\0' || test_pw[0] == '\0')
- {
continue;
- }
/* kill the newline */
if (test_pw[strlen(test_pw) - 1] == '\n')
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (portals[i] && portals[i]->portal)
{
if (!rule_p || portals[i]->portal->rule_p)
- {
++n;
- }
}
}
return (n);
PQNotifyList *p;
if (pqNotifyList == NULL)
- {
pqNotifyList = DLNewList();
- }
else
{
/* clean all notifies */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
elog(FATAL, "pq_init: Couldn't initialize socket connection");
PQnotifies_init();
if (getenv("LIBPQ_DEBUG"))
- {
Pfdebug = stderr;
- }
else
- {
Pfdebug = NULL;
- }
}
/* -------------------------
return (EOF);
if (fgets(s, maxlen - 1, Pfin) == NULL)
- {
return feof(Pfin) ? EOF : 1;
- }
else
{
for (; *s; s++)
*fdP = fd;
if (family == AF_UNIX)
- {
chmod(sock_path, 0777);
- }
return (STATUS_OK);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.7 1997/09/08 02:23:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.8 1998/06/15 19:28:27 momjian Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
if (signo != SIGALRM)
- {
act.sa_flags |= SA_RESTART;
- }
if (sigaction(signo, &act, &oact) < 0)
return (SIG_ERR);
return (oact.sa_handler);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#if defined(__alpha)
if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
(unsigned long) NULL) < 0)
- {
elog(NOTICE, "setsysinfo failed: %d\n", errno);
- }
#endif
#endif /* NOFIXADE || NOPRINTADE */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
foreach(l, list)
{
if (newlist == NIL)
- {
newlist = nl = lcons(lfirst(l), NIL);
- }
else
{
lnext(nl) = lcons(lfirst(l), NIL);
}
}
else
- {
newnode->constvalue = from->constvalue;
- }
newnode->constisnull = from->constisnull;
newnode->constbyval = from->constbyval;
newnode->constisset = from->constisset;
}
}
else
- {
Node_Copy(from, newnode, p_ordering.ord.merge);
- }
Node_Copy(from, newnode, keys);
foreach(l, list)
{
if (newlist == NIL)
- {
newlist = nl = lcons(copyObject(lfirst(l)), NIL);
- }
else
{
lnext(nl) = lcons(copyObject(lfirst(l)), NIL);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.12 1998/02/26 04:32:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.13 1998/06/15 19:28:31 momjian Exp $
*
* NOTES
* XXX a few of the following functions are duplicated to handle
return (list);
for (p = list; p != NULL; p = lnext(p))
- {
rlist = lcons(lfirst(p), rlist);
- }
lfirst(list) = lfirst(rlist);
lnext(list) = lnext(rlist);
}
}
foreach(i, l2)
- {
retval = lappend(retval, lfirst(i));
- }
return (retval);
}
}
}
foreach(i, l2)
- {
retval = lappendi(retval, lfirsti(i));
- }
return (retval);
}
if (l != NULL)
{
if (prev == NIL)
- {
result = lnext(list);
- }
else
- {
lnext(prev) = lnext(l);
- }
}
return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.35 1998/05/09 23:46:35 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.36 1998/06/15 19:28:32 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
appendStringInfo(str, " :alwaysdone ");
for (i = 0; i < node->fj_nNodes; i++)
- {
appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false");
- }
}
/*
appendStringInfo(str, node->constisnull ? "true" : "false");
appendStringInfo(str, " :constvalue ");
if (node->constisnull)
- {
appendStringInfo(str, "<>");
- }
else
- {
_outDatum(str, node->constvalue, node->consttype);
- }
appendStringInfo(str, " :constbyval ");
appendStringInfo(str, node->constbyval ? "true" : "false");
}
* without casting it to int first!! -mer 8 Jan 1991
*/
if (((int) length) <= -1)
- {
length = VARSIZE(s);
- }
sprintf(buf, " %d [ ", length);
appendStringInfo(str, buf);
for (i = 0; i < length; i++)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.14 1998/01/20 05:03:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.15 1998/06/15 19:28:32 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
for (;;)
{
for (j = 0; j < indentLev * 3; j++)
- {
line[j] = ' ';
- }
for (; j < 75 && s[i] != '\0'; i++, j++)
{
line[j] = s[i];
printf("%s\n", line);
/* print the line before : and resets */
for (j = 0; j < indentLev * 3; j++)
- {
line[j] = ' ';
- }
}
line[j] = s[i];
break;
printf("%s\n", line);
}
if (j != 0)
- {
printf("%s\n", line);
- }
fflush(stdout);
return;
}
print_expr((Node *) get_rightop(e), rtable);
}
else
- {
printf("an expr");
- }
}
else
- {
printf("not an expr");
- }
}
/*
printf("\t%d %s\t", tle->resdom->resno, tle->resdom->resname);
if (tle->resdom->reskey != 0)
- {
printf("(%d):\t", tle->resdom->reskey);
- }
else
- {
printf(" :\t");
- }
print_expr(tle->expr, rtable);
printf("\n");
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.11 1998/02/26 04:32:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.12 1998/06/15 19:28:32 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
* skip the optional '-' (i.e. negative number)
*/
if (*token == '-')
- {
token++;
- }
/*
* See if there is a decimal point
{
local_str = string;
if (length == NULL)
- {
return (NULL);
- }
}
for (; *local_str == ' '
}
else if (*local_str == ')' || *local_str == '(' ||
*local_str == '}' || *local_str == '{')
- {
local_str++;
- }
else
{
for (; *local_str != ' '
this_value = (Node *) l;
}
else
- {
this_value = nodeRead(false);
- }
break;
case RIGHT_PAREN:
this_value = NULL;
* It might be NULL but it is an atom!
*/
if (read_car_only)
- {
make_dotted_pair_cell = false;
- }
else
- {
make_dotted_pair_cell = true;
- }
}
else
{
lfirst(l) = this_value;
if (!read_car_only)
- {
lnext(l) = nodeRead(false);
- }
else
- {
lnext(l) = NULL;
- }
return_value = (Node *) l;
}
else
- {
return_value = this_value;
- }
return (return_value);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.29 1998/04/27 02:58:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.30 1998/06/15 19:28:33 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
token = lsptok(NULL, &length); /* now get the state */
if (length == 0)
- {
node->state = (EState *) NULL;
- }
else
{ /* Disgusting hack until I figure out what
* to do here */
token = lsptok(NULL, &length); /* eat :opType */
token = lsptok(NULL, &length); /* get opType */
if (!strncmp(token, "op", 2))
- {
local_node->opType = OP_EXPR;
- }
else if (!strncmp(token, "func", 4))
- {
local_node->opType = FUNC_EXPR;
- }
else if (!strncmp(token, "or", 2))
- {
local_node->opType = OR_EXPR;
- }
else if (!strncmp(token, "and", 3))
- {
local_node->opType = AND_EXPR;
- }
else if (!strncmp(token, "not", 3))
- {
local_node->opType = NOT_EXPR;
- }
else if (!strncmp(token, "subp", 4))
- {
local_node->opType = SUBPLAN_EXPR;
- }
token = lsptok(NULL, &length); /* eat :oper */
local_node->oper = nodeRead(true);
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
- {
local_node->constisnull = true;
- }
else
- {
local_node->constisnull = false;
- }
token = lsptok(NULL, &length); /* get :constvalue */
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
- {
local_node->constbyval = true;
- }
else
- {
local_node->constbyval = false;
- }
return (local_node);
}
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
- {
local_node->funcisindex = true;
- }
else
- {
local_node->funcisindex = false;
- }
token = lsptok(NULL, &length); /* get :funcsize */
token = lsptok(NULL, &length); /* now read it */
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
- {
local_node->indexed = true;
- }
else
- {
local_node->indexed = false;
- }
token = lsptok(NULL, &length); /* get :pages */
token = lsptok(NULL, &length); /* now read it */
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
- {
local_node->notclause = true;
- }
else
- {
local_node->notclause = false;
- }
token = lsptok(NULL, &length); /* get :indexids */
local_node->indexids = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :mergesortable */
if (!strncmp(token, "true", 4))
- {
local_node->mergesortable = true;
- }
else
- {
local_node->mergesortable = false;
- }
token = lsptok(NULL, &length); /* get :hashjoinable */
if (!strncmp(token, "true", 4))
- {
local_node->hashjoinable = true;
- }
else
- {
local_node->hashjoinable = false;
- }
return (local_node);
}
token = lsptok(NULL, &length);
if (!strncmp(token, "PLAN", length))
- {
return_value = _readPlan();
- }
else if (!strncmp(token, "RESULT", length))
- {
return_value = _readResult();
- }
else if (!strncmp(token, "APPEND", length))
- {
return_value = _readAppend();
- }
else if (!strncmp(token, "JOIN", length))
- {
return_value = _readJoin();
- }
else if (!strncmp(token, "NESTLOOP", length))
- {
return_value = _readNestLoop();
- }
else if (!strncmp(token, "MERGEJOIN", length))
- {
return_value = _readMergeJoin();
- }
else if (!strncmp(token, "HASHJOIN", length))
- {
return_value = _readHashJoin();
- }
else if (!strncmp(token, "SCAN", length))
- {
return_value = _readScan();
- }
else if (!strncmp(token, "SEQSCAN", length))
- {
return_value = _readSeqScan();
- }
else if (!strncmp(token, "INDEXSCAN", length))
- {
return_value = _readIndexScan();
- }
else if (!strncmp(token, "TEMP", length))
- {
return_value = _readTemp();
- }
else if (!strncmp(token, "SORT", length))
- {
return_value = _readSort();
- }
else if (!strncmp(token, "AGGREG", length))
- {
return_value = _readAggreg();
- }
else if (!strncmp(token, "SUBLINK", length))
- {
return_value = _readSubLink();
- }
else if (!strncmp(token, "AGG", length))
- {
return_value = _readAgg();
- }
else if (!strncmp(token, "UNIQUE", length))
- {
return_value = _readUnique();
- }
else if (!strncmp(token, "HASH", length))
- {
return_value = _readHash();
- }
else if (!strncmp(token, "RESDOM", length))
- {
return_value = _readResdom();
- }
else if (!strncmp(token, "EXPR", length))
- {
return_value = _readExpr();
- }
else if (!strncmp(token, "ARRAYREF", length))
- {
return_value = _readArrayRef();
- }
else if (!strncmp(token, "ARRAY", length))
- {
return_value = _readArray();
- }
else if (!strncmp(token, "VAR", length))
- {
return_value = _readVar();
- }
else if (!strncmp(token, "CONST", length))
- {
return_value = _readConst();
- }
else if (!strncmp(token, "FUNC", length))
- {
return_value = _readFunc();
- }
else if (!strncmp(token, "OPER", length))
- {
return_value = _readOper();
- }
else if (!strncmp(token, "PARAM", length))
- {
return_value = _readParam();
- }
else if (!strncmp(token, "ESTATE", length))
- {
return_value = _readEState();
- }
else if (!strncmp(token, "REL", length))
- {
return_value = _readRel();
- }
else if (!strncmp(token, "TLE", length))
- {
return_value = _readTargetEntry();
- }
else if (!strncmp(token, "RTE", length))
- {
return_value = _readRangeTblEntry();
- }
else if (!strncmp(token, "PATH", length))
- {
return_value = _readPath();
- }
else if (!strncmp(token, "INDEXPATH", length))
- {
return_value = _readIndexPath();
- }
else if (!strncmp(token, "JOINPATH", length))
- {
return_value = _readJoinPath();
- }
else if (!strncmp(token, "MERGEPATH", length))
- {
return_value = _readMergePath();
- }
else if (!strncmp(token, "HASHPATH", length))
- {
return_value = _readHashPath();
- }
else if (!strncmp(token, "ORDERKEY", length))
- {
return_value = _readOrderKey();
- }
else if (!strncmp(token, "JOINKEY", length))
- {
return_value = _readJoinKey();
- }
else if (!strncmp(token, "MERGEORDER", length))
- {
return_value = _readMergeOrder();
- }
else if (!strncmp(token, "CINFO", length))
- {
return_value = _readCInfo();
- }
else if (!strncmp(token, "JOINMETHOD", length))
- {
return_value = _readJoinMethod();
- }
else if (!strncmp(token, "JINFO", length))
- {
return_value = _readJInfo();
- }
else if (!strncmp(token, "HINFO", length))
- {
return_value = _readHInfo();
- }
else if (!strncmp(token, "ITER", length))
- {
return_value = _readIter();
- }
else if (!strncmp(token, "QUERY", length))
- {
return_value = _readQuery();
- }
else if (!strncmp(token, "SORTCLAUSE", length))
- {
return_value = _readSortClause();
- }
else if (!strncmp(token, "GROUPCLAUSE", length))
- {
return_value = _readGroupClause();
- }
else
- {
elog(ERROR, "badly formatted planstring \"%.10s\"...\n", token);
- }
return ((Node *) return_value);
}
if (byValue)
{
if (length > sizeof(Datum))
- {
elog(ERROR, "readValue: byval & length = %d", length);
- }
s = (char *) (&res);
for (i = 0; i < sizeof(Datum); i++)
{
}
}
else if (length <= 0)
- {
s = NULL;
- }
else if (length >= 1)
{
s = (char *) palloc(length);
token = lsptok(NULL, &tokenLength); /* skip the ']' */
if (token[0] != ']')
- {
elog(ERROR, "readValue: ']' expected, length =%d", length);
- }
return (res);
}
* geqo_erx.c--
* edge recombination crossover [ER]
*
-* $Id: geqo_erx.c,v 1.8 1998/02/26 04:32:20 momjian Exp $
+* $Id: geqo_erx.c,v 1.9 1998/06/15 19:28:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* find destination for the newly entered point */
if (edge_table[new_gene[i - 1]].unused_edges > 0)
- {
new_gene[i] = gimme_gene(edge_table[(int) new_gene[i - 1]], edge_table);
- }
else
{ /* cope with fault */
*
* 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 $
*
*-------------------------------------------------------------------------
*/
new_rels = lcons(gimme_clauseless_join(outer_rel, outer_rel), NIL); /* ??? MAU */
}
else
- {
new_rels = lcons(gimme_clauseless_join(outer_rel, inner_rel), NIL);
- }
}
/* process new_rel->pathlist */
rel = init_join_rel(outer_rel, get_join_rel(root, other_rels), joininfo);
}
else
- {
rel = NULL;
- }
if (rel != NULL)
join_list = lappend(join_list, rel);
temp = (Cost) inner_rel->tuples * (Cost) outer_rel->tuples; /* cartesian product */
if (joinrel->clauseinfo)
- {
temp = temp * product_selec(joinrel->clauseinfo);
- }
if (temp >= (MAXINT - 1))
- {
ntuples = ceil(geqo_log((double) temp, (double) GEQO_LOG_BASE));
- }
else
- {
ntuples = ceil((double) temp);
- }
if (ntuples < 1)
ntuples = 1; /* make the best case 1 instead of 0 */
*
* 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 $
*
*-------------------------------------------------------------------------
*/
printf("______________________________\n");
printf("(");
foreach(l, rel->relids)
- {
printf("%d ", lfirsti(l));
- }
printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n");
foreach(l, rel->pathlist)
- {
geqo_print_path(root, lfirst(l), 1);
- }
printf("\tcheapest path:\n");
geqo_print_path(root, rel->cheapestpath, 1);
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
else
- {
elog(DEBUG, "geqo_params: ga parameter file\n\'%s\'\ndoes not exist or permissions are not setup correctly", conf_file);
- }
/*
* parameter checkings follow
size = pow(2.0, exponent);
if (size < MIN_POOL)
- {
return (MIN_POOL);
- }
else if (size > MAX_POOL)
- {
return (MAX_POOL);
- }
else
return ((int) ceil(size));
}
*
* 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 $
*
*-------------------------------------------------------------------------
*/
rel->pathlist = lremove(unorderedpath, rel->pathlist);
}
else
- {
rel->unorderedpath = (Path *) unorderedpath;
- }
return (cheapest);
}
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* all gene */
chromo = (Chromosome *) new_pool->data; /* vector of all chromos */
for (i = 0; i < pool_size; i++)
- {
chromo[i].string = palloc((string_length + 1) * sizeof(Gene));
- }
return (new_pool);
}
* PX operator according to Syswerda
* (The Genetic Algorithms Handbook, L Davis, ed)
*
-* $Id: geqo_px.c,v 1.4 1997/09/08 21:44:35 momjian Exp $
+* $Id: geqo_px.c,v 1.5 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* initialize city table */
for (i = 1; i <= num_gene; i++)
- {
city_table[i].used = 0;
- }
/* choose random positions that will be inherited directly from parent */
num_positions = geqo_randint(2 * num_gene / 3, num_gene / 3);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
id2 = (int) lsecond(joinrel->relids);
if (id1 > id2)
- {
tmprel_array[id2][id1] = *(Rel *) joinrel;
- }
else
{
tmprel_array[id1][id2] = *(Rel *) joinrel; /* ever reached? */
{
garel[1] = tmprel_array[1][3];
if (rel12->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
- {
garel[2] = tmprel_array[2][3];
- }
else
- {
garel[2] = tmprel_array[1][2];
- }
}
else
{
garel[1] = tmprel_array[1][2];
if (rel13->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
- {
garel[2] = tmprel_array[2][3];
- }
else
- {
garel[2] = tmprel_array[1][3];
- }
}
}
if (connectto[tempn] != 0)
{
if (n > tempn)
- {
joinrel = (Rel *) &tmprel_array[tempn][n];
- }
else
- {
joinrel = (Rel *) &tmprel_array[n][tempn];
- }
dist = joinrel->cheapestpath->path_cost;
if (dist < disttoconnect[tempn])
}
n = nextn;
if (n > connectto[n])
- {
garel[i] = tmprel_array[connectto[n]][n];
- }
else
- {
garel[i] = tmprel_array[n][connectto[n]];
- }
i++;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
root->join_relation_list_ = outer_rels;
}
else
- {
root->join_relation_list_ = new_rels;
- }
if (!BushyPlanFlag)
outer_rels = new_rels;
}
printf("(");
foreach(l, rel->relids)
- {
printf("%d ", lfirsti(l));
- }
printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n");
foreach(l, rel->pathlist)
- {
print_path(root, lfirst(l), 1);
- }
printf("\tcheapest path:\n");
print_path(root, rel->cheapestpath, 1);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
clausenode = (CInfo *) lfirst(temp);
cost_clause = clausenode->selectivity;
if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause)
- {
clausenode->selectivity = new_selectivity;
- }
}
}
List *clause = lfirst(clauses);
if (clauses == NULL)
- {
s1 = 1.0;
- }
else if (IsA(clause, Param))
{
/* XXX How're we handling this before?? -ay */
s1 = 1.0;
}
else if (IsA(clause, Const))
- {
s1 = ((bool) ((Const *) clause)->constvalue) ? 1.0 : 0.0;
- }
else if (IsA(clause, Var))
{
Oid relid = getrelid(((Var *) clause)->varno,
*/
if (length(clauses) < 2)
- {
return (s1);
- }
else
{
/* Compute selectivity of the 'or'ed subclauses. */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
temp = rel->tuples * product_selec(rel->clauseinfo);
Assert(temp >= 0);
if (temp >= (MAXINT - 1))
- {
temp1 = MAXINT;
- }
else
- {
temp1 = ceil((double) temp);
- }
Assert(temp1 >= 0);
Assert(temp1 <= MAXINT);
return (temp1);
temp = temp * product_selec(joinpath->pathclauseinfo);
if (temp >= (MAXINT - 1))
- {
temp1 = MAXINT;
- }
else
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
else if (leftop
&& match_index_to_operand(indexkey,
(Expr *) leftop, rel, index))
- {
join_op = ((Oper *) ((Expr *) clause)->oper)->opno;
- }
if (join_op && op_class(join_op, xclass, index->relam) &&
join_clause_p((Node *) clause))
!IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) ||
!IsA(pred_const, Const))
- {
return false;
- }
/*
* The implication can't be determined unless the predicate and the
CInfo *cinfo = lfirst(l);
if (!join_clause_p((Node *) cinfo->clause))
- {
restrict_cls = lappend(restrict_cls, cinfo);
- }
}
return restrict_cls;
}
if (!(join_clause_p((Node *) clauseinfo->clause) &&
equal_path_merge_ordering(index->ordering,
clauseinfo->mergesortorder)))
- {
temp = false;
- }
}
if (!join || temp)
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* wierd behavior.
*/
if (IsA_JoinPath(path))
- {
((Path *) lfirst(path))->outerjoincost = (Cost) 0;
- }
/*
* do it iff it is a join path, which is not always true, esp
}
if (xmergeinfo)
- {
clauses = xmergeinfo->jmethod.clauses;
- }
if (clauses)
{
joinrel->targetlist, clauses);
}
else
- {
merge_pathkeys = outerpath->keys;
- }
if (best_innerjoin &&
path_is_cheaper(best_innerjoin, cheapest_inner))
- {
nestinnerpath = best_innerjoin;
- }
else
- {
nestinnerpath = cheapest_inner;
- }
paths = lcons(create_nestloop_path(joinrel,
outerrel,
* wouldn't otherwise be considered.
*/
if (path_is_cheaper_than_sort)
- {
mergeinnerpath->outerjoincost = outerpath->path_cost;
- }
else
- {
mergeinnerpath = cheapest_inner;
- }
temp_node =
lcons(create_mergesort_path(joinrel,
paths);
}
else
- {
temp_node = paths;
- }
jp_list = nconc(jp_list, temp_node);
}
return (jp_list);
}
if (xmergeinfo)
- {
clauses = ((JoinMethod *) xmergeinfo)->clauses;
- }
if (clauses)
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
joininfo);
}
else
- {
rel = NULL;
- }
if (rel != NULL)
join_list = lappend(join_list, rel);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.5 1998/02/26 04:32:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
joinkeys = LispRemove(xjoinkey, joinkeys);
}
else
- {
return (NIL);
- }
}
if (matched_joinkeys == NULL ||
length(matched_joinkeys) != length(pathkeys))
- {
return NIL;
- }
*matchedJoinClausesPtr = nreverse(matched_joinclauses);
return (nreverse(matched_joinkeys));
matched_path = path;
}
else
- {
matched_path = path;
- }
}
}
return matched_path;
x = new_join_pathkey(outer_pathkey, NIL,
join_rel_tlist, joinclauses);
if (x != NIL)
- {
t_list = lappend(t_list, x);
- }
}
return (t_list);
}
matched_subkeys);
}
else
- {
newly_considered_subkeys = matched_subkeys;
- }
considered_subkeys =
append(considered_subkeys, newly_considered_subkeys);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.5 1998/02/26 04:32:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
create_or_index_paths(root, rel, lnext(clauses)));
}
else
- {
t_list = create_or_index_paths(root, rel, lnext(clauses));
- }
}
}
Cost subclause_selec;
if (constant_on_right)
- {
value = ((Const *) get_rightop(subclause))->constvalue;
- }
else
- {
value = NameGetDatum("");
- }
if (constant_on_right)
- {
flag = (_SELEC_IS_CONSTANT_ || _SELEC_CONSTANT_RIGHT_);
- }
else
- {
flag = _SELEC_CONSTANT_RIGHT_;
- }
index_selectivity(lfirsti(index->relids),
index->classlist,
lconsi(opno, NIL),
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.10 1998/03/30 16:46:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.11 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
primjoin, NIL));
}
else
- {
set_groupsel(temp, 1.0);
- }
}
else
/* a restriction, or 2-ary join pred */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.13 1998/04/02 07:27:15 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.14 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
other_rel->pathlist);
}
else
- {
result = nconc(result, lcons(other_rel, NIL));
- }
}
return (result);
}
path = (Path *) lfirst(y);
if (!path->p_ordering.ord.sortop)
- {
break;
- }
}
cheapest = (JoinPath *) prune_rel_path(rel, path);
if (IsA_JoinPath(cheapest))
- {
rel->size = compute_joinrel_size(cheapest);
- }
else
elog(ERROR, "non JoinPath called");
}
rel->pathlist = lremove(unorderedpath, rel->pathlist);
}
else
- {
rel->unorderedpath = (Path *) unorderedpath;
- }
return (cheapest);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.14 1998/06/15 18:39:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.15 1998/06/15 19:28:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(LispValue) get_locclauseinfo(parentpath)));
/* put new childpath into the path tree */
if (whichchild == INNER)
- {
set_innerjoinpath(parentpath, (pathPtr) newkid);
- }
else
- {
set_outerjoinpath(parentpath, (pathPtr) newkid);
- }
/*
* * recompute parentpath cost from scratch -- the cost * of the join
elog(ERROR, "Oper's function is undefined");
}
else
- {
funcid = get_funcid((Func) node);
- }
/* look up tuple in cache */
tupl = SearchSysCacheTuple(PROOID, ObjectIdGetDatum(funcid), 0, 0, 0);
tmpclause = lnext(tmpclause))
xfunc_fixvars(lfirst(tmpclause), rel, varno);
else
- {
elog(ERROR, "Clause node of undetermined type");
- }
}
for (temp = bar; !null(temp); temp = lnext(temp))
if (!equal((Node) (foo), (Node) (lfirst(temp))))
- {
result = lappend(result, lfirst(temp));
- }
else
sanity = true; /* found a matching item to remove! */
/* COPY_CHECKARGS() */
if (to == NULL)
- {
return false;
- }
/* COPY_CHECKNULL() */
if (from == NULL)
/* COPY_NEW(c) */
newnode = (Rel) (*alloc) (classSize(Rel));
if (newnode == NULL)
- {
return false;
- }
/* ----------------
* copy node superclass fields
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.27 1998/02/26 04:32:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.28 1998/06/15 19:28:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
while (indexkeys[pos] != 0)
{
if (varatt == indexkeys[pos])
- {
break;
- }
pos++;
}
}
return (newclause);
}
else
- {
return (clause);
- }
}
else if (IsA(clause, Const))
- {
return (clause);
- }
else if (IsA(clause, Param))
{
/* Function parameter used as index scan arg. DZ - 27-8-1996 */
make_clause(expr->opType, expr->oper, new_subclauses);
}
else
- {
return (clause);
- }
}
else
{
* (var const) ...) ?
*/
if (new_subclauses)
- {
return (Node *) new_subclauses;
- }
else
- {
return (clause);
- }
}
}
if (strcmp(uniqueAttr, "*") == 0)
node->uniqueAttr = NULL;
else
- {
node->uniqueAttr = pstrdup(uniqueAttr);
- }
return (node);
}
fjoinList = lappend(fjoinList, tlistElem);
}
else
- {
newTlist = lappend(newTlist, tlistElem);
- }
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.11 1998/03/16 05:49:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.12 1998/06/15 19:28:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *clause;
foreach(clause, clauses)
- {
add_clause_to_rels(root, lfirst(clause));
- }
return;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.21 1998/03/31 23:30:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.22 1998/06/15 19:28:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(Plan *) scan));
}
else
- {
return ((Plan *) scan);
- }
}
break;
* it.
*/
if (final_relation)
- {
return (create_plan((Path *) final_relation->cheapestpath));
- }
else
{
elog(NOTICE, "final relation is nil");
}
if (length(glc) != 0)
- {
elog(ERROR, "group attribute disappeared from target list");
- }
/*
* If non-GroupBy entries were removed from TL - we are to add Vars
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.21 1998/04/15 15:29:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.22 1998/06/15 19:28:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
return;
if (IsA_Join(plan))
- {
set_join_tlist_references((Join *) plan);
- }
else if (IsA(plan, SeqScan) &&plan->lefttree &&
IsA_Temp(plan->lefttree))
- {
set_tempscan_tlist_references((SeqScan *) plan);
- }
else if (IsA(plan, Sort))
- {
set_temp_tlist_references((Temp *) plan);
- }
else if (IsA(plan, Result))
- {
set_result_tlist_references((Result *) plan);
- }
else if (IsA(plan, Hash))
- {
set_tlist_references(plan->lefttree);
- }
else if (IsA(plan, Choose))
{
List *x;
foreach(x, ((Choose *) plan)->chooseplanlist)
- {
set_tlist_references((Plan *) lfirst(x));
- }
}
}
(source)->targetlist);
}
else
- {
elog(ERROR, "calling set_temp_tlist_references with empty lefttree");
- }
}
/*
return (NIL);
}
else if (single_node((Node *) clause))
- {
return ((List *) clause);
- }
else if (and_clause((Node *) clause))
{
List *andclause =
((Var *) clause)->varattno = subplanVar->resdom->resno;
}
else if (IsA(clause, Aggreg))
- {
replace_result_clause(((Aggreg *) clause)->target, subplanTargetList);
- }
else if (is_funcclause(clause))
{
List *subExpr;
*/
subExpr = ((Expr *) clause)->args;
foreach(t, subExpr)
- {
replace_result_clause(lfirst(t), subplanTargetList);
- }
}
else if (IsA(clause, ArrayRef))
{
* expression and its index expression...
*/
foreach(t, aref->refupperindexpr)
- {
replace_result_clause(lfirst(t), subplanTargetList);
- }
foreach(t, aref->reflowerindexpr)
- {
replace_result_clause(lfirst(t), subplanTargetList);
- }
replace_result_clause(aref->refexpr,
subplanTargetList);
replace_result_clause(aref->refassgnexpr,
*/
if (IsA(opnd, Var) &&
(inner_relid == ((Var *) opnd)->varno))
- {
return true;
- }
if (is_funcclause(opnd))
{
List *firstArg = lfirst(((Expr *) opnd)->args);
if (IsA(firstArg, Var) &&
(inner_relid == ((Var *) firstArg)->varno))
- {
return true;
- }
}
return false;
}
List *t;
if (IsA(clause, Var))
- {
return clause;
- }
else if (is_funcclause(clause))
{
* arguments...
*/
foreach(t, ((Expr *) clause)->args)
- {
lfirst(t) = del_agg_clause(lfirst(t));
- }
}
else if (IsA(clause, Aggreg))
{
* expression and its index expression...
*/
foreach(t, aref->refupperindexpr)
- {
lfirst(t) = del_agg_clause(lfirst(t));
- }
foreach(t, aref->reflowerindexpr)
- {
lfirst(t) = del_agg_clause(lfirst(t));
- }
aref->refexpr = del_agg_clause(aref->refexpr);
aref->refassgnexpr = del_agg_clause(aref->refassgnexpr);
}
right = del_agg_clause(right);
}
else if (IsA(clause, Param) ||IsA(clause, Const))
- {
return clause;
- }
else
{
}
if ((i = lfirsti(vpe)) < 0) /* parameter is not assigned */
- {
i = _new_param(var, PlannerQueryLevel - var->varlevelsup);
- }
retval = makeNode(Param);
retval->paramkind = PARAM_EXEC;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.8 1998/02/26 04:32:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.9 1998/06/15 19:28:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
return (make_orclause(pull_ors(t_list)));
}
else if (not_clause((Node *) qual))
- {
return (make_notclause(pull_args(get_notclausearg(qual))));
- }
else
- {
return (qual);
- }
}
/*
copyObject((Node *) lnext(orlist)))));
}
else
- {
return (lcons(lfirst(orlist), pull_ors(lnext(orlist))));
- }
}
/*
copyObject((Node *) lnext(andlist)))));
}
else
- {
return (lcons(lfirst(andlist), pull_ands(lnext(andlist))));
- }
}
/*
List *t_list = NIL;
foreach(temp, qual->args)
- {
t_list = lappend(t_list, find_nots(lfirst(temp)));
- }
return (make_andclause(t_list));
}
List *t_list = NIL;
foreach(temp, qual->args)
- {
t_list = lappend(t_list, find_nots(lfirst(temp)));
- }
return (make_orclause(t_list));
}
else if (not_clause((Node *) qual))
(make_opclause(op, get_leftop(qual), get_rightop(qual)));
}
else
- {
return (make_notclause(qual));
- }
}
else if (and_clause((Node *) qual))
{
List *t_list = NIL;
foreach(temp, qual->args)
- {
t_list = lappend(t_list, push_nots(lfirst(temp)));
- }
return (make_orclause(t_list));
}
else if (or_clause((Node *) qual))
List *t_list = NIL;
foreach(temp, qual->args)
- {
t_list = lappend(t_list, push_nots(lfirst(temp)));
- }
return (make_andclause(t_list));
}
else if (not_clause((Node *) qual))
List *t_list = NIL;
foreach(temp, qual->args)
- {
t_list = lappend(t_list, normalize(lfirst(temp)));
- }
return (make_andclause(t_list));
}
else if (or_clause((Node *) qual))
bool has_andclause = FALSE;
foreach(temp, qual->args)
- {
orlist = lappend(orlist, normalize(lfirst(temp)));
- }
foreach(temp, orlist)
{
if (and_clause(lfirst(temp)))
lnext(new_orlist))));
}
else
- {
return (orlist);
- }
}
/*
return ((List *) make_orclause((List *) t_list));
}
else if (not_clause((Node *) qual))
- {
return ((List *) make_notclause((Expr *) remove_ands((Expr *) get_notclausearg(qual))));
- }
else
- {
return ((List *) qual);
- }
}
/*****************************************************************************
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.10 1998/02/26 04:33:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.11 1998/06/15 19:28:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *temp = NIL;
if (result_relation >= 1 && command_type != CMD_SELECT)
- {
relid = getrelid(result_relation, range_table);
- }
/*
* for heap_formtuple to work, the targetlist must match the exact
return (replace_matching_resname(ntlist, tlist));
}
else
- {
return (tlist);
- }
}
t_list = lappend(t_list, matching_old_tl);
}
else
- {
t_list = lappend(t_list, new_tle);
- }
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.23 1998/03/31 23:30:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.24 1998/06/15 19:28:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
new_examined_relids);
if (new_unexamined_relids == NULL)
- {
return (new_examined_relids);
- }
else
{
return (find_all_inheritors(new_unexamined_relids,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.16 1998/02/26 04:33:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.17 1998/06/15 19:28:47 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
foreach(q, quals)
{
if (!contain_var_clause(lfirst(q)))
- {
constqual = lcons(lfirst(q), constqual);
- }
else
- {
restqual = lcons(lfirst(q), restqual);
- }
}
freeList(quals);
*constantQual = constqual;
List *vi;
if (!intMember(var->varno, varno_list))
- {
varno_list = lappendi(varno_list, var->varno);
- }
foreach(vi, var_list)
{
Var *in_list = (Var *) lfirst(vi);
Var *var = (Var *) lfirst(i);
if (!intMember(var->varno, var_list))
- {
var_list = lconsi(var->varno, var_list);
- }
}
return (length(var_list));
/* How about Param-s ? - vadim 02/03/98 */
if (IsA(get_leftop((Expr *) clause), Var) &&
IsA(get_rightop((Expr *) clause), Const))
- {
return (true);
- }
else if (IsA(get_rightop((Expr *) clause), Var) &&
IsA(get_leftop((Expr *) clause), Const))
- {
return (true);
- }
return (false);
}
fix_opid(Node *clause)
{
if (clause == NULL || single_node(clause))
- {
;
- }
else if (or_clause(clause) || and_clause(clause))
- {
fix_opids(((Expr *) clause)->args);
- }
else if (is_funcclause(clause))
- {
fix_opids(((Expr *) clause)->args);
- }
else if (IsA(clause, ArrayRef))
{
ArrayRef *aref = (ArrayRef *) clause;
fix_opid(aref->refassgnexpr);
}
else if (not_clause(clause))
- {
fix_opid((Node *) get_notclausearg((Expr *) clause));
- }
else if (is_opclause(clause))
{
replace_opid((Oper *) ((Expr *) clause)->oper);
fix_opid((Node *) get_rightop((Expr *) clause));
}
else if (agg_clause(clause))
- {
fix_opid(((Aggreg *) clause)->target);
- }
else if (is_subplan(clause) &&
((SubPlan *) ((Expr *) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.6 1998/02/26 04:33:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.7 1998/06/15 19:28:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
find_relation_indices(Query *root, Rel *rel)
{
if (rel->indexed)
- {
return (find_secondary_index(root, lfirsti(rel->relids)));
- }
else
- {
return (NIL);
- }
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.6 1998/02/26 04:33:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.7 1998/06/15 19:28:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
r = (Var *) get_rightop(clause);
if (var_equal(var, l))
- {
retval = r;
- }
else if (var_equal(var, r))
- {
retval = l;
- }
}
return (retval);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.7 1998/02/26 04:33:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.8 1998/06/15 19:28:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Path *path = (Path *) lfirst(p);
if (path_is_cheaper(path, cheapest_so_far))
- {
cheapest_so_far = path;
- }
}
parent_rel->cheapestpath = cheapest_so_far;
{ /* (IsA(old_path,Path)) { */
new_path->parent = parent_rel;
if (!parent_rel->pruneable)
- {
unique_paths = lcons(new_path, unique_paths);
- }
else
unique_paths = lcons(new_path,
LispRemove(old_path, unique_paths));
}
if (old_path == NULL)
- {
*noOther = true;
- }
else
{
*noOther = false;
if (path_is_cheaper(new_path, old_path))
- {
retval = old_path;
- }
}
return (retval);
* if no index keys were found, we can't order the path).
*/
if (pathnode->path.keys == NULL)
- {
pathnode->path.p_ordering.ord.sortop = NULL;
- }
}
else
- {
pathnode->path.keys = NULL;
- }
if (is_join_scan || restriction_clauses == NULL)
{
/* add in expensive function costs -- JMH 7/7/92 */
#if 0
if (XfuncMode != XFUNC_OFF)
- {
pathnode->path_cost += xfunc_get_path_cost((Path *) pathnode);
- }
#endif
return (pathnode);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.16 1998/02/26 04:33:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.17 1998/06/15 19:28:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
i = 0;
foreach(xopno, opnos)
- {
opno_array[i++] = lfirsti(xopno);
- }
i = 0;
foreach(xattno, attnos)
- {
attno_array[i++] = lfirsti(xattno);
- }
i = 0;
foreach(value, values)
- {
value_array[i++] = (char *) lfirst(value);
- }
i = 0;
foreach(flag, flags)
- {
flag_array[i++] = lfirsti(flag);
- }
IndexSelectivity(indid,
relid,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.12 1998/02/26 04:33:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.13 1998/06/15 19:28:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
temp_entry = lfirst(temp);
vars = pull_var_clause((Node *) get_expr(temp_entry));
if (vars != NULL)
- {
tlist_vars = nconc(tlist_vars, vars);
- }
}
foreach(temp, tlist_vars)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.11 1998/02/26 04:33:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.12 1998/06/15 19:28:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
case T_List:
foreach(i, (List *) me)
- {
result = nconc(result, pull_varnos(lfirst(i)));
- }
break;
case T_ArrayRef:
foreach(i, ((ArrayRef *) me)->refupperindexpr)
pull_var_clause(lfirst(((Expr *) lfirst(temp))->args)));
}
else if (IsA(clause, Aggreg))
- {
retval = pull_var_clause(((Aggreg *) clause)->target);
- }
else if (IsA(clause, ArrayRef))
{
List *temp;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.12 1998/06/13 04:27:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.13 1998/06/15 19:28:51 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.10 1998/03/30 16:36:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.11 1998/06/15 19:28:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
if (basetypeID == InvalidOid)
- {
elog(ERROR, "%s: aggregate '%s' for all types does not exist", caller, aggname);
- }
else
{
elog(ERROR, "%s: aggregate '%s' for '%s' does not exist", caller, aggname,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.29 1998/05/29 14:00:21 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.30 1998/06/15 19:28:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
result = (Node *) make_array_ref(temp, att->indirection);
}
else
- {
result = temp;
- }
break;
}
case T_A_Const:
tp = (Type) typenameType(type_string);
}
else
- {
tp = (Type) typenameType(typename->name);
- }
len = typeLen(tp);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.18 1998/05/29 14:00:21 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.19 1998/06/15 19:28:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
PointerGetDatum(funcname),
0, 0, 0)))
&& IS_BINARY_COMPATIBLE(typeTypeId(tp), basetype))
- {
return((Node *)lfirst(fargs));
- }
}
}
{
if ((input_typeids[i] != UNKNOWNOID)
&& (current_typeids[i] == input_typeids[i]))
- {
nmatch++;
- }
else if (IS_BINARY_COMPATIBLE(current_typeids[i], input_typeids[i]))
- {
nident++;
- }
}
if ((nmatch + nident) == nargs)
for (current_candidate = candidates;
current_candidate != NULL;
current_candidate = current_candidate->next)
- {
ncandidates++;
- }
}
if (ncandidates == 1)
{
arginh[i].self = oid_array[i];
if ((relid = typeidTypeRelid(oid_array[i])) != InvalidOid)
- {
arginh[i].nsupers = find_inheritors(relid, &(arginh[i].supervec));
- }
else
{
arginh[i].nsupers = 0;
}
else
- {
*supervec = (Oid *) NULL;
- }
return (nvisited);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.12 1998/05/29 14:00:22 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.13 1998/06/15 19:28:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
if ((input_typeids[i] != UNKNOWNOID)
&& (current_typeids[i] == input_typeids[i]))
- {
nmatch++;
- }
}
#ifdef PARSEDEBUG
{
if (!can_coerce_type(1, &input_typeids[0], &candidates->args[0])
|| !can_coerce_type(1, &input_typeids[1], &candidates->args[1]))
- {
ncandidates = 0;
- }
return ((ncandidates == 1)? candidates->args: NULL);
}
if (input_typeids[i] != UNKNOWNOID)
{
if (current_typeids[i] == input_typeids[i])
- {
nmatch++;
- }
else if (IsPreferredType(current_category, current_typeids[i])
&& can_coerce_type(1, &input_typeids[i], ¤t_typeids[i]))
- {
nmatch++;
- }
}
}
{
if ((input_typeids[i] != UNKNOWNOID)
&& (input_typeids[i] != InvalidOid))
- {
current_type = input_typeids[i];
- }
else
- {
unknownOids = TRUE;
- }
}
if (unknownOids && (current_type != UNKNOWNOID))
}
/* disable for now... - thomas 1998-05-14 */
else
- {
tup = NULL;
- }
}
if (!HeapTupleIsValid(tup) && (!noWarnings))
- {
op_error(op, arg1, arg2);
- }
}
return tup;
}
else
- {
tup = NULL;
- }
/* Could not choose one, for whatever reason... */
if (!HeapTupleIsValid(tup))
Int8GetDatum('r'));
}
else
- {
tup = NULL;
- }
if (!HeapTupleIsValid(tup))
{
tp2 = NULL;
if (typeidIsValid(arg1))
- {
tp1 = typeidType(arg1);
- }
else
{
elog(ERROR, "Left hand side of operator '%s' has an unknown type"
}
if (typeidIsValid(arg2))
- {
tp2 = typeidType(arg2);
- }
else
{
elog(ERROR, "Right hand side of operator %s has an unknown type"
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.15 1998/06/05 03:49:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.16 1998/06/15 19:28:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
lindx[i] = ((Const *) aind->lidx)->constvalue;
}
else
- {
lindx[i] = 1;
- }
if (lindx[i] > uindx[i])
elog(ERROR, "yyparse: lower index cannot be greater than upper index");
}
if (p_target == NIL)
- {
p_target = tail_p_target = lcons(tent, NIL);
- }
else
{
lnext(tail_p_target) = lcons(tent, NIL);
{
}
else if (can_coerce_type(1, &type_id, &text_id))
- {
expr = coerce_type(pstate, expr, type_id, text_id);
- }
else
- {
expr = NULL;
- }
}
#endif
else
- {
expr = NULL;
- }
return expr;
} /* coerce_target_expr() */
Oid typelem;
if (arrayRef && !(((A_Indices *) lfirst(arrayRef))->lidx))
- {
typelem = typeidTypElem(attrtype);
- }
else
- {
typelem = attrtype;
- }
expr = coerce_target_expr(pstate, expr, type_id, typelem);
* Then explicitly size for storage...
*/
if (attrtypmod > 0)
- {
expr = size_target_expr(pstate, expr, attrtype, attrtypmod);
- }
}
if (arrayRef != NIL)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.10 1998/05/29 14:00:24 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.11 1998/06/15 19:28:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
HeapTuple tup;
if (s == NULL)
- {
elog(ERROR, "type(): Null type");
- }
if (!(tup = SearchSysCacheTuple(TYPNAME, PointerGetDatum(s), 0, 0, 0)))
- {
elog(ERROR, "type name lookup of %s failed", s);
- }
return ((Type) tup);
}
if (!(typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
0, 0, 0)))
- {
elog(ERROR, "type id lookup of %u failed", type_id);
- }
type = (TypeTupleForm) GETSTRUCT(typeTuple);
return (type->typelem);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.33 1998/02/26 04:33:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.34 1998/06/15 19:28:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bool oidbyval = typeByVal(t);
if (clause == NULL)
- {
return;
- }
else if (IsA(clause, LispList))
{
define_sets(lfirst(clause));
{
if (get_constisnull((Const) clause) ||
!get_constisset((Const) clause))
- {
return;
- }
setoid = SetDefine(((Const *) clause)->constvalue,
typeidTypeName(((Const *) clause)->consttype));
set_constvalue((Const) clause, setoid);
set_constypeByVal((Const) clause, oidbyval);
}
else if (IsA(clause, Iter))
- {
define_sets(((Iter *) clause)->iterexpr);
- }
else if (single_node(clause))
- {
return;
- }
else if (or_clause(clause) || and_clause(clause))
{
List *temp;
/* mapcan */
foreach(temp, ((Expr *) clause)->args)
- {
define_sets(lfirst(temp));
- }
}
else if (is_funcclause(clause))
{
/* mapcan */
foreach(temp, ((Expr *) clause)->args)
- {
define_sets(lfirst(temp));
- }
}
else if (IsA(clause, ArrayRef))
- {
define_sets(((ArrayRef *) clause)->refassgnexpr);
- }
else if (not_clause(clause))
- {
define_sets(get_notclausearg(clause));
- }
else if (is_opclause(clause))
{
define_sets(get_leftop(clause));
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.20 1998/05/09 23:27:39 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.21 1998/06/15 19:28:56 momjian Exp $
*/
#define FLEX_SCANNER
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.20 1998/05/09 23:27:39 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.21 1998/06/15 19:28:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
void *vp;
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
- {
sprintf(error_message, "dlopen (%s) failed", file);
- }
return (vp);
#endif
}
name = buf;
}
if ((vp = dlsym(handle, (char *) name)) == (void *) NULL)
- {
sprintf(error_message, "dlsym (%s) failed", name);
- }
return (vp);
#endif
}
if (!dl_initialized)
{
if (dld_init(dld_find_executable(pg_pathname)))
- {
return NULL;
- }
/*
* if there are undefined symbols, we want dl to search from the
* link the file, then check for undefined symbols!
*/
if (dld_link(filename))
- {
return NULL;
- }
/*
* If undefined symbols: try to link with the C and math libraries!
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.3 1998/02/26 04:34:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.4 1998/06/15 19:28:59 momjian Exp $
*
* NOTES
* all functions are defined here -- it's impossible to trace the
func_ptr f;
if (shl_findsym((shl_t *) & handle, funcname, TYPE_PROCEDURE, &f) == -1)
- {
f = (func_ptr) NULL;
- }
return (f);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.7 1998/02/26 04:34:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.8 1998/06/15 19:28:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (!dl_initialized)
{
if (dld_init(dld_find_executable(pg_pathname)))
- {
return NULL;
- }
/*
* if there are undefined symbols, we want dl to search from the
* link the file, then check for undefined symbols!
*/
if (dld_link(filename))
- {
return NULL;
- }
/*
* If undefined symbols: try to link with the C and math libraries!
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/ultrix4.c,v 1.1 1998/03/10 05:23:40 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/ultrix4.c,v 1.2 1998/06/15 19:28:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (!dl_initialized)
{
if (!dl_init(pg_pathname))
- {
return NULL;
- }
/*
* if there are undefined symbols, we want dl to search from the
-/* $Id: strcasecmp.c,v 1.3 1998/02/11 19:11:10 momjian Exp $ */
+/* $Id: strcasecmp.c,v 1.4 1998/06/15 19:28:57 momjian Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
u1 = (unsigned char) *s1++;
u2 = (unsigned char) *s2++;
if (charmap[u1] != charmap[u2])
- {
return charmap[u1] - charmap[u2];
- }
if (u1 == '\0')
- {
return 0;
- }
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.87 1998/06/09 17:36:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.88 1998/06/15 19:29:00 momjian Exp $
*
* NOTES
*
static char envEntry[NR_ENVIRONMENT_VBL][2 * ARGV_SIZE];
for (i = 0; i < NR_ENVIRONMENT_VBL; ++i)
- {
MemSet(envEntry[i], 0, 2 * ARGV_SIZE);
- }
/*
* Set up the necessary environment variables for the backend This
/* how about a word boundary? */
if ((flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
(c != OUT && ISWORD(c)))
- {
flagch = BOW;
- }
if ((lastc != OUT && ISWORD(lastc)) &&
(flagch == EOL || (c != OUT && !ISWORD(c))))
- {
flagch = EOW;
- }
if (flagch == BOW || flagch == EOW)
{
st = step(m->g, startst, stopst, st, flagch, st);
/* how about a word boundary? */
if ((flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
(c != OUT && ISWORD(c)))
- {
flagch = BOW;
- }
if ((lastc != OUT && ISWORD(lastc)) &&
(flagch == EOL || (c != OUT && !ISWORD(c))))
- {
flagch = EOW;
- }
if (flagch == BOW || flagch == EOW)
{
st = step(m->g, startst, stopst, st, flagch, st);
for (i = 1; i < NPAREN; i++)
{
if (p->pbegin[i] >= pos)
- {
p->pbegin[i]++;
- }
if (p->pend[i] >= pos)
- {
p->pend[i]++;
- }
}
memmove((char *) &p->strip[pos + 1], (char *) &p->strip[pos],
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.9 1998/02/26 04:35:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.10 1998/06/15 19:29:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (parsetree->commandType != CMD_SELECT)
{
if (parsetree->resultRelation != varno)
- {
return (NULL);
- }
}
nlocks = rulelocks->numLocks;
thisLockWasTriggered(varno,
oneLock->attrno,
parsetree))
- {
real_locks = lappend(real_locks, oneLock);
- }
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.15 1998/06/04 17:26:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.16 1998/06/15 19:29:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
eventrel = heap_openr(evobj);
if (eventrel == NULL)
- {
elog(ERROR, "rules cannot be defined on relations not in schema");
- }
eventrel_oid = RelationGetRelationId(eventrel);
/*
'%s'::bool);";
if (strlen(template) + strlen(rulname) + strlen(actionbuf) +
strlen(qualbuf) + 20 /* fudge fac */ > RULE_PLAN_SIZE)
- {
elog(ERROR, "DefineQueryRewrite: rule plan string too big.");
- }
sprintf(rulebuf, template,
rulname, evtype, eventrel_oid, evslot_index, actionbuf,
qualbuf, is_instead);
event_relation = heap_openr(event_obj->relname);
if (event_relation == NULL)
- {
elog(ERROR, "virtual relations not supported yet");
- }
ev_relid = RelationGetRelationId(event_relation);
if (eslot_string == NULL)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.15 1998/03/30 16:36:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.16 1998/06/15 19:29:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
}
else
- {
nothing = TRUE;
- }
rtable = copyObject(parsetree->rtable);
foreach(rt, rtable)
rtable = nconc(rtable, rule_rtable);
}
else
- {
rtable = nconc(rtable, copyObject(rule_action->rtable));
- }
parsetree->rtable = rtable;
rule_action->rtable = rtable;
*--------------------------------------------------
*/
if ((info->event == CMD_INSERT) || (info->event == CMD_UPDATE))
- {
FixNew(info, parsetree);
- }
/*--------------------------------------------------
* Step 3:
* only for a delete may the targetlist be NULL
*/
if (event != CMD_DELETE)
- {
Assert(parsetree->targetList != NULL);
- }
result_relation = parsetree->resultRelation;
aclcheck_res = pg_aclcheck(rte->relname, uname.data, ACL_RD);
if (aclcheck_res != ACLCHECK_OK)
- {
elog(ERROR, "%s: %s", rte->relname, aclcheck_error_strings[aclcheck_res]);
- }
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.13 1998/02/26 04:35:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.14 1998/06/15 19:29:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *l;
foreach(l, (List *) node)
- {
OffsetVarNodes(lfirst(l), offset);
- }
}
break;
default:
TargetEntry *tle = lfirst(i);
if (tle->resdom->resno == attno)
- {
return (tle->expr);
- }
}
return NULL;
}
((Var *) node)->varnoold = info->current_varno;
}
else
- {
*nodePtr = make_null(((Var *) node)->vartype);
- }
}
else
- {
*nodePtr = n;
- }
}
break;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.20 1998/04/27 04:06:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.21 1998/06/15 19:29:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ruleTupdesc, &instead_is_null);
if (action_is_null || instead_is_null)
- {
elog(ERROR, "internal error: rewrite rule not properly set up");
- }
ruleaction = textout((struct varlena *) ruleaction);
rule_evqual_string = textout((struct varlena *) rule_evqual_string);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_table.c,v 1.10 1998/01/07 21:04:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_table.c,v 1.11 1998/06/15 19:29:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
return (NULL);
}
if (!found)
- {
return (NULL);
- }
return (&(BufferDescriptors[result->id]));
}
* BM_DELETED keeps us from removing buffer twice.
*/
if (buf->flags & BM_DELETED)
- {
return (TRUE);
- }
buf->flags |= BM_DELETED;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.37 1998/04/24 14:42:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.38 1998/06/15 19:29:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bufHdr = &LocalBufferDescriptors[-buffer - 1];
if (bufHdr->tag.relId.relId == relation->rd_id &&
bufHdr->tag.blockNum == blockNumber)
- {
return (buffer);
- }
}
}
return (ReadBuffer(relation, blockNumber));
}
if (!bufHdr)
- {
return (InvalidBuffer);
- }
/* if its already in the buffer pool, we're done */
if (found)
buf->tag.blockNum, buf->sb_relname);
}
else
- {
buf->flags &= ~BM_DIRTY;
- }
}
/*
{
WaitIO(buf2, BufMgrLock);
if (buf2->flags & BM_IO_ERROR)
- {
*foundPtr = FALSE;
- }
}
SpinRelease(BufMgrLock);
BufferDesc *bufHdr;
if (WriteMode == BUFFER_FLUSH_WRITE)
- {
return (FlushBuffer(buffer, TRUE));
- }
else
{
bufHdr->tag.blockNum, bufHdr->sb_relname);
}
else
- {
bufHdr->flags &= ~BM_DIRTY;
- }
if (release)
UnpinBuffer(bufHdr);
SpinRelease(BufMgrLock);
BufferDesc *bufHdr;
if (WriteMode == BUFFER_FLUSH_WRITE)
- {
return (FlushBuffer(buffer, FALSE));
- }
else
{
if (BufferIsValid(i))
{
while (PrivateRefCount[i - 1] > 0)
- {
ReleaseBuffer(i);
- }
}
LastRefCount[i - 1] = 0;
}
buf = &LocalBufferDescriptors[i];
if ((buf->flags & BM_DIRTY) &&
(buf->tag.relId.relId == rdesc->rd_id))
- {
buf->flags &= ~BM_DIRTY;
- }
}
return;
}
{
buf = &BufferDescriptors[i - 1];
if ((buf->tag.relId.dbId == dbid) && (buf->flags & BM_DIRTY))
- {
buf->flags &= ~BM_DIRTY;
- }
}
SpinRelease(BufMgrLock);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.10 1998/06/15 18:39:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.11 1998/06/15 19:29:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
buf->flags &= ~BM_FREE;
}
else
- {
NotInQueue(buf);
- }
b = BufferDescriptorGetBuffer(buf) - 1;
Assert(PrivateRefCount[b] >= 0);
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Id: fd.c,v 1.31 1998/04/05 21:04:27 momjian Exp $
+ * $Id: fd.c,v 1.32 1998/06/15 19:29:11 momjian Exp $
*
* NOTES:
*
{
Assert(file > 0);
if (!FileIsNotOpen(file))
- {
LruDelete(file);
- }
}
#endif
Insert(file);
if (fileName == NULL)
- {
elog(ERROR, "fileNameOpenFile: NULL fname");
- }
vfdP->fileName = malloc(strlen(fileName) + 1);
strcpy(vfdP->fileName, fileName);
FileAccess(file);
returnCode = read(VfdCache[file].fd, buffer, amount);
if (returnCode > 0)
- {
VfdCache[file].seekPos += returnCode;
- }
return returnCode;
}
*/
if (VfdCache[file].fd < 0 || !(VfdCache[file].fdstate & FD_DIRTY))
- {
returnCode = 0;
- }
else
{
returnCode = fsync(VfdCache[file].fd);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.21 1998/05/29 17:00:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.22 1998/06/15 19:29:13 momjian Exp $
*
* NOTES
*
exitpg(3);
}
for (i = 0; i < semNum; i++)
- {
array[i] = semStartValue;
- }
semun.array = array;
errStatus = semctl(semId, 0, SETALL, semun);
if (errStatus == -1)
shmid = PrivateMemoryCreate(memKey, size);
}
else
- {
shmid = shmget(memKey, size, IPC_CREAT | permission);
- }
if (shmid < 0)
{
IpcMemoryDetach(int status, char *shmaddr)
{
if (shmdt(shmaddr) < 0)
- {
elog(NOTICE, "IpcMemoryDetach: shmdt(0x%x): %m", shmaddr);
- }
}
/****************************************************************************/
char *memAddress;
if (UsePrivateMemory)
- {
memAddress = (char *) PrivateMemoryAttach(memId);
- }
else
- {
memAddress = (char *) shmat(memId, 0, 0);
- }
/* if ( *memAddress == -1) { XXX ??? */
if (memAddress == (char *) -1)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.19 1998/05/26 17:29:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.20 1998/06/15 19:29:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* allocator and binding table.
*/
if (!InitSpinLocks(ShmemBootstrap, IPCKeyGetSpinLockSemaphoreKey(key)))
- {
return (FALSE);
- }
/*
* We have just allocated additional space for two spinlocks. Now
* setup the global free space count
*/
if (ShmemBootstrap)
- {
*ShmemFreeStart = currFreeSpace;
- }
/* if ShmemFreeStart is NULL, then the allocator won't work */
Assert(*ShmemFreeStart);
}
else
- {
Assert(!ShmemBootstrap);
- }
/* now release the lock acquired in ShmemHashInit */
SpinRelease(BindingLock);
*ShmemFreeStart += size;
}
else
- {
newSpace = NULL;
- }
SpinRelease(ShmemLock);
if (!newSpace)
- {
elog(NOTICE, "ShmemAlloc: out of memory ");
- }
return (newSpace);
}
}
if (found)
- {
*locationPtr = result->location;
- }
else
- {
result->location = *locationPtr;
- }
SpinRelease(BindingLock);
return (TRUE);
if (found)
return (location);
else
- {
return (INVALID_OFFSET);
- }
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.9 1997/09/08 02:28:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.10 1998/06/15 19:29:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
status = SISegmentInit(true, IPCKeyGetSIBufferMemoryBlock(key));
if (status == -1)
- {
elog(FATAL, "CreateSharedInvalidationState: failed segment init");
- }
}
/****************************************************************************/
status = SISegmentInit(false, IPCKeyGetSIBufferMemoryBlock(key));
if (status == -1)
- {
elog(FATAL, "AttachSharedInvalidationState: failed segment init");
- }
}
void
newInvalid.hashIndex = hashIndex;
if (ItemPointerIsValid(pointer))
- {
ItemPointerCopy(pointer, &newInvalid.pointerData);
- }
else
- {
ItemPointerSetInvalid(&newInvalid.pointerData);
- }
SpinAcquire(SInvalLock);
if (!SISetDataEntry(shmInvalBuffer, &newInvalid))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.8 1997/09/08 21:47:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.9 1998/06/15 19:29:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(segInOutP->procState[index].limit <
stateP->limit ||
stateP->tag < backendTag)))
- {
stateP = &segInOutP->procState[index];
- }
}
/* verify that all "procState" entries checked for matching tags */
}
/* check whether we can remove dead messages */
if (i > MAXNUMMESSAGES)
- {
elog(FATAL, "SIReadEntryData: Invalid segment state");
- }
}
/************************************************************************/
{
/* this adjusts also the state limits! */
if (!SIDelDataEntry(segP))
- {
elog(FATAL, "SIDelExpiredDataEntries: Invalid segment state");
- }
}
}
}
IpcMemoryId shmid;
if (create)
- {
shmid = IpcMemoryCreate(key, size, IPCProtection);
- }
else
- {
shmid = IpcMemoryIdGet(key, size);
- }
return (shmid);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.10 1997/09/22 04:20:53 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.11 1998/06/15 19:29:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
S_UNLOCK(&(slckP->shlock));
}
else
- {
S_UNLOCK(&(slckP->shlock));
- }
S_UNLOCK(&(slckP->exlock));
S_UNLOCK(&(slckP->locklock));
#ifdef LOCKDEBUG
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.29 1998/04/27 04:06:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.30 1998/06/15 19:29:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* either append or replace a block, as required */
if (!HeapTupleIsValid(htup))
- {
tuplen = inv_wrnew(obj_desc, buf, nbytes - nwritten);
- }
else
{
if (obj_desc->offset > obj_desc->highbyte)
}
}
else
- {
nwritten = nbytes;
- }
/*
* Insert a new file system block tuple, index it, and write it out.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.11 1998/01/07 21:05:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.12 1998/06/15 19:29:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
if (strcmp(RelationGetRelationName(relation)->data,
VariableRelationName) == 0)
- {
return (VariableRelationLRelId);
- }
return (linfo->lRelId);
}
*/
Assert(RelationIsValid(relation));
if (LockingDisabled())
- {
return;
- }
linfo = (LockInfo) relation->lockInfo;
curXact = GetCurrentTransactionId();
if ((linfo->flags & ReadRelationLock) &&
TransactionIdEquals(curXact, linfo->transactionIdData))
- {
return;
- }
/* ----------------
* If we don't already have a tuple lock this transaction
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.26 1998/02/26 04:36:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.27 1998/06/15 19:29:20 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
LockTableId newTableId;
if (NumTables >= MAX_TABLES)
- {
return (INVALID_TABLEID);
- }
if (AllTables[tableId] == INVALID_TABLEID)
- {
return (INVALID_TABLEID);
- }
/* other modules refer to the lock table by a tableId */
newTableId = NumTables;
}
if (LockingIsDisabled)
- {
return (TRUE);
- }
LOCK_PRINT("Acquire", lockName, lockt);
masterLock = ltable->ctl->masterLock;
status = LockResolveConflicts(ltable, lock, lockt, myXid);
if (status == STATUS_OK)
- {
GrantLock(lock, lockt);
- }
else if (status == STATUS_FOUND)
{
#ifdef USER_LOCKS
for (i = 1; i <= nLockTypes; i++, tmpMask <<= 1)
{
if (lock->activeHolders[i] != myHolders[i])
- {
bitmask |= tmpMask;
- }
}
/* ------------------------
}
if (LockingIsDisabled)
- {
return (TRUE);
- }
LOCK_PRINT("Release", lockName, lockt);
SpinRelease(masterLock);
#ifdef USER_LOCKS
if ((is_user_lock) && (result))
- {
elog(NOTICE, "LockRelease: you don't have a lock on this tag");
- }
else
- {
elog(NOTICE, "LockRelease: find xid, table corrupted");
- }
#else
elog(NOTICE, "LockReplace: xid table corrupted");
#endif
{
#ifdef USER_LOCKS
if (result->queue.prev == INVALID_OFFSET)
- {
elog(NOTICE, "LockRelease: xid.prev == INVALID_OFFSET");
- }
if (result->queue.next == INVALID_OFFSET)
- {
elog(NOTICE, "LockRelease: xid.next == INVALID_OFFSET");
- }
#endif
if (result->queue.next != INVALID_OFFSET)
SHMQueueDelete(&result->queue);
elog(NOTICE, "LockReleaseAll: tableId=%d, pid=%d", tableId, MyProcPid);
#endif
if (is_user_lock_table)
- {
tableId = 1;
- }
#endif
Assert(tableId < NumTables);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.11 1998/01/23 19:53:40 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.12 1998/06/15 19:29:21 momjian Exp $
*
* NOTES:
* (1) The lock.c module assumes that the caller here is doing
tableId = LockTabInit("LockTable", MultiConflicts, MultiPrios, 5);
MultiTableId = tableId;
if (!(MultiTableId))
- {
elog(ERROR, "InitMultiLockm: couldnt initialize lock table");
- }
/* -----------------------
* No short term lock table for now. -Jeff 15 July 1991
*
}
status = LockRelease(tableId, tmpTag, locks[i]);
if (!status)
- {
elog(ERROR, "MultiRelease: couldn't release after error");
- }
}
}
/* shouldn't reach here */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.34 1998/02/26 04:36:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.35 1998/06/15 19:29:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.34 1998/02/26 04:36:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.35 1998/06/15 19:29:21 momjian Exp $
*/
#include
#include
MyProc->sem.semKey = semKey;
}
else
- {
MyProc->sem.semId = -1;
- }
/* ----------------------
* Release the lock.
*/
location = MAKE_OFFSET(MyProc);
if ((!ShmemPIDLookup(MyProcPid, &location)) || (location != MAKE_OFFSET(MyProc)))
- {
elog(FATAL, "InitProc: ShmemPID table broken");
- }
MyProc->errType = NO_ERROR;
SHMQueueElemInit(&(MyProc->links));
proc = (PROC *) MAKE_PTR(location);
- if (proc != MyProc)
- {
- Assert(pid != MyProcPid);
- }
- else
- MyProc = NULL;
+ Assert(proc == MyProc || pid != MyProcPid);
+
+ MyProc = NULL;
/* ---------------
* Assume one lock table.
ShmemInitStruct(name, (unsigned) sizeof(PROC_QUEUE), &found);
if (!queue)
- {
return (NULL);
- }
if (!found)
- {
ProcQueueInit(queue);
- }
return (queue);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.17 1998/04/24 14:42:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.18 1998/06/15 19:29:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
upper = ((PageHeader) page)->pd_upper - alignedSize;
if (lower > upper)
- {
return (InvalidOffsetNumber);
- }
itemId = &((PageHeader) page)->pd_linp[offsetNumber - 1];
(*itemId).lp_off = upper;
space = ((PageHeader) page)->pd_upper - ((PageHeader) page)->pd_lower;
if (space < sizeof(ItemIdData))
- {
return (0);
- }
space -= sizeof(ItemIdData);/* XXX not always true */
return (space);
for (i = PageGetMaxOffsetNumber((Page) phdr) - 1; i >= 0; i--)
{
if (phdr->pd_linp[i].lp_off <= offset)
- {
phdr->pd_linp[i].lp_off += size;
- }
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.30 1998/03/20 04:22:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.31 1998/06/15 19:29:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#else
v = &Md_fdvec[fd];
if (v != (MdfdVec *) NULL)
- {
FileUnlink(v->mdfd_vfd);
- }
#endif
MemoryContextSwitchTo(oldcxt);
#endif
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
- {
return (SM_FAIL);
- }
status = SM_SUCCESS;
if ((nbytes = FileRead(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
{
if (nbytes == 0)
- {
MemSet(buffer, 0, BLCKSZ);
- }
else
- {
status = SM_FAIL;
- }
}
return (status);
#endif
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
- {
return (SM_FAIL);
- }
status = SM_SUCCESS;
if (FileWrite(v->mdfd_vfd, buffer, BLCKSZ) != BLCKSZ)
#endif
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
- {
return (SM_FAIL);
- }
/* write and sync the block */
status = SM_SUCCESS;
v = v->mdfd_chain;
}
else
- {
return ((segno * RELSEG_SIZE) + nblocks);
- }
}
#else
return (_mdnblocks(v->mdfd_vfd, BLCKSZ));
v = &Md_fdvec[i];
if (v != (MdfdVec *) NULL)
#endif
- {
v->mdfd_flags &= ~MDFD_DIRTY;
- }
}
return (SM_SUCCESS);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.17 1998/05/06 23:50:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.18 1998/06/15 19:29:26 momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
*/
fip = &last_fp;
if (!valid_fp_info(fid, fip))
- {
update_fp_info(fid, fip);
- }
if (fip->nargs != nargs)
{
for (i = 0; i < 8; ++i)
{
if (i >= nargs)
- {
arg[i] = (char *) NULL;
- }
else
{
argsize = pq_getint(4);
if (!(p = palloc(argsize + VARHDRSZ + 1))) /* Added +1 to solve
* memory leak - Peter
* 98 Jan 6 */
- {
elog(ERROR, "HandleFunctionRequest: palloc failed");
- }
VARSIZE(p) = argsize + VARHDRSZ;
pq_getnchar(VARDATA(p), 0, argsize);
}
{ /* ... fixed */
/* XXX cross our fingers and trust "argsize" */
if (!(p = palloc(argsize + 1)))
- {
elog(ERROR, "HandleFunctionRequest: palloc failed");
- }
pq_getnchar(p, 0, argsize);
}
palloced |= (1 << i);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.75 1998/06/09 17:13:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.76 1998/06/15 19:29:27 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
* function executor will crash. DZ - 30-8-1996
*/
else
- {
plan_list = lappend(plan_list, NULL);
- }
#endif
}
exitpg(1);
}
else if (argc - optind == 1)
- {
DBName = argv[optind];
- }
else if ((DBName = userName) == NULL)
{
fprintf(stderr, "%s: USER undefined and no database specified\n",
/* initialize */
if (!Quiet)
- {
puts("\tInitPostgres()..");
- }
InitPostgres(DBName);
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.75 $ $Date: 1998/06/09 17:13:04 $");
+ puts("$Revision: 1.76 $ $Date: 1998/06/15 19:29:27 $");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.40 1998/06/15 18:39:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.41 1998/06/15 19:29:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
stmt->definition); /* rest */
break;
case TYPE_P:
- {
DefineType(stmt->defname, stmt->definition);
- }
break;
case AGGREGATE:
DefineAggregate(stmt->defname, /* aggregate name */
relationName = RewriteGetRuleEventRel(rulename);
aclcheck_result = pg_aclcheck(relationName, userName, ACL_RU);
if (aclcheck_result != ACLCHECK_OK)
- {
elog(ERROR, "%s: %s", relationName, aclcheck_error_strings[aclcheck_result]);
- }
#endif
RemoveRewriteRule(rulename);
}
break;
case T_VersionStmt:
- {
elog(ERROR, "CREATE VERSION is not currently implemented");
- }
break;
case T_CreatedbStmt:
copy(value, VARRAY_NTH(array->val, array->size, array->nobj));
array->nobj++;
if (array->nobj >= array->maxObj)
- {
ENLARGE_VARRAY(array, array->maxObj / 2);
- }
return array->nobj;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.8 1998/02/26 04:36:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.9 1998/06/15 19:29:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ntups = PQntuplesGroup(pbuf, 0);
if (ntups == 0)
- {
return;
- }
fromNode_attnum = PQfnumber(pbuf, 0, "fromNode");
fromPort_attnum = PQfnumber(pbuf, 0, "fromPort");
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.27 1998/02/26 04:36:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.28 1998/06/15 19:29:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*s != ACL_MODECHG_EQL_CHR)
{ /* we just read a keyword, not a name */
if (!strcmp(name, ACL_IDTYPE_GID_KEYWORD))
- {
aip->ai_idtype = ACL_IDTYPE_GID;
- }
else if (strcmp(name, ACL_IDTYPE_UID_KEYWORD))
- {
elog(ERROR, "aclparse: bad keyword, must be [group|user]");
- }
s = getid(s, name); /* move s to the name beyond the keyword */
if (name[0] == '\0')
elog(ERROR, "aclparse: a name must follow the [group|user] keyword");
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.29 1998/03/30 16:47:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.30 1998/06/15 19:29:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ndim++;
}
else
- {
done = true;
- }
}
if (ndim == 0)
for (i = 0; i < ndim; lBound[i++] = 1);
}
else
- {
elog(ERROR, "array_in: Need to specify dimension");
- }
}
else
{
char *q;
for (i = 0; i < MAXDIM; ++i)
- {
temp[i] = dim[i] = 0;
- }
if (strncmp(str, "{}", 2) == 0)
return (0);
case '\\':
/* skip escaped characters (\ and ") inside strings */
if (scanning_string && *(q + 1))
- {
q++;
- }
break;
case '\0':
q++;
}
for (i = 0; i < ndim; ++i)
- {
dim[i] = temp[i];
- }
return (ndim);
}
if (values[i])
{
if (typalign == 'd')
- {
*nbytes += DOUBLEALIGN(*(int32 *) values[i]);
- }
else
- {
*nbytes += INTALIGN(*(int32 *) values[i]);
- }
}
else
{
str = _AdvanceBy1word(str, &chunkfile);
}
else
- {
- }
}
if (inputfile == NULL)
1, isNull);
}
else
- {
_ReadArray(lowerIndx, upperIndx, len, fd, newfd, array, 1, isNull);
- }
}
#ifdef LOARRAY
LOclose(fd);
if (!SanityCheckInput(ndim, n, dim, lb, upperIndx) ||
!SanityCheckInput(ndim, n, dim, lb, lowerIndx))
- {
return ((char *) array);
- }
for (i = 0; i < n; i++)
if (lowerIndx[i] > upperIndx[i])
*typelem = typeStruct->typelem;
*typalign = typeStruct->typalign;
if (input)
- {
*proc = typeStruct->typinput;
- }
else
- {
*proc = typeStruct->typoutput;
- }
}
static Datum
}
}
else
- {
return (Datum) value;
- }
return 0;
}
}
}
else
- {
memmove(dest, src, typlen);
- }
inc = typlen;
}
else
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.23 1998/03/02 00:13:36 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.24 1998/06/15 19:29:32 momjian Exp $
*/
#include
}
else if (*s == psymbol)
- {
s++;
- }
#ifdef CASHDEBUG
printf( "cashin- string is '%s'\n", s);
p += 6;
}
else
- {
*buf = 0;
- }
m0 = *value % 100; /* cents */
m1 = (*value / 100) % 1000; /* hundreds */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.22 1998/02/26 04:36:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.23 1998/06/15 19:29:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
date_cmp(DateADT dateVal1, DateADT dateVal2)
{
if (dateVal1 < dateVal2)
- {
return -1;
- }
else if (dateVal1 > dateVal2)
- {
return 1;
- }
return 0;
} /* date_cmp() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.9 1998/01/05 16:39:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.10 1998/06/15 19:29:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (byVal)
{
if (len <= sizeof(Datum))
- {
size = len;
- }
else
{
elog(ERROR,
if (byVal)
- {
res = value;
- }
else
{
if (value == 0)
*/
s = (char *) palloc(realSize);
if (s == NULL)
- {
elog(ERROR, "datumCopy: out of memory\n");
- }
memmove(s, DatumGetPointer(value), realSize);
res = (Datum) s;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.54 1998/06/15 18:39:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.55 1998/06/15 19:29:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
else
- {
EncodeSpecialDateTime(DT_INVALID, buf);
- }
result = palloc(strlen(buf) + 1);
}
else if (TIMESPAN_IS_INVALID(*timespan2))
- {
return (-1);
- }
span1 = timespan1->time;
if (timespan1->month != 0)
dt2 = SetDateTime(dt2);
if (DATETIME_IS_INVALID(dt1))
- {
*result = dt2;
- }
else if (DATETIME_IS_INVALID(dt2))
- {
*result = dt1;
- }
else
- {
*result = ((dt2 < dt1) ? dt2 : dt1);
- }
return (result);
} /* datetime_smaller() */
dt2 = SetDateTime(dt2);
if (DATETIME_IS_INVALID(dt1))
- {
*result = dt2;
- }
else if (DATETIME_IS_INVALID(dt2))
- {
*result = dt1;
- }
else
- {
*result = ((dt2 > dt1) ? dt2 : dt1);
- }
return (result);
} /* datetime_larger() */
}
else
- {
result->time = JROUND(dt1 - dt2);
- }
result->month = 0;
return (result);
if (tm->tm_mday > mdays[tm->tm_mon - 1])
{
if ((tm->tm_mon == 2) && isleap(tm->tm_year))
- {
tm->tm_mday = (mdays[tm->tm_mon - 1] + 1);
- }
else
- {
tm->tm_mday = mdays[tm->tm_mon - 1];
- }
}
#ifdef DATEDEBUG
}
else
- {
DATETIME_INVALID(dt);
- }
}
*result = dt;
}
if (tm2timespan(tm, fsec, result) != 0)
- {
elog(ERROR, "Unable to decode datetime", NULL);
- }
}
else
- {
elog(ERROR, "Unable to decode datetime", NULL);
- }
return (result);
} /* datetime_age() */
type = DecodeUnits(0, lowunits, &val);
if (type == IGNORE)
- {
type = DecodeSpecial(0, lowunits, &val);
- }
#ifdef DATEDEBUG
if (type == IGNORE)
type = DecodeUnits(0, lowunits, &val);
if (type == IGNORE)
- {
type = DecodeSpecial(0, lowunits, &val);
- }
#ifdef DATEDEBUG
if (type == IGNORE)
* day later
*/
else
- {
ftype[nf] = DTK_NUMBER;
- }
}
/* otherwise something wrong... */
}
else
- {
return -1;
- }
/* ignore punctuation but use as delimiter */
}
}
else
- {
return -1;
- }
/* force in a delimiter */
*lp++ = '\0';
nf++;
if (nf > MAXDATEFIELDS)
- {
return -1;
- }
#ifdef DATEDEBUG
printf("ParseDateTime- set field[%d] to %s type %d\n", (nf - 1), field[nf - 1], ftype[nf - 1]);
#endif
str = cp + 1;
tm->tm_sec = strtol(str, &cp, 10);
if (*cp == '\0')
- {
*fsec = 0;
- }
else if (*cp == '.')
{
str = cp;
return -1;
}
else
- {
return -1;
- }
}
/* do a sanity check */
*tmask = DTK_M(YEAR);
tm->tm_year = val;
if (tm->tm_year < 70)
- {
tm->tm_year += 2000;
- }
else if (tm->tm_year < 100)
- {
tm->tm_year += 1900;
- }
}
else
- {
return -1;
- }
return 0;
} /* DecodeNumber() */
if (cp == (str + 4))
return -1;
if (*cp == '.')
- {
*fsec = strtod(cp, NULL);
- }
*(str + 4) = '\0';
tm->tm_min = strtod((str + 2), &cp);
*(str + 2) = '\0';
}
else
- {
return -1;
- }
return 0;
} /* DecodeNumberField() */
}
else
- {
min = 0;
- }
tz = (hr * 60 + min) * 60;
if (*str == '-')
#if USE_DATE_CACHE
if ((datecache[field] != NULL)
&& (strncmp(lowtoken, datecache[field]->token, TOKMAXLEN) == 0))
- {
tp = datecache[field];
- }
else
{
#endif
#if USE_DATE_CACHE
if ((deltacache[field] != NULL)
&& (strncmp(lowtoken, deltacache[field]->token, TOKMAXLEN) == 0))
- {
tp = deltacache[field];
- }
else
{
#endif
{
type = tp->type;
if ((type == TZ) || (type == DTZ))
- {
*val = FROMVAL(tp);
- }
else
- {
*val = tp->value;
- }
}
return (type);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.14 1998/02/26 04:37:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.15 1998/06/15 19:29:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ind = len + 1;
}
else
- {
elog(ERROR, "Couldn't find %s in your environment", environment);
- }
}
else
- {
ind = 0;
- }
strcat(str, file + ind);
return (str);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.32 1998/05/09 22:39:55 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.33 1998/06/15 19:29:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
s++;
}
else
- {
return (FALSE);
- }
}
*ss = s;
return (FPeq(l1->m, l2->m));
#endif
if (FPzero(l1->B))
- {
return (FPzero(l2->B));
- }
return (FPeq(l2->A, l1->A * (l2->B / l1->B)));
} /* line_parallel() */
return (FPeq(l1->m / l2->m, -1.0));
#endif
if (FPzero(l1->A))
- {
return (FPzero(l2->B));
- }
else if (FPzero(l1->B))
- {
return (FPzero(l2->A));
- }
return (FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0));
} /* line_perp() */
min = tmp;
}
else
- {
pfree(tmp);
- }
}
return (min);
* and through the input point
*/
if (lseg->p[1].x == lseg->p[0].x)
- {
m = 0;
- }
else if (lseg->p[1].y == lseg->p[0].y)
{ /* slope is infinite */
m = (double) DBL_MAX;
result = d2;
}
else
- {
pfree(d2);
- }
}
return (result);
box_fill(&(poly->boundbox), x1, x2, y1, y2);
}
else
- {
elog(ERROR, "Unable to create bounding box for empty polygon", NULL);
- }
}
/*------------------------------------------------------------------
}
else
- {
result = NULL;
- }
return (result);
} /* poly_center() */
while (isspace(*cp))
cp++;
if (*cp == LDELIM)
- {
s = cp;
- }
}
if (!pair_decode(s, &circle->center.x, &circle->center.y, &s))
s++;
}
else
- {
elog(ERROR, "Bad circle external representation '%s'", str);
- }
}
if (*s != '\0')
circle->center.y /= poly->npts;
for (i = 0; i < poly->npts; i++)
- {
circle->radius += point_dt(&poly->p[i], &circle->center);
- }
circle->radius /= poly->npts;
if (FPzero(circle->radius))
y = plist[i].y - p->y;
if ((cross = lseg_crossing(x, y, px, py)) == HIT_IT)
- {
return 2;
- }
crossnum += cross;
px = x;
py = y;
}
if ((cross = lseg_crossing(x0, y0, px, py)) == HIT_IT)
- {
return 2;
- }
crossnum += cross;
if (crossnum != 0)
- {
return 1;
- }
return 0;
} /* point_inside() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.42 1998/02/26 04:37:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.43 1998/06/15 19:29:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef USE_POSIX_TIME
if (tzp != NULL)
- {
tx = localtime((time_t *) &time);
- }
else
{
tx = gmtime((time_t *) &time);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.12 1998/05/29 13:31:52 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.13 1998/06/15 19:29:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
for (length = 0, charP = name->data;
length < NAMEDATALEN && *charP != '\0';
length++, charP++)
- {
;
- }
return (uint32) length;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.8 1998/01/31 04:38:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.9 1998/06/15 19:29:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
integer_value = DatumGetInt16(value);
if (left_side_argument == integer_value)
- {
retval = false;
- }
}
/* close the relation */
for (i = 0; i < rd->rd_rel->relnatts; i++)
{
if (!namestrcmp(&rd->rd_att->attrs[i]->attname, a))
- {
return (i + 1);
- }
}
return (-1);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.23 1998/02/26 04:37:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.24 1998/06/15 19:29:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* output left of dp */
expon--;
if (*p)
- {
*a++ = *p++;
- }
else
*a++ = '0';
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.5 1998/02/26 04:37:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.6 1998/06/15 19:29:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
oi->oi_oid = (Oid) pg_atoi(o, sizeof(Oid), '/');
if (*p == '\0')
- {
oi->oi_int2 = 0;
- }
else
- {
oi->oi_int2 = (int16) pg_atoi(++p, sizeof(int2), '\0');
- }
return (oi);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.5 1998/02/26 04:37:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.6 1998/06/15 19:29:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
oi->oi_oid = (Oid) pg_atoi(o, sizeof(Oid), '/');
if (*p == '\0')
- {
oi->oi_int4 = 0;
- }
else
- {
oi->oi_int4 = pg_atoi(++p, sizeof(int4), '\0');
- }
return (oi);
}
/*
* Edmund Mergl
*
- * $Id: oracle_compat.c,v 1.13 1998/04/27 17:08:19 scrappy Exp $
+ * $Id: oracle_compat.c,v 1.14 1998/06/15 19:29:36 momjian Exp $
*
*/
ptr_ret = VARDATA(ret);
while (m--)
- {
*ptr_ret++ = tolower((unsigned char)*ptr++);
- }
return ret;
}
ptr_ret = VARDATA(ret);
while (m--)
- {
*ptr_ret++ = toupper((unsigned char)*ptr++);
- }
return ret;
}
while (m--)
{
if (*(ptr_ret - 1) == ' ' || *(ptr_ret - 1) == ' ')
- {
*ptr_ret++ = toupper((unsigned char)*ptr++);
- }
else
- {
*ptr_ret++ = tolower((unsigned char)*ptr++);
- }
}
return ret;
ptr1 = VARDATA(string1);
while (n--)
- {
*ptr_ret++ = *ptr1++;
- }
return ret;
}
ptr_ret = VARDATA(ret);
while (n--)
- {
*ptr_ret++ = *ptr1++;
- }
ptr2 = VARDATA(string2);
while (ptr2 <= end2)
{
if (*ptr == *ptr2)
- {
break;
- }
++ptr2;
}
if (*ptr != *ptr2)
- {
break;
- }
ptr++;
ptr2 = VARDATA(set);
}
while (ptr2 <= end2)
{
if (*end == *ptr2)
- {
break;
- }
++ptr2;
}
if (*end != *ptr2)
- {
break;
- }
--end;
ptr2 = VARDATA(set);
}
while (ptr2 <= end2)
{
if (*ptr == *ptr2)
- {
break;
- }
++ptr2;
}
if (*ptr != *ptr2)
- {
break;
- }
ptr++;
ptr2 = VARDATA(set);
}
while (ptr2 <= end2)
{
if (*ptr == *ptr2)
- {
break;
- }
++ptr2;
}
if (*ptr != *ptr2)
- {
break;
- }
--ptr;
ptr2 = VARDATA(set);
}
ptr_ret = VARDATA(ret) + m - 1;
while (m--)
- {
*ptr_ret-- = *ptr--;
- }
return ret;
}
ptr_ret = VARDATA(ret);
while (len--)
- {
*ptr_ret++ = *ptr++;
- }
return ret;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.17 1998/04/26 04:07:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.18 1998/06/15 19:29:36 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
for (oldest = 0, i = 1; i < rec; i++)
{
if (rev[i].cre_lru < rev[oldest].cre_lru)
- {
oldest = i;
- }
}
}
else
- {
oldest = rec++;
- }
/* if there was an old re, then de-allocate the space it used */
if (rev[oldest].cre_s != (char *) NULL)
rev[i].cre_lru =
(rev[i].cre_lru - rev[oldest].cre_lru) / 2;
if (rev[i].cre_lru > lru)
- {
lru = rev[i].cre_lru;
- }
}
pg95_regfree(&rev[oldest].cre_re);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.18 1998/04/26 04:07:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
RelationGetTupleDescriptor(proc),
&isnull);
if (isnull)
- {
elog(FATAL, "regprocin: null procedure %s", proname);
- }
break;
case 0:
result = (RegProcedure) 0;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.18 1998/02/26 04:37:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
ntuples = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
if (ntuples > 0)
- {
resultData = 1.0 / (float64data) ntuples;
- }
else
- {
resultData = (float64data) (1.0 / 100.0);
- }
result = &resultData;
}
ntuples = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
if (ntuples > 0)
- {
tempData = 1.0 / (float64data) ntuples;
- }
else
- {
tempData = (float64data) (1.0 / 100.0);
- }
temp = &tempData;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.32 1998/05/29 13:33:24 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.33 1998/06/15 19:29:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* blank pad the string if necessary */
for (; i < len; i++)
- {
*r++ = ' ';
- }
return (result);
}
/* blank pad the string if necessary */
for (; i < rlen; i++)
- {
*r++ = ' ';
- }
return (result);
} /* bpchar() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.35 1998/05/29 13:33:58 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.36 1998/06/15 19:29:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
byte = byteaGetByte(v, byteNo);
if (byte & (1 << bitNo))
- {
return ((int32) 1);
- }
else
- {
return ((int32) 0);
- }
}
/*-------------------------------------------------------------
* sanity check!
*/
if (newBit != 0 && newBit != 1)
- {
elog(ERROR, "byteaSetByte: new bit must be 0 or 1");
- }
/*
* get the byte where the bit we want is stored.
* calculate the new value for that byte
*/
if (newBit == 0)
- {
newByte = oldByte & (~(1 << bitNo));
- }
else
- {
newByte = oldByte | (1 << bitNo);
- }
/*
* NOTE: 'byteaSetByte' creates a copy of 'v' & sets the byte.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.28 1998/06/15 18:39:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.29 1998/06/15 19:29:38 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
if (cp)
relation = heap_open(cp->relationId);
else
- {
relation = heap_openr(cache->cc_relname);
- }
didopen = 1;
}
i = 0;
while (l--)
- {
i += *v++;
- }
return (i);
}
for (cache = Caches; PointerIsValid(cache); cache = cache->cc_next)
{
if (cache->relationId == relId)
- {
cache->relationId = InvalidOid;
- }
}
}
{
cp->cc_key[i] = key[i];
if (!key[i])
- {
elog(FATAL, "InitSysCache: called with 0 key[%d]", i);
- }
if (key[i] < 0)
{
if (key[i] != ObjectIdAttributeNumber)
- {
elog(FATAL, "InitSysCache: called with %d key[%d]", key[i], i);
- }
else
{
cp->cc_klen[i] = sizeof(Oid);
*/
MemoryContextSwitchTo((MemoryContext) CacheCxt);
if (HeapTupleIsValid(ntp))
- {
ntp = heap_copytuple(ntp);
- }
}
else
{
/* OPT inline simplification of CatalogCacheIdInvalidate */
if (!PointerIsValid(function))
- {
function = CatalogCacheIdInvalidate;
- }
(*function) (ccp->id,
CatalogCacheComputeTupleHashIndex(ccp, relation, tuple),
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.11 1998/02/26 04:37:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.12 1998/06/15 19:29:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
retval->nargs = retval->func.fn_nargs;
}
else
- {
retval->func.fn_addr = (func_ptr) NULL;
- }
return (retval);
fnode->func_fcache = fcache;
}
else
- {
elog(ERROR, "init_fcache: node must be Oper or Func!");
- }
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.10 1998/02/23 17:43:23 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.11 1998/06/15 19:29:39 momjian Exp $
*
* Note - this code is real crufty...
*
&((InvalidationUserData *) invalid)->dataP[-1];
if (PointerIsValid(function))
- {
(*function) ((Pointer) &entryDataP->userData);
- }
invalid = (Pointer) entryDataP->nextP;
* ----------------
*/
if (relationId == MyRelationRelationId)
- {
objectId = tuple->t_oid;
- }
else if (relationId == MyAttributeRelationId)
- {
objectId = ((AttributeTupleForm) GETSTRUCT(tuple))->attrelid;
- }
else if (relationId == MyAMRelationId)
- {
objectId = tuple->t_oid;
- }
else if (relationId == MyAMOPRelationId)
{
; /* objectId is unused */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.13 1998/02/26 04:37:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.14 1998/06/15 19:29:40 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
return TRUE;
}
else
- {
return FALSE;
- }
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.39 1998/06/15 18:39:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.40 1998/06/15 19:29:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* ----------------
*/
if (!HeapTupleIsValid(pg_class_tuple))
- {
return_tuple = pg_class_tuple;
- }
else
{
/* ------------------
* ----------------
*/
if (relp->relhasrules)
- {
RelationBuildRuleLock(relation);
- }
else
- {
relation->rd_rules = NULL;
- }
/* Triggers */
if (relp->reltriggers > 0)
* ----------------
*/
if (OidIsValid(relam))
- {
IndexedAccessMethodInitialize(relation);
- }
/* ----------------
* initialize the relation lock manager information
support = (RegProcedure *) palloc(supportSize);
}
else
- {
support = (RegProcedure *) NULL;
- }
IndexSupportInitialize(strategy, support,
relation->rd_att->attrs[0]->attrelid,
int j;
for (j = 0; j < relation->rd_rules->numLocks; j++)
- {
pfree(relation->rd_rules->rules[j]);
- }
pfree(relation->rd_rules->rules);
pfree(relation->rd_rules);
}
if (relation->rd_rel->relkind == RELKIND_INDEX && /* XXX style */
(!OidIsValid(accessMethodId) ||
relation->rd_rel->relam == accessMethodId))
- {
RelationFlushRelation(&relation, false);
- }
}
#endif
}
}
else
- {
smgrunlink(DEFAULT_SMGR, reln);
- }
}
else if (!IsBootstrapProcessingMode() && !(reln->rd_istemp))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.17 1998/05/09 23:45:29 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.18 1998/06/15 19:29:40 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
return ((HeapTuple) NULL);
}
- if (!AMI_OVERRIDE)
- {
- Assert(PointerIsValid(SysCache[cacheId]));
- }
- else
+ Assert(AMI_OVERRIDE || PointerIsValid(SysCache[cacheId]));
+
+ if (!PointerIsValid(SysCache[cacheId]))
{
+ SysCache[cacheId] =
+ InitSysCache(cacheinfo[cacheId].name,
+ cacheinfo[cacheId].indname,
+ cacheId,
+ cacheinfo[cacheId].nkeys,
+ cacheinfo[cacheId].key,
+ cacheinfo[cacheId].iScanFunc);
if (!PointerIsValid(SysCache[cacheId]))
- {
- SysCache[cacheId] =
- InitSysCache(cacheinfo[cacheId].name,
- cacheinfo[cacheId].indname,
- cacheId,
- cacheinfo[cacheId].nkeys,
- cacheinfo[cacheId].key,
- cacheinfo[cacheId].iScanFunc);
- if (!PointerIsValid(SysCache[cacheId]))
- {
- elog(ERROR,
- "InitCatalogCache: Can't init cache %.16s(%d)",
- cacheinfo[cacheId].name,
- cacheId);
- }
-
- }
+ elog(ERROR,
+ "InitCatalogCache: Can't init cache %.16s(%d)",
+ cacheinfo[cacheId].name,
+ cacheId);
}
tp = SearchSysCache(SysCache[cacheId], key1, key2, key3, key4);
}
if (attributeByValue)
- {
returnValue = (void *) attributeValue;
- }
else
{
char *tmp;
returnValue = (void *) i32;
}
else
- {
returnValue = NULL;
- }
}
else
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.28 1998/05/19 18:05:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.29 1998/06/15 19:29:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
va_start(ap, fmt);
if (lev == DEBUG && Debugfile < 0)
- {
return;
- }
switch (lev)
{
case NOIND:
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.17 1998/01/31 04:38:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.18 1998/06/15 19:29:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (file_scanner == (DynamicFileList *) NULL)
{
if (stat(filename, &stat_buf) == -1)
- {
elog(ERROR, "stat failed on file %s", filename);
- }
for (file_scanner = file_list;
file_scanner != (DynamicFileList *) NULL
}
}
else
- {
file_scanner = (DynamicFileList *) NULL;
- }
/*
* File not loaded yet.
{
load_error = (char *) pg_dlerror();
if (file_scanner == file_list)
- {
file_list = (DynamicFileList *) NULL;
- }
else
- {
file_tail->next = (DynamicFileList *) NULL;
- }
free((char *) file_scanner);
elog(ERROR, "Load of file %s failed: %s", filename, load_error);
retval = (func_ptr) pg_dlsym(file_scanner->handle, funcname);
if (retval == (func_ptr) NULL)
- {
elog(ERROR, "Can't find function %s in file %s", funcname, filename);
- }
return (retval);
}
int done = 0;
if (stat(filename, &stat_buf) == -1)
- {
elog(ERROR, "stat failed on file %s", filename);
- }
if (file_list != (DynamicFileList *) NULL
&& !NOT_EQUAL(stat_buf, *file_list))
while (!done)
{
if (file_scanner->next == (DynamicFileList *) NULL)
- {
done = 1;
- }
else if (!NOT_EQUAL(stat_buf, *(file_scanner->next)))
- {
done = 1;
- }
else
- {
file_scanner = file_scanner->next;
- }
}
if (file_scanner->next != (DynamicFileList *) NULL)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.16 1998/03/07 06:03:28 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.17 1998/06/15 19:29:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
va_start(pvar, arg0);
for (i = 1; i < fmgr_pl_finfo->fn_nargs; i++)
- {
values.data[i] = va_arg(pvar, char *);
- }
va_end(pvar);
}
}
* instead.
*/
if (finfo->fn_plhandler != NULL)
- {
return (*(finfo->fn_plhandler)) (finfo, values, isNull);
- }
switch (n_arguments)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.13 1998/02/26 04:37:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.14 1998/06/15 19:29:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
MemSet(hashp, 0, sizeof(HTAB));
if (flags & HASH_FUNCTION)
- {
hashp->hash = info->hash;
- }
else
{
/* default */
/* hash table already exists, we're just attaching to it */
if (flags & HASH_ATTACH)
- {
return (hashp);
- }
}
else
{
hashp->hctl = (HHDR *) hashp->alloc((unsigned long) sizeof(HHDR));
if (!hashp->hctl)
- {
return (0);
- }
}
if (!hdefault(hashp))
hctl->sshift = my_log2(info->ssize);
}
if (flags & HASH_FFACTOR)
- {
hctl->ffactor = info->ffactor;
- }
/*
* SHM hash tables have fixed maximum size (allocate a maximal sized
hctl->datasize = info->datasize;
}
if (flags & HASH_ALLOC)
- {
hashp->alloc = info->alloc;
- }
if (init_htab(hashp, nelem))
{
nsegs = 1 << my_log2(nsegs);
if (nsegs > hctl->dsize)
- {
hctl->dsize = nsegs;
- }
/* Use two low order bits of points ???? */
bucket = hash_val & hctl->high_mask;
if (bucket > hctl->max_bucket)
- {
bucket = bucket & hctl->low_mask;
- }
return (bucket);
}
curr = GET_BUCKET(hashp, currIndex);
if (!memcmp((char *) &(curr->key), keyPtr, hctl->keysize))
- {
break;
- }
prevIndexPtr = &(curr->next);
currIndex = *prevIndexPtr;
#if HASH_STATISTICS
/* no free elements. allocate another chunk of buckets */
if (!bucket_alloc(hashp))
- {
return (NULL);
- }
currIndex = hctl->freeBucketIndex;
}
Assert(currIndex != INVALID_INDEX);
/* Allocate new segment if necessary */
if (new_segnum >= hctl->dsize)
- {
dir_realloc(hashp);
- }
if (!(hashp->dir[new_segnum] = seg_alloc(hashp)))
- {
return (0);
- }
hctl->nsegs++;
}
sizeof(SEGMENT) * hashp->hctl->ssize);
if (!segp)
- {
return (0);
- }
MemSet((char *) segp, 0,
(long) sizeof(SEGMENT) * hashp->hctl->ssize);
hashp->alloc((unsigned long) BUCKET_ALLOC_INCR * bucketSize);
if (!tmpBucket)
- {
return (0);
- }
tmpIndex = MAKE_HASHOFFSET(hashp, tmpBucket);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.9 1998/06/09 17:13:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.10 1998/06/15 19:29:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (pwp)
{
if (pwp->pw_gid == buf.st_gid)
- {
++in_grp;
- }
else if (pwp->pw_name &&
(gp = getgrgid(buf.st_gid)))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.28 1998/05/29 17:00:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.29 1998/06/15 19:29:49 momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
postid = getenv("POSTID");
if (!PointerIsValid(postid))
- {
MyBackendTag = -1;
- }
else
{
MyBackendTag = atoi(postid);
ipc_key = getenv("IPC_KEY");
if (!PointerIsValid(ipc_key))
- {
key = -1;
- }
else
{
key = atoi(ipc_key);
* ----------------
*/
if (MyBackendTag == -1)
- {
MyBackendTag = 1;
- }
key = PrivateIPCKey;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.9 1998/05/29 13:43:14 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.10 1998/06/15 19:29:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
/* no path delimiter? then add the default path prefixes */
else
- {
sprintf(buf, "%s%cbase%c%s", DataDir, SEP_CHAR, SEP_CHAR, dbpath);
- }
path = palloc(strlen(buf) + 1);
strcpy(path, buf);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.8 1997/09/08 20:57:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.9 1998/06/15 19:29:51 momjian Exp $
*
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
AssertArg(AllocSetIsValid(set));
while (AllocPointerIsValid(pointer = AllocSetGetFirst(set)))
- {
AllocSetFree(set, pointer);
- }
}
#ifdef NOT_USED
AssertArg(AllocSetIsValid(set));
while (AllocPointerIsValid(pointer = AllocSetGetFirst(set)))
- {
AllocSetFree(set, pointer);
- }
}
#endif
alloc = (AllocElem) malloc(sizeof(*alloc) + size);
if (!PointerIsValid(alloc))
- {
elog(FATAL, "palloc failure: memory exhausted");
- }
/* add to allocation list */
OrderedElemPushInto(&alloc->elemData, &set->setData);
{
if (PointerIsValid(function))
- {
(*function) (pointer);
- }
count += 1;
}
for (pointer = AllocSetGetFirst(set);
AllocPointerIsValid(pointer);
pointer = AllocPointerGetNext(pointer))
- {
count++;
- }
return count;
}
alloc = (AllocElem) OrderedSetGetHead(&set->setData);
if (!AllocElemIsValid(alloc))
- {
return (NULL);
- }
return (AllocElemGetAllocPointer(alloc));
}
OrderedElemGetSuccessor(&AllocPointerGetAllocElem(pointer)->elemData);
if (!AllocElemIsValid(alloc))
- {
return (NULL);
- }
return (AllocElemGetAllocPointer(alloc));
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.7 1998/02/26 04:38:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.8 1998/06/15 19:29:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
AssertArg(BoolIsValid(on));
if (BypassEnable(&MemoryContextEnableCount, on))
- {
return;
- }
processing = true;
OrderedElemPop(&TopGlobalMemoryData.elemData);
}
else
- {
GlobalMemoryDestroy(context);
- }
/* what is needed for the top? */
}
context = (GlobalMemory) OrderedElemGetPredecessor(&this->elemData);
if (PointerIsValid(context))
- {
printf("\tpredecessor=%s\n", GlobalMemoryGetName(context));
- }
context = (GlobalMemory) OrderedElemGetSuccessor(&this->elemData);
if (PointerIsValid(context))
- {
printf("\tsucessor=%s\n", GlobalMemoryGetName(context));
- }
AllocSetDump(&this->setData); /* XXX is this right interface */
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.7 1998/02/11 19:13:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.8 1998/06/15 19:29:53 momjian Exp $
*
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
elem = set->head;
if (elem->next)
- {
return (OrderedElemGetBase(elem));
- }
return (NULL);
}
elem = set->tail;
if (elem->prev)
- {
return (OrderedElemGetBase(elem));
- }
return (NULL);
}
{
elem = elem->prev;
if (elem->prev)
- {
return (OrderedElemGetBase(elem));
- }
return (NULL);
}
{
elem = elem->next;
if (elem->next)
- {
return (OrderedElemGetBase(elem));
- }
return (NULL);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.11 1998/06/15 18:39:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.12 1998/06/15 19:29:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
AssertState(PortalManagerEnabled);
if (PointerIsValid(name))
- {
PortalHashTableLookup(name, portal);
- }
else
{
if (!PortalIsValid(BlankPortal))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.40 1998/06/15 18:39:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.41 1998/06/15 19:29:54 momjian Exp $
*
* NOTES
* Sorts the first relation into the second relation.
file = freopen(tp->tl_name, "w+", file);
if (file == NULL)
- {
elog(FATAL, "could not freopen temporary file");
- }
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.15 1998/04/24 14:42:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.16 1998/06/15 19:29:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
HeapSpecialCommandId = GetCurrentCommandId();
}
else
- {
HeapSpecialTransactionId = InvalidTransactionId;
- }
}
#endif /* !defined(GOODAMI) */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.20 1998/02/26 04:38:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.21 1998/06/15 19:30:00 momjian Exp $
*
*
for (i = 0; i < numInherits; i++)
{
if (strcmp(inhinfo[i].inhrel, oid) == 0)
- {
numParents++;
- }
}
*numParentsPtr = numParents;
if (strInArray(tblinfo[i].attnames[j],
tblinfo[parentInd].attnames,
tblinfo[parentInd].numatts) != -1)
- {
tblinfo[i].inhAttrs[j] = 1;
- }
}
}
}
cp = id;
}
else
- {
cp = rawid;
- }
return (cp);
} /* fmtId() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.71 1998/05/06 23:53:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.72 1998/06/15 19:30:01 momjian Exp $
*
*
do
{
if (PQgetisnull(res, tuple, field))
- {
fprintf(fout, "NULL");
- }
else
{
switch (PQftype(res, field))
/* open the output file */
if (filename == NULL)
- {
g_fout = stdout;
- }
else
{
g_fout = fopen(filename, "w");
tblinfo = dumpSchema(NULL, &numTables, tablename, acls);
if (!schemaOnly)
- {
dumpClasses(tblinfo, numTables, g_fout, tablename, oids);
- }
if (!dataOnly) /* dump indexes and triggers at the end
* for performance */
int i;
for (i = 0; i < numFuncs; i++)
- {
dumpOneFunc(fout, finfo, i, tinfo, numTypes);
- }
}
/*
if (strcmp(agginfo[i].aggfinalfn, "-") == 0)
finalfunc[0] = '\0';
else
- {
sprintf(finalfunc, "FINALFUNC = %s", agginfo[i].aggfinalfn);
- }
if (sfunc1[0] != '\0' && sfunc2[0] != '\0')
{
comma1[0] = ',';
fmtId(indinfo[i].indrelname));
if (strcmp(indinfo[i].indproc, "0") == 0)
- {
funcname = NULL;
- }
else
{
for (j = 0; j < n; j++)
{
for (k = 0; k < m; k++)
- {
outVals[attrmap[k]] = PQgetvalue(res, j, k);
- }
for (k = 0; k < m; k++)
{
char *pval = outVals[k];
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.5 1997/09/08 02:32:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.6 1998/06/15 19:30:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
printf("%ld\n", (long) pw->pw_uid);
}
else
- {
printf("%ld\n", (long) getuid());
- }
exit(0);
}
Tcl_AppInit(Tcl_Interp * interp)
{
if (Tcl_Init(interp) == TCL_ERROR)
- {
return TCL_ERROR;
- }
/*
* Call the init procedures for included packages. Each call should
*/
if (Pgtcl_Init(interp) == TCL_ERROR)
- {
return TCL_ERROR;
- }
/*
* Call Tcl_CreateCommand for application-specific commands, if they
Tcl_AppInit(Tcl_Interp * interp)
{
if (Tcl_Init(interp) == TCL_ERROR)
- {
return TCL_ERROR;
- }
if (Tk_Init(interp) == TCL_ERROR)
- {
return TCL_ERROR;
- }
/*
* Call the init procedures for included packages. Each call should
*/
if (Pgtcl_Init(interp) == TCL_ERROR)
- {
return TCL_ERROR;
- }
/*
* Call Tcl_CreateCommand for application-specific commands, if they
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.144 1998/05/15 01:57:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.145 1998/06/15 19:30:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
exit(1); /* accept signal if no connection */
/* Try to send cancel request */
if (PQrequestCancel(cancelConn))
- {
fprintf(stderr, "\nCANCEL request sent\n");
- }
else
{
fprintf(stderr, "\nCannot send cancel request:\n%s\n",
strcat(query, " TO stdout");
if (from)
- {
copystream = fopen(file, "r");
- }
else
- {
copystream = fopen(file, "w");
- }
if (copystream == NULL)
fprintf(stderr,
"Unable to open file %s which to copy, errno = %s (%d).",
}
else
- {
query_alloced = true;
- }
}
interactive = ((source == stdin) && !pset->notty);
strcat(query, query_start);
}
else
- {
strcpy(query, query_start);
- }
}
line[i] = hold_char;
query_start = line + i;
/* inside a quote? */
if (in_quote && (line[i] != '\'' || was_bslash))
- {
/* do nothing */ ;
- }
else if (xcomment != NULL) /* inside an extended
* comment? */
{
break;
}
else if (line[i] == '\'')
- {
in_quote ^= 1;
- }
/* semi-colon? then send query now */
else if (!paren_level && line[i] == ';')
{
}
else if (paren_level && line[i] == ')')
- {
paren_level--;
- }
}
}
case 'c':
singleQuery = strdup(optarg);
if (singleQuery[0] == '\\')
- {
singleSlashCmd = 1;
- }
break;
case 'd':
dbname = optarg;
free(connect_string);
}
else
- {
settings.db = PQsetdb(host, port, NULL, NULL, dbname);
- }
dbname = PQdb(settings.db);
cancelConn = settings.db; /* enable SIGINT to send cancel */
if (listDatabases)
- {
exit(listAllDbs(&settings));
- }
if (!settings.quiet && !settings.notty && !singleQuery && !qfilename)
{
printf("Welcome to the POSTGRESQL interactive sql monitor:\n");
for (; buflen > 1 &&
!(linedone = (c = getc(copystream)) == '\n' || c == EOF);
--buflen)
- {
*s++ = c;
- }
if (c == EOF)
{
PQputline(res->conn, "\\.");
if (firstload)
{
if (!strcmp(copybuf, "\\."))
- {
copydone = true;
- }
firstload = false;
}
}
connect_string = (char *) malloc(connect_string_len);
if (!connect_string)
- {
return 0;
- }
connect_string[0] = '\0';
if (host)
{
return false;
}
else
- {
ECPGfinish(con);
- }
}
return true;
offset = obuf;
}
else
- {
offset = offsetarg;
- }
sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
prefix = pbuf;
free(typ->u.members);
}
else
- {
abort();
- }
}
free(typ);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.23 1998/03/30 17:39:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.24 1998/06/15 19:30:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
case '7':
c = DIGIT(c);
if (ISOCTAL(*s))
- {
c = (c << 3) + DIGIT(*s++);
- }
if (ISOCTAL(*s))
- {
c = (c << 3) + DIGIT(*s++);
- }
*p = c;
break;
case 'b':
* the caller.
*/
if (isArray)
- {
return p + 1;
- }
else
- {
*p = c;
- }
break;
case '\0':
/* Shift the rest of the buffer over itself after the current char */
q = p + 1;
for (; *s;)
- {
*q++ = *s++;
- }
*q = '\0';
#ifdef TCL_ARRAYS_DEBUG_ESCAPE
printf(" after = '%s'\n", p);
char *p;
if (!value)
- {
return ((char *) NULL);
- }
#ifdef TCL_ARRAYS_DEBUG
printf("pq_value = '%s'\n", value);
}
}
if (!*p)
- {
break;
- }
}
}
else
p = translate_escape(p, 0);
}
if (!*p)
- {
break;
- }
}
}
#ifdef TCL_ARRAYS_DEBUG
Tcl_SetVar2(interp, argv[3], ".tupno", buffer, 0);
for (column = 0; column < ncols; column++)
- {
Tcl_SetVar2(interp, argv[3], info[column].cname, PQgetvalue(result, tupno, column), 0);
- }
Tcl_SetVar2(interp, argv[3], ".command", "update", 0);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.16 1998/03/22 04:18:17 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.17 1998/06/15 19:30:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
strcpy(servbuf, PG_KRB_SRVNAM);
*(hostp = servbuf + (sizeof(PG_KRB_SRVNAM) - 1)) = '/';
if (hostname || *hostname)
- {
strncpy(++hostp, hostname, MAXHOSTNAMELEN);
- }
else
{
if (gethostname(++hostp, MAXHOSTNAMELEN) < 0)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.66 1998/05/06 23:51:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.67 1998/06/15 19:30:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
conn->pgoptions = strdup(pgoptions);
if (login)
- {
conn->pguser = strdup(login);
- }
else if ((tmp = getenv("PGUSER")) != NULL)
- {
conn->pguser = strdup(tmp);
- }
else
- {
conn->pguser = fe_getauthname(conn->errorMessage);
- }
if (conn->pguser == NULL)
{
}
if (pwd)
- {
conn->pgpass = strdup(pwd);
- }
else if ((tmp = getenv("PGPASSWORD")) != NULL)
- {
conn->pgpass = strdup(tmp);
- }
else
- {
conn->pgpass = strdup(DefaultPassword);
- }
if ((dbName == NULL) || dbName[0] == '\0')
{
len = sizeof(struct sockaddr_in);
}
else
- {
len = UNIXSOCK_PATH(conn->raddr.un, portno);
- }
/* Connect to the server */
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
PQfinish(PGconn *conn)
{
if (!conn)
- {
fprintf(stderr, "PQfinish() -- pointer to PGconn is null\n");
- }
else
{
closePGconn(conn);
PQreset(PGconn *conn)
{
if (!conn)
- {
fprintf(stderr, "PQreset() -- pointer to PGconn is null\n");
- }
else
{
closePGconn(conn);
while (*cp)
{
if (*cp == '=')
- {
break;
- }
if (isspace(*cp))
{
*cp++ = '\0';
while (*cp)
{
if (!isspace(*cp))
- {
break;
- }
cp++;
}
break;
while (*cp)
{
if (!isspace(*cp))
- {
break;
- }
cp++;
}
{
cp++;
if (*cp != '\0')
- {
*cp2++ = *cp++;
- }
}
else
- {
*cp2++ = *cp++;
- }
}
*cp2 = '\0';
}
{
cp++;
if (*cp != '\0')
- {
*cp2++ = *cp++;
- }
continue;
}
if (*cp == '\'')
for (option = PQconninfoOptions; option->keyword != NULL; option++)
{
if (!strcmp(option->keyword, pname))
- {
break;
- }
}
if (option->keyword == NULL)
{
{
tmp = fe_getauthname(errortmp);
if (tmp)
- {
option->val = strdup(tmp);
- }
}
/* ----------
{
tmp = conninfo_getval("user");
if (tmp)
- {
option->val = strdup(tmp);
- }
}
}
for (option = PQconninfoOptions; option->keyword != NULL; option++)
{
if (!strcmp(option->keyword, keyword))
- {
return option->val;
- }
}
return NULL;
{
if (conn == NULL ||
conn->status == CONNECTION_BAD)
- {
return;
- }
PQuntrace(conn);
conn->Pfdebug = debug_port;
}
{
/* note: better allow untrace even when connection bad */
if (conn == NULL)
- {
return;
- }
if (conn->Pfdebug)
{
fflush(conn->Pfdebug);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.52 1998/05/14 17:18:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.53 1998/06/15 19:30:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Note that we will NOT block waiting for more input.
*/
if (pqReadData(conn) < 0)
- {
strcpy(conn->asyncErrorMessage, conn->errorMessage);
- }
/* Parsing of the data waits till later. */
}
if (pqGetInt(&vlen, 4, conn))
return EOF;
if (binary == 0)
- {
vlen = vlen - 4;
- }
if (vlen < 0)
vlen = 0;
if (tup[i].value == NULL)
PQputline(PGconn *conn, const char *s)
{
if (conn && conn->sock >= 0)
- {
(void) pqPutnchar(s, strlen(s), conn);
- }
}
/*
return NULL;
}
if (res->attDescs)
- {
return res->attDescs[field_num].name;
- }
else
return NULL;
}
return InvalidOid;
}
if (res->attDescs)
- {
return res->attDescs[field_num].adtid;
- }
else
return InvalidOid;
}
return 0;
}
if (res->attDescs)
- {
return res->attDescs[field_num].adtsize;
- }
else
return 0;
}
return 0;
}
if (res->attDescs)
- {
return res->attDescs[field_num].adtmod;
- }
else
return 0;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.12 1998/05/12 21:44:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.13 1998/06/15 19:30:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
res = PQfn(conn, conn->lobjfuncs->fn_lo_open, &fd, &result_len, 1, argv, 2);
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
argv[0].isint = 1;
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
argv[0].isint = 1;
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
if (len <= 0)
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
argv[0].isint = 1;
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
argv[0].isint = 1;
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
argv[0].isint = 1;
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
{
if (lo_initialize(conn) < 0)
- {
return -1;
- }
}
argv[0].isint = 1;
fname = PQgetvalue(res, n, 0);
foid = (Oid) atoi(PQgetvalue(res, n, 1));
if (!strcmp(fname, "lo_open"))
- {
lobjfuncs->fn_lo_open = foid;
- }
else if (!strcmp(fname, "lo_close"))
- {
lobjfuncs->fn_lo_close = foid;
- }
else if (!strcmp(fname, "lo_creat"))
- {
lobjfuncs->fn_lo_creat = foid;
- }
else if (!strcmp(fname, "lo_unlink"))
- {
lobjfuncs->fn_lo_unlink = foid;
- }
else if (!strcmp(fname, "lo_lseek"))
- {
lobjfuncs->fn_lo_lseek = foid;
- }
else if (!strcmp(fname, "lo_tell"))
- {
lobjfuncs->fn_lo_tell = foid;
- }
else if (!strcmp(fname, "loread"))
- {
lobjfuncs->fn_lo_read = foid;
- }
else if (!strcmp(fname, "lowrite"))
- {
lobjfuncs->fn_lo_write = foid;
- }
}
PQclear(res);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.14 1998/05/12 15:42:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.15 1998/06/15 19:30:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
conn->inStart = 0;
}
else
- {
conn->inStart = conn->inCursor = conn->inEnd = 0;
- }
/* If the buffer is fairly full, enlarge it.
* We need to be able to enlarge the buffer in case a single message
* exceeds the initial buffer size. We enlarge before filling the
* didn't really belong there.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.2 1998/05/07 16:17:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.3 1998/06/15 19:30:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Zero the initial field lengths */
for (j = 0; j < nFields; j++)
- {
fLength[j] = strlen(PQfname(res, j));
- }
/* Find the max length of each field in the result */
/* will be somewhat time consuming for very large results */
if (fillAlign)
nTups = PQntuples(res);
if (colWidth > 0)
- {
sprintf(formatString, "%%s %%-%ds", colWidth);
- }
else
sprintf(formatString, "%%s %%s");
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.5 1997/09/08 02:40:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.6 1998/06/15 19:30:26 momjian Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
if (signo != SIGALRM)
- {
act.sa_flags |= SA_RESTART;
- }
if (sigaction(signo, &act, &oact) < 0)
return (SIG_ERR);
return (oact.sa_handler);
* procedural language (PL)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.2 1998/02/26 04:46:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.3 1998/06/15 19:30:27 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
* Try to load the unknown procedure from pltcl_modules
************************************************************/
if (SPI_connect() != SPI_OK_CONNECT)
- {
elog(ERROR, "pltcl_init_safe_interp(): SPI_connect failed");
- }
pltcl_init_load_unknown();
if (SPI_finish() != SPI_OK_FINISH)
- {
elog(ERROR, "pltcl_init_safe_interp(): SPI_finish failed");
- }
#endif /* PLTCL_UNKNOWN_SUPPORT */
}
spi_rc = SPI_exec("select 1 from pg_class "
"where relname = 'pltcl_modules'", 1);
if (spi_rc != SPI_OK_SELECT)
- {
elog(ERROR, "pltcl_init_load_unknown(): select from pg_class failed");
- }
if (SPI_processed == 0)
- {
return;
- }
/************************************************************
* Read all the row's from it where modname = 'unknown' in
* Initialize interpreters on first call
************************************************************/
if (pltcl_firstcall)
- {
pltcl_init_all();
- }
/************************************************************
* Connect to SPI manager
************************************************************/
if (SPI_connect() != SPI_OK_CONNECT)
- {
elog(ERROR, "pltcl: cannot connect to SPI manager");
- }
/************************************************************
* Keep track about the nesting of Tcl-SPI-Tcl-... calls
************************************************************/
* call appropriate subhandler
************************************************************/
if (CurrentTriggerData == NULL)
- {
retval = pltcl_func_handler(proinfo, proargs, isNull);
- }
else
- {
retval = (Datum) pltcl_trigger_handler(proinfo);
- }
pltcl_call_level--;
* Disconnect from SPI manager
************************************************************/
if (SPI_finish() != SPI_OK_FINISH)
- {
elog(ERROR, "pltcl: SPI_finish() failed");
- }
return retval;
}
{
prodesc->arg_is_rel[i] = 1;
if (i > 0)
- {
strcat(proc_internal_args, " ");
- }
sprintf(buf, "__PLTcl_Tup_%d", i + 1);
strcat(proc_internal_args, buf);
continue;
}
else
- {
prodesc->arg_is_rel[i] = 0;
- }
fmgr_info(typeStruct->typoutput, &(prodesc->arg_out_func[i]));
prodesc->arg_out_elem[i] = (Oid) (typeStruct->typelem);
prodesc->arg_out_len[i] = typeStruct->typlen;
if (i > 0)
- {
strcat(proc_internal_args, " ");
- }
sprintf(buf, "%d", i + 1);
strcat(proc_internal_args, buf);
}
Tcl_DStringFree(&list_tmp);
pltcl_restart_in_progress = 1;
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
siglongjmp(Warn_restart, 1);
}
{
pltcl_restart_in_progress = 1;
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
}
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
siglongjmp(Warn_restart, 1);
}
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
pltcl_restart_in_progress = 1;
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
siglongjmp(Warn_restart, 1);
}
Tcl_DStringFree(&tcl_newtup);
pltcl_restart_in_progress = 1;
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
siglongjmp(Warn_restart, 1);
}
/* A list of attribute names for argument TG_relatts */
Tcl_DStringAppendElement(&tcl_trigtup, "");
for (i = 0; i < tupdesc->natts; i++)
- {
Tcl_DStringAppendElement(&tcl_trigtup, tupdesc->attrs[i]->attname.data);
- }
Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
Tcl_DStringFree(&tcl_trigtup);
Tcl_DStringInit(&tcl_trigtup);
/* The when part of the event for TG_when */
if (TRIGGER_FIRED_BEFORE(trigdata->tg_event))
- {
Tcl_DStringAppendElement(&tcl_cmd, "BEFORE");
- }
else if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
- {
Tcl_DStringAppendElement(&tcl_cmd, "AFTER");
- }
else
- {
Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
- }
/* The level part of the event for TG_level */
if (TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
- {
Tcl_DStringAppendElement(&tcl_cmd, "ROW");
- }
else if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
- {
Tcl_DStringAppendElement(&tcl_cmd, "STATEMENT");
- }
else
- {
Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
- }
/* Build the data list for the trigtuple */
pltcl_build_tuple_argument(trigdata->tg_trigtuple,
* Finally append the arguments from CREATE TRIGGER
************************************************************/
for (i = 0; i < trigdata->tg_trigger->tgnargs; i++)
- {
Tcl_DStringAppendElement(&tcl_cmd, trigdata->tg_trigger->tgargs[i]);
- }
/************************************************************
* Call the Tcl function
{
pltcl_restart_in_progress = 1;
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
}
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
siglongjmp(Warn_restart, 1);
}
* the magic strings OK or SKIP or a list from array get
************************************************************/
if (strcmp(pltcl_safe_interp->result, "OK") == 0)
- {
return rettup;
- }
if (strcmp(pltcl_safe_interp->result, "SKIP") == 0)
{
return (HeapTuple) NULL;;
ckfree(ret_values);
pltcl_restart_in_progress = 1;
if (--pltcl_call_level == 0)
- {
pltcl_restart_in_progress = 0;
- }
siglongjmp(Warn_restart, 1);
}
************************************************************/
attnum = SPI_fnumber(tupdesc, ret_values[i++]);
if (attnum == SPI_ERROR_NOATTRIBUTE)
- {
elog(ERROR, "pltcl: invalid attribute '%s'", ret_values[--i]);
- }
/************************************************************
* Lookup the attribute type in the syscache
pfree(modnulls);
if (rettup == NULL)
- {
elog(ERROR, "pltcl: SPI_modifytuple() failed - RC = %d\n", SPI_result);
- }
ckfree(ret_values);
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
}
if (strcmp(argv[1], "NOTICE") == 0)
- {
level = NOTICE;
- }
else if (strcmp(argv[1], "WARN") == 0)
- {
level = ERROR;
- }
else if (strcmp(argv[1], "ERROR") == 0)
- {
level = ERROR;
- }
else if (strcmp(argv[1], "FATAL") == 0)
- {
level = FATAL;
- }
else if (strcmp(argv[1], "DEBUG") == 0)
- {
level = DEBUG;
- }
else if (strcmp(argv[1], "NOIND") == 0)
- {
level = NOIND;
- }
else
{
Tcl_AppendResult(interp, "Unknown elog level '", argv[1],
while (*cp1)
{
if (*cp1 == '\'')
- {
*cp2++ = '\'';
- }
else
{
if (*cp1 == '\\')
- {
*cp2++ = '\\';
- }
}
*cp2++ = *cp1++;
}
return TCL_ERROR;
}
if (Tcl_GetInt(interp, argv[i++], &count) != TCL_OK)
- {
return TCL_ERROR;
- }
continue;
}
if (argc == query_idx + 1)
{
if (ntuples > 0)
- {
pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
- }
sprintf(buf, "%d", ntuples);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
* Split the argument type list
************************************************************/
if (Tcl_SplitList(interp, argv[2], &nargs, &args) != TCL_OK)
- {
return TCL_ERROR;
- }
/************************************************************
* Allocate the new querydesc structure
PointerGetDatum(args[i]),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
- {
elog(ERROR, "pltcl: Cache lookup of type %s failed", args[i]);
- }
qdesc->argtypes[i] = typeTup->t_oid;
fmgr_info(((TypeTupleForm) GETSTRUCT(typeTup))->typinput,
&(qdesc->arginfuncs[i]));
return TCL_ERROR;
}
if (Tcl_GetInt(interp, argv[i++], &count) != TCL_OK)
- {
return TCL_ERROR;
- }
continue;
}
* Split the argument values
************************************************************/
if (Tcl_SplitList(interp, argv[i++], &callnargs, &callargs) != TCL_OK)
- {
return TCL_ERROR;
- }
/************************************************************
* Check that the # of arguments matches
callargs = NULL;
}
else
- {
callnargs = 0;
- }
/************************************************************
* Remember the index of the last processed call
if (loop_body >= argc)
{
if (ntuples > 0)
- {
pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
- }
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
sprintf(buf, "%d", ntuples);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
pfree(outputstr);
}
else
- {
Tcl_UnsetVar2(interp, *arrptr, *nameptr, 0);
- }
}
}
/* first, print out the attribute names */
nFields = PQnfields(res);
for (i = 0; i < nFields; i++)
- {
printf("%-15s", PQfname(res, i));
- }
printf("\n\n");
/* next, print out the instances */
for (i = 0; i < PQntuples(res); i++)
{
for (j = 0; j < nFields; j++)
- {
printf("%-15s", PQgetvalue(res, i, j));
- }
printf("\n");
}
/* first, print out the attribute names */
nFields = PQnfields(res1);
for (i = 0; i < nFields; i++)
- {
printf("%-15s", PQfname(res1, i));
- }
printf("\n\n");
/* next, print out the instances */
for (i = 0; i < PQntuples(res1); i++)
{
for (j = 0; j < nFields; j++)
- {
printf("%-15s", PQgetvalue(res1, i, j));
- }
printf("\n");
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.8 1998/05/12 21:44:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.9 1998/06/15 19:30:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
lobjId = lo_creat(conn, INV_READ | INV_WRITE);
if (lobjId == 0)
- {
fprintf(stderr, "can't create large object");
- }
lobj_fd = lo_open(conn, lobjId, INV_WRITE);
{
tmp = lo_write(conn, lobj_fd, buf, nbytes);
if (tmp < nbytes)
- {
fprintf(stderr, "error while reading \"%s\"", filename);
- }
}
close(fd);
/* lobjOid = importFile(conn, in_filename); */
lobjOid = lo_import(conn, in_filename);
if (lobjOid == 0)
- {
fprintf(stderr, "%s\n", PQerrorMessage(conn));
- }
/*
printf("\tas large object %d.\n", lobjOid);
printf("exporting large object to file \"%s\" ...\n", out_filename);
/* exportFile(conn, lobjOid, out_filename); */
if (!lo_export(conn, lobjOid, out_filename))
- {
fprintf(stderr, "%s\n", PQerrorMessage(conn));
- }
res = PQexec(conn, "end");
PQclear(res);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/test/examples/Attic/testlo2.c,v 1.7 1998/05/12 21:44:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/test/examples/Attic/testlo2.c,v 1.8 1998/06/15 19:30:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
lobjId = lo_creat(conn, INV_READ | INV_WRITE);
if (lobjId == 0)
- {
fprintf(stderr, "can't create large object");
- }
lobj_fd = lo_open(conn, lobjId, INV_WRITE);
{
tmp = lo_write(conn, lobj_fd, buf, nbytes);
if (tmp < nbytes)
- {
fprintf(stderr, "error while reading \"%s\"", filename);
- }
}
close(fd);