It turns out that the relcache thinks it can distinguish different

rules and triggers by OID.  So, even though we have no cross-references
in the system catalogs to pg_rewrite.oid or pg_trigger.oid, we'd better
have unique indexes on them.  Put back pg_rewrite_oid_index, which I
mistakenly removed a few days ago, and add pg_trigger_oid_index.
This commit is contained in:
Tom Lane 2001-06-16 18:59:31 +00:00
parent 2adf1ce63c
commit 668db147d5
3 changed files with 12 additions and 8 deletions

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.78 2001/06/12 05:55:49 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.79 2001/06/16 18:59:31 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -66,13 +66,13 @@ char *Name_pg_proc_indices[Num_pg_proc_indices] =
char *Name_pg_relcheck_indices[Num_pg_relcheck_indices] = char *Name_pg_relcheck_indices[Num_pg_relcheck_indices] =
{RelCheckIndex}; {RelCheckIndex};
char *Name_pg_rewrite_indices[Num_pg_rewrite_indices] = char *Name_pg_rewrite_indices[Num_pg_rewrite_indices] =
{RewriteRulenameIndex}; {RewriteOidIndex, RewriteRulenameIndex};
char *Name_pg_shadow_indices[Num_pg_shadow_indices] = char *Name_pg_shadow_indices[Num_pg_shadow_indices] =
{ShadowNameIndex, ShadowSysidIndex}; {ShadowNameIndex, ShadowSysidIndex};
char *Name_pg_statistic_indices[Num_pg_statistic_indices] = char *Name_pg_statistic_indices[Num_pg_statistic_indices] =
{StatisticRelidAttnumIndex}; {StatisticRelidAttnumIndex};
char *Name_pg_trigger_indices[Num_pg_trigger_indices] = char *Name_pg_trigger_indices[Num_pg_trigger_indices] =
{TriggerRelidIndex, TriggerConstrNameIndex, TriggerConstrRelidIndex}; {TriggerRelidIndex, TriggerConstrNameIndex, TriggerConstrRelidIndex, TriggerOidIndex};
char *Name_pg_type_indices[Num_pg_type_indices] = char *Name_pg_type_indices[Num_pg_type_indices] =
{TypeNameIndex, TypeOidIndex}; {TypeNameIndex, TypeOidIndex};
char *Name_pg_description_indices[Num_pg_description_indices] = char *Name_pg_description_indices[Num_pg_description_indices] =

View File

@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: catversion.h,v 1.82 2001/06/12 05:55:50 tgl Exp $ * $Id: catversion.h,v 1.83 2001/06/16 18:59:31 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200106111 #define CATALOG_VERSION_NO 200106161
#endif #endif

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: indexing.h,v 1.50 2001/06/12 05:55:50 tgl Exp $ * $Id: indexing.h,v 1.51 2001/06/16 18:59:31 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -38,10 +38,10 @@
#define Num_pg_operator_indices 2 #define Num_pg_operator_indices 2
#define Num_pg_proc_indices 2 #define Num_pg_proc_indices 2
#define Num_pg_relcheck_indices 1 #define Num_pg_relcheck_indices 1
#define Num_pg_rewrite_indices 1 #define Num_pg_rewrite_indices 2
#define Num_pg_shadow_indices 2 #define Num_pg_shadow_indices 2
#define Num_pg_statistic_indices 1 #define Num_pg_statistic_indices 1
#define Num_pg_trigger_indices 3 #define Num_pg_trigger_indices 4
#define Num_pg_type_indices 2 #define Num_pg_type_indices 2
/* /*
@ -77,6 +77,7 @@
#define ProcedureNameIndex "pg_proc_proname_narg_type_index" #define ProcedureNameIndex "pg_proc_proname_narg_type_index"
#define ProcedureOidIndex "pg_proc_oid_index" #define ProcedureOidIndex "pg_proc_oid_index"
#define RelCheckIndex "pg_relcheck_rcrelid_index" #define RelCheckIndex "pg_relcheck_rcrelid_index"
#define RewriteOidIndex "pg_rewrite_oid_index"
#define RewriteRulenameIndex "pg_rewrite_rulename_index" #define RewriteRulenameIndex "pg_rewrite_rulename_index"
#define ShadowNameIndex "pg_shadow_usename_index" #define ShadowNameIndex "pg_shadow_usename_index"
#define ShadowSysidIndex "pg_shadow_usesysid_index" #define ShadowSysidIndex "pg_shadow_usesysid_index"
@ -84,6 +85,7 @@
#define TriggerConstrNameIndex "pg_trigger_tgconstrname_index" #define TriggerConstrNameIndex "pg_trigger_tgconstrname_index"
#define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index" #define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index"
#define TriggerRelidIndex "pg_trigger_tgrelid_index" #define TriggerRelidIndex "pg_trigger_tgrelid_index"
#define TriggerOidIndex "pg_trigger_oid_index"
#define TypeNameIndex "pg_type_typname_index" #define TypeNameIndex "pg_type_typname_index"
#define TypeOidIndex "pg_type_oid_index" #define TypeOidIndex "pg_type_oid_index"
@ -181,6 +183,7 @@ DECLARE_UNIQUE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oidvector_ops)); DECLARE_UNIQUE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oidvector_ops));
/* This following index is not used for a cache and is not unique */ /* This following index is not used for a cache and is not unique */
DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops)); DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops));
DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index on pg_rewrite using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_rewrite_rulename_index on pg_rewrite using btree(rulename name_ops)); DECLARE_UNIQUE_INDEX(pg_rewrite_rulename_index on pg_rewrite using btree(rulename name_ops));
DECLARE_UNIQUE_INDEX(pg_shadow_usename_index on pg_shadow using btree(usename name_ops)); DECLARE_UNIQUE_INDEX(pg_shadow_usename_index on pg_shadow using btree(usename name_ops));
DECLARE_UNIQUE_INDEX(pg_shadow_usesysid_index on pg_shadow using btree(usesysid int4_ops)); DECLARE_UNIQUE_INDEX(pg_shadow_usesysid_index on pg_shadow using btree(usesysid int4_ops));
@ -188,6 +191,7 @@ DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_index on pg_statistic using btree(st
DECLARE_INDEX(pg_trigger_tgconstrname_index on pg_trigger using btree(tgconstrname name_ops)); DECLARE_INDEX(pg_trigger_tgconstrname_index on pg_trigger using btree(tgconstrname name_ops));
DECLARE_INDEX(pg_trigger_tgconstrrelid_index on pg_trigger using btree(tgconstrrelid oid_ops)); DECLARE_INDEX(pg_trigger_tgconstrrelid_index on pg_trigger using btree(tgconstrrelid oid_ops));
DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops)); DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops));
DECLARE_UNIQUE_INDEX(pg_trigger_oid_index on pg_trigger using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops)); DECLARE_UNIQUE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops)); DECLARE_UNIQUE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops));