*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.63 2000/06/07 02:44:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.64 2000/06/07 04:09:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char *Name_pg_language_indices[Num_pg_language_indices] =
{LanguageOidIndex, LanguageNameIndex};
char *Name_pg_listener_indices[Num_pg_listener_indices] =
-{ListenerRelnamePidIndex};
+{ListenerPidRelnameIndex};
char *Name_pg_opclass_indices[Num_pg_opclass_indices] =
{OpclassNameIndex, OpclassDeftypeIndex};
char *Name_pg_operator_indices[Num_pg_operator_indices] =
HeapTuple
-ListenerRelnamePidIndexScan(Relation heapRelation, char *relName, int4 pid)
+ListenerPidRelnameIndexScan(Relation heapRelation, int4 pid, char *relName)
{
Relation idesc;
ScanKeyData skey[2];
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
(AttrNumber) 1,
- (RegProcedure) F_NAMEEQ,
- PointerGetDatum(relName));
+ (RegProcedure) F_INT4EQ,
+ Int32GetDatum(pid));
ScanKeyEntryInitialize(&skey[1],
(bits16) 0x0,
(AttrNumber) 2,
- (RegProcedure) F_INT4EQ,
- Int32GetDatum(pid));
+ (RegProcedure) F_NAMEEQ,
+ PointerGetDatum(relName));
- idesc = index_openr(ListenerRelnamePidIndex);
+ idesc = index_openr(ListenerPidRelnameIndex);
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
index_close(idesc);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.63 2000/06/04 01:44:29 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.64 2000/06/07 04:09:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* no point in making duplicate entries in the list ... */
if (!AsyncExistsPendingNotify(relname))
{
-
/*
* We allocate list memory from the global malloc pool to ensure
* that it will live until we want to use it. This is probably
Datum d;
int i;
bool isnull;
- int alreadyListener = 0;
TupleDesc tupDesc;
if (Trace_notify)
tdesc = RelationGetDescr(lRel);
/* Detect whether we are already listening on this relname */
- scan = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey) NULL);
- while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
- {
- d = heap_getattr(tuple, Anum_pg_listener_relname, tdesc, &isnull);
- if (!strncmp((char *) DatumGetPointer(d), relname, NAMEDATALEN))
- {
- d = heap_getattr(tuple, Anum_pg_listener_pid, tdesc, &isnull);
- if (DatumGetInt32(d) == pid)
- {
- alreadyListener = 1;
- /* No need to scan the rest of the table */
- break;
- }
- }
- }
- heap_endscan(scan);
-
- if (alreadyListener)
+ tuple = SearchSysCacheTuple(LISTENREL, Int32GetDatum(pid),
+ PointerGetDatum(relname),
+ 0, 0);
+ if (tuple != NULL)
{
+ /* No need to scan the rest of the table */
heap_close(lRel, AccessExclusiveLock);
elog(NOTICE, "Async_Listen: We are already listening on %s", relname);
return;
lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
/* Note we assume there can be only one matching tuple. */
- lTuple = SearchSysCacheTuple(LISTENREL, PointerGetDatum(relname),
- Int32GetDatum(pid),
- 0, 0);
+ lTuple = SearchSysCacheTuple(LISTENREL, Int32GetDatum(pid),
+ PointerGetDatum(relname),
+ 0, 0);
if (lTuple != NULL)
heap_delete(lRel, &lTuple->t_self, NULL);
heap_close(lRel, AccessExclusiveLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.52 2000/06/07 02:44:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.53 2000/06/07 04:09:36 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
{ListenerRelationName, /* LISTENREL */
2,
{
- Anum_pg_listener_relname,
Anum_pg_listener_pid,
+ Anum_pg_listener_relname,
0,
0
},
sizeof(FormData_pg_listener),
- ListenerRelnamePidIndex,
- ListenerRelnamePidIndexScan},
+ ListenerPidRelnameIndex,
+ ListenerPidRelnameIndexScan},
{OperatorRelationName, /* OPERNAME */
4,
{
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.25 2000/06/07 03:02:08 momjian Exp $
+ * $Id: catversion.h,v 1.26 2000/06/07 04:09:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200006061
+#define CATALOG_VERSION_NO 200006071
#endif
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: indexing.h,v 1.38 2000/06/07 02:44:40 momjian Exp $
+ * $Id: indexing.h,v 1.39 2000/06/07 04:09:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define InheritsRelidSeqnoIndex "pg_inherits_relid_seqno_index"
#define LanguageNameIndex "pg_language_name_index"
#define LanguageOidIndex "pg_language_oid_index"
-#define ListenerRelnamePidIndex "pg_listener_relname_pid_index"
+#define ListenerPidRelnameIndex "pg_listener_pid_relname_index"
#define OpclassDeftypeIndex "pg_opclass_deftype_index"
#define OpclassNameIndex "pg_opclass_name_index"
#define OperatorNameIndex "pg_operator_oprname_l_r_k_index"
int4 seqno);
extern HeapTuple LanguageNameIndexScan(Relation heapRelation, char *lanName);
extern HeapTuple LanguageOidIndexScan(Relation heapRelation, Oid lanId);
-extern HeapTuple ListenerRelnamePidIndexScan(Relation heapRelation, char *relName, int4 pid);
+extern HeapTuple ListenerPidRelnameIndexScan(Relation heapRelation, int4 pid, char *relName);
extern HeapTuple OpclassDeftypeIndexScan(Relation heapRelation, Oid defType);
extern HeapTuple OpclassNameIndexScan(Relation heapRelation, char *opcName);
extern HeapTuple OperatorNameIndexScan(Relation heapRelation,
DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
DECLARE_UNIQUE_INDEX(pg_language_name_index on pg_language using btree(lanname name_ops));
DECLARE_UNIQUE_INDEX(pg_language_oid_index on pg_language using btree(oid oid_ops));
-DECLARE_UNIQUE_INDEX(pg_listener_relname_pid_index on pg_listener using btree(relname name_ops, listenerpid int4_ops));
+DECLARE_UNIQUE_INDEX(pg_listener_pid_relname_index on pg_listener using btree(listenerpid int4_ops, relname name_ops));
/* This column needs to allow multiple zero entries, but is in the cache */
DECLARE_INDEX(pg_opclass_deftype_index on pg_opclass using btree(opcdeftype oid_ops));
DECLARE_UNIQUE_INDEX(pg_opclass_name_index on pg_opclass using btree(opcname name_ops));