hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key,
HASH_ENTER, &found);
- if (!hentry)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
-
if (found)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
snprintf(key, MAX_CATNAME_LEN - 1, "%s", CATDESC->catname); \
hentry = (crosstab_HashEnt*) hash_search(crosstab_HashTable, \
key, HASH_ENTER, &found); \
- if (hentry == NULL) \
- ereport(ERROR, \
- (errcode(ERRCODE_OUT_OF_MEMORY), \
- errmsg("out of memory"))); \
if (found) \
ereport(ERROR, \
(errcode(ERRCODE_DUPLICATE_OBJECT), \
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.36 2005/01/10 20:02:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.37 2005/05/29 04:23:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
hentry = (XLogRelCacheEntry *)
hash_search(_xlrelcache, (void *) &rnode, HASH_ENTER, &found);
- if (hentry == NULL)
- elog(PANIC, "XLogOpenRelation: out of memory for cache");
-
if (found)
elog(PANIC, "XLogOpenRelation: file found on insert into cache");
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.37 2005/05/24 04:18:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.38 2005/05/29 04:23:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
HASH_ENTER,
&found);
- /* Shouldn't get a failure, nor a duplicate entry */
- if (!entry || found)
- elog(ERROR, "could not store prepared statement \"%s\"",
+ /* Shouldn't get a duplicate entry */
+ if (found)
+ elog(ERROR, "duplicate prepared statement \"%s\"",
stmt_name);
/* Fill in the hash table entry with copied data */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.14 2005/03/16 21:38:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.15 2005/05/29 04:23:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
- /* created new entry ... we hope */
- if (entry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
-
/*
+ * created new entry
+ *
* Zero any caller-requested space in the entry. (This zaps
* the "key data" dynahash.c copied into the new entry, but we
* don't care since we're about to overwrite it anyway.)
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.3 2005/05/17 00:43:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.4 2005/05/29 04:23:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
page = (PagetableEntry *) hash_search(tbm->pagetable,
(void *) &tbm->entry1.blockno,
HASH_ENTER, &found);
- if (page == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
Assert(!found);
memcpy(page, &tbm->entry1, sizeof(PagetableEntry));
}
page = (PagetableEntry *) hash_search(tbm->pagetable,
(void *) &pageno,
HASH_ENTER, &found);
- if (page == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
}
/* Initialize it if not present before */
page = (PagetableEntry *) hash_search(tbm->pagetable,
(void *) &chunk_pageno,
HASH_ENTER, &found);
- if (page == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
/* Initialize it if not present before */
if (!found)
*
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.94 2005/05/11 01:41:40 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.95 2005/05/29 04:23:03 tgl Exp $
* ----------
*/
#include "postgres.h"
result = (PgStat_StatDBEntry *) hash_search(pgStatDBHash,
&databaseid,
HASH_ENTER, &found);
- if (result == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory in statistics collector --- abort")));
/* If not found, initialize the new one. */
if (!found)
(void *) &procpid,
HASH_ENTER,
&found);
- if (deadbe == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory in statistics collector --- abort")));
if (!found)
{
(void *) &dbbuf.databaseid,
HASH_ENTER,
&found);
- if (dbentry == NULL)
- {
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
- }
if (found)
{
ereport(pgStatRunningInCollector ? LOG : WARNING,
tabentry = (PgStat_StatTabEntry *) hash_search(tabhash,
(void *) &tabbuf.tableid,
HASH_ENTER, &found);
- if (tabentry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
if (found)
{
tabentry = (PgStat_StatTabEntry *) hash_search(dbentry->tables,
(void *) &(tabmsg[i].t_id),
HASH_ENTER, &found);
- if (tabentry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory in statistics collector --- abort")));
if (!found)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/buf_table.c,v 1.40 2005/03/04 20:21:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/buf_table.c,v 1.41 2005/05/29 04:23:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
result = (BufferLookupEnt *)
hash_search(SharedBufHash, (void *) tagPtr, HASH_ENTER, &found);
- if (!result)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of shared memory")));
-
if (found) /* found something already in the table */
return result->id;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.66 2005/03/19 23:27:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.67 2005/05/29 04:23:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &newTag, HASH_ENTER, &found);
- if (!hresult)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
if (found) /* shouldn't happen */
elog(ERROR, "local buffer hash table corrupted");
hresult->id = b;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.44 2005/04/24 03:51:49 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.45 2005/05/29 04:23:04 tgl Exp $
*
*
* NOTES:
(void *) rel,
HASH_ENTER,
&found);
- if (!fsmrel)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of shared memory")));
if (!found)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.83 2005/04/04 04:34:41 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.84 2005/05/29 04:23:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
result = (ShmemIndexEnt *)
hash_search(ShmemIndex, (void *) &item, HASH_ENTER, &found);
- if (!result)
- ereport(FATAL,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of shared memory")));
Assert(!found);
/* look it up in the shmem index */
result = (ShmemIndexEnt *)
- hash_search(ShmemIndex, (void *) &item, HASH_ENTER, foundPtr);
+ hash_search(ShmemIndex, (void *) &item, HASH_ENTER_NULL, foundPtr);
if (!result)
{
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory")));
- return NULL;
}
if (*foundPtr)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.152 2005/05/19 23:30:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.153 2005/05/29 04:23:04 tgl Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
locallock = (LOCALLOCK *) hash_search(LockMethodLocalHash[lockmethodid],
(void *) &localtag,
HASH_ENTER, &found);
- if (!locallock)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
/*
* if it's a new locallock object, initialize it
*/
lock = (LOCK *) hash_search(LockMethodLockHash[lockmethodid],
(void *) locktag,
- HASH_ENTER, &found);
+ HASH_ENTER_NULL, &found);
if (!lock)
{
LWLockRelease(masterLock);
*/
proclock = (PROCLOCK *) hash_search(LockMethodProcLockHash[lockmethodid],
(void *) &proclocktag,
- HASH_ENTER, &found);
+ HASH_ENTER_NULL, &found);
if (!proclock)
{
/* Ooops, not enough shmem for the proclock */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.114 2004/12/31 22:01:13 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.115 2005/05/29 04:23:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
entry.rnode = reln->smgr_rnode;
entry.segno = seg->mdfd_segno;
- if (hash_search(pendingOpsTable, &entry, HASH_ENTER, NULL) != NULL)
- return true;
- /* out of memory: fall through to do it locally */
+ (void) hash_search(pendingOpsTable, &entry, HASH_ENTER, NULL);
+ return true;
}
else
{
entry.rnode = rnode;
entry.segno = segno;
- if (hash_search(pendingOpsTable, &entry, HASH_ENTER, NULL) == NULL)
- ereport(FATAL,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
+ (void) hash_search(pendingOpsTable, &entry, HASH_ENTER, NULL);
}
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.86 2005/03/20 22:00:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.87 2005/05/29 04:23:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
reln = (SMgrRelation) hash_search(SMgrRelationHash,
(void *) &rnode,
HASH_ENTER, &found);
- if (reln == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
/* Initialize it if not present before */
if (!found)
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.77 2005/04/28 21:47:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.78 2005/05/29 04:23:05 tgl Exp $
*
* ----------
*/
entry = (RI_QueryHashEntry *) hash_search(ri_query_cache,
(void *) key,
HASH_ENTER, &found);
- if (entry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
entry->plan = plan;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.224 2005/05/27 23:31:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.225 2005/05/29 04:23:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
(void *) &(RELATION->rd_id), \
HASH_ENTER, \
&found); \
- if (idhentry == NULL) \
- ereport(ERROR, \
- (errcode(ERRCODE_OUT_OF_MEMORY), \
- errmsg("out of memory"))); \
/* used to give notice if found -- now just keep quiet */ \
idhentry->reldesc = RELATION; \
} while(0)
opcentry = (OpClassCacheEnt *) hash_search(OpClassCache,
(void *) &operatorClassOid,
HASH_ENTER, &found);
- if (opcentry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
if (found && opcentry->valid)
{
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.13 2005/04/14 20:32:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.14 2005/05/29 04:23:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
typentry = (TypeCacheEntry *) hash_search(TypeCacheHash,
(void *) &type_id,
HASH_ENTER, &found);
- if (typentry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
Assert(!found); /* it wasn't there a moment ago */
MemSet(typentry, 0, sizeof(TypeCacheEntry));
recentry = (RecordCacheEntry *) hash_search(RecordCacheHash,
(void *) hashkey,
HASH_ENTER, &found);
- if (recentry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
if (!found)
{
/* New entry ... hash_search initialized only the hash key */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.94 2005/04/14 20:32:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.95 2005/05/29 04:23:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
&fn_oid,
HASH_ENTER,
&found);
- if (entry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
/* OID is already filled in */
entry->fn_xmin = HeapTupleHeaderGetXmin(procedureTuple->t_data);
entry->fn_cmin = HeapTupleHeaderGetCmin(procedureTuple->t_data);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.60 2005/05/16 00:19:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.61 2005/05/29 04:23:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* action is one of:
* HASH_FIND: look up key in table
* HASH_ENTER: look up key in table, creating entry if not present
+ * HASH_ENTER_NULL: same, but return NULL if out of memory
* HASH_REMOVE: look up key in table, remove entry if present
- * HASH_FIND_SAVE: look up key in table, also save in static var
- * HASH_REMOVE_SAVED: remove entry saved by HASH_FIND_SAVE
*
* Return value is a pointer to the element found/entered/removed if any,
- * or NULL if no match was found. (NB: in the case of the REMOVE actions,
+ * or NULL if no match was found. (NB: in the case of the REMOVE action,
* the result is a dangling pointer that shouldn't be dereferenced!)
- * A NULL result for HASH_ENTER implies we ran out of memory.
+ *
+ * HASH_ENTER will normally ereport a generic "out of memory" error if
+ * it is unable to create a new entry. The HASH_ENTER_NULL operation is
+ * the same except it will return NULL if out of memory. Note that
+ * HASH_ENTER_NULL cannot be used with the default palloc-based allocator,
+ * since palloc internally ereports on out-of-memory.
*
* If foundPtr isn't NULL, then *foundPtr is set TRUE if we found an
* existing entry in the table, FALSE otherwise. This is needed in the
* HASH_ENTER case, but is redundant with the return value otherwise.
- *
- * The HASH_FIND_SAVE/HASH_REMOVE_SAVED interface is a hack to save one
- * table lookup in a find/process/remove scenario. Note that no other
- * addition or removal in the table can safely happen in between.
*----------
*/
void *
bool *foundPtr)
{
HASHHDR *hctl = hashp->hctl;
- uint32 hashvalue = 0;
+ Size keysize = hctl->keysize;
+ uint32 hashvalue;
uint32 bucket;
long segment_num;
long segment_ndx;
HASHSEGMENT segp;
HASHBUCKET currBucket;
HASHBUCKET *prevBucketPtr;
-
- static struct State
- {
- HASHBUCKET currBucket;
- HASHBUCKET *prevBucketPtr;
- } saveState;
+ HashCompareFunc match;
#if HASH_STATISTICS
hash_accesses++;
#endif
/*
- * Do the initial lookup (or recall result of prior lookup)
+ * Do the initial lookup
*/
- if (action == HASH_REMOVE_SAVED)
- {
- currBucket = saveState.currBucket;
- prevBucketPtr = saveState.prevBucketPtr;
+ hashvalue = hashp->hash(keyPtr, keysize);
+ bucket = calc_bucket(hctl, hashvalue);
- /*
- * Try to catch subsequent errors
- */
- Assert(currBucket);
- saveState.currBucket = NULL;
- }
- else
- {
- HashCompareFunc match;
- Size keysize = hctl->keysize;
+ segment_num = bucket >> hctl->sshift;
+ segment_ndx = MOD(bucket, hctl->ssize);
- hashvalue = hashp->hash(keyPtr, keysize);
- bucket = calc_bucket(hctl, hashvalue);
+ segp = hashp->dir[segment_num];
- segment_num = bucket >> hctl->sshift;
- segment_ndx = MOD(bucket, hctl->ssize);
+ if (segp == NULL)
+ hash_corrupted(hashp);
- segp = hashp->dir[segment_num];
+ prevBucketPtr = &segp[segment_ndx];
+ currBucket = *prevBucketPtr;
- if (segp == NULL)
- hash_corrupted(hashp);
+ /*
+ * Follow collision chain looking for matching key
+ */
+ match = hashp->match; /* save one fetch in inner loop */
- prevBucketPtr = &segp[segment_ndx];
+ while (currBucket != NULL)
+ {
+ if (currBucket->hashvalue == hashvalue &&
+ match(ELEMENTKEY(currBucket), keyPtr, keysize) == 0)
+ break;
+ prevBucketPtr = &(currBucket->link);
currBucket = *prevBucketPtr;
-
- /*
- * Follow collision chain looking for matching key
- */
- match = hashp->match; /* save one fetch in inner loop */
- while (currBucket != NULL)
- {
- if (currBucket->hashvalue == hashvalue &&
- match(ELEMENTKEY(currBucket), keyPtr, keysize) == 0)
- break;
- prevBucketPtr = &(currBucket->link);
- currBucket = *prevBucketPtr;
#if HASH_STATISTICS
- hash_collisions++;
- hctl->collisions++;
+ hash_collisions++;
+ hctl->collisions++;
#endif
- }
}
if (foundPtr)
return (void *) ELEMENTKEY(currBucket);
return NULL;
- case HASH_FIND_SAVE:
- if (currBucket != NULL)
- {
- saveState.currBucket = currBucket;
- saveState.prevBucketPtr = prevBucketPtr;
- return (void *) ELEMENTKEY(currBucket);
- }
- return NULL;
-
case HASH_REMOVE:
- case HASH_REMOVE_SAVED:
if (currBucket != NULL)
{
Assert(hctl->nentries > 0);
}
return NULL;
+ case HASH_ENTER_NULL:
+ /* ENTER_NULL does not work with palloc-based allocator */
+ Assert(hashp->alloc != DynaHashAlloc);
+ /* FALL THRU */
+
case HASH_ENTER:
/* Return existing element if found, else create one */
if (currBucket != NULL)
{
/* no free elements. allocate another chunk of buckets */
if (!element_alloc(hashp, HASHELEMENT_ALLOC_INCR))
- return NULL; /* out of memory */
+ {
+ /* out of memory */
+ if (action == HASH_ENTER_NULL)
+ return NULL;
+ /* report a generic message */
+ if (hashp->isshared)
+ ereport(ERROR,
+ (errcode(ERRCODE_OUT_OF_MEMORY),
+ errmsg("out of shared memory")));
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_OUT_OF_MEMORY),
+ errmsg("out of memory")));
+ }
currBucket = hctl->freeList;
Assert(currBucket != NULL);
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.79 2005/05/11 18:05:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.80 2005/05/29 04:23:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
StrNCpy(key, NAME, MAX_PORTALNAME_LEN); \
hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
key, HASH_ENTER, &found); \
- if (hentry == NULL) \
- ereport(ERROR, \
- (errcode(ERRCODE_OUT_OF_MEMORY), \
- errmsg("out of memory"))); \
if (found) \
elog(ERROR, "duplicate portal name"); \
hentry->portal = PORTAL; \
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/hsearch.h,v 1.35 2005/04/14 20:32:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/hsearch.h,v 1.36 2005/05/29 04:23:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
HASH_FIND,
HASH_ENTER,
HASH_REMOVE,
- HASH_FIND_SAVE,
- HASH_REMOVE_SAVED
+ HASH_ENTER_NULL
} HASHACTION;
/* hash_seq status (should be considered an opaque type by callers) */
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.89 2005/05/06 17:24:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.90 2005/05/29 04:23:06 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
(void *) func_key,
HASH_ENTER,
&found);
- if (hentry == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
if (found)
elog(WARNING, "trying to insert a function that already exists");
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.31 2005/05/23 21:54:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.32 2005/05/29 04:23:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* load and parse the TZ definition file every time it is selected.
*/
static HTAB *timezone_cache = NULL;
+
static bool
init_timezone_hashtable(void)
{
HASH_FIND,
NULL);
if (tzp)
+ {
/* Timezone found in cache, nothing more to do */
return tzp;
+ }
if (tzload(name, &tz.state) != 0)
{
if (name[0] == ':' || tzparse(name, &tz.state, FALSE) != 0)
+ {
/* Unknown timezone. Fail our call instead of loading GMT! */
return NULL;
+ }
}
strcpy(tz.TZname, name);
HASH_ENTER,
NULL);
- if (!tzp)
- return NULL;
-
strcpy(tzp->TZname, tz.TZname);
memcpy(&tzp->state, &tz.state, sizeof(tz.state));