aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-10-02 22:24:54 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-10-02 22:24:54 +0000
commitbea8af915253a56cb7536e30ce72e88968f3b6cb (patch)
treedc4ce591d990ccb1bfc4cf9d4ec02b6567a8c3e7 /src/backend/utils/adt/ruleutils.c
parentb4966453f6213f65777ab289c996b319a63bbc70 (diff)
downloadpostgresql-bea8af915253a56cb7536e30ce72e88968f3b6cb.tar.gz
postgresql-bea8af915253a56cb7536e30ce72e88968f3b6cb.zip
When dumping CREATE INDEX, must show opclass name if the opclass isn't
in the schema search path. Otherwise pg_dump doesn't correctly dump scenarios where a custom opclass is created in 'public' and then used by indexes in other schemas.
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index ccf05a14e3c..0b13dcd0353 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.155 2003/09/29 18:55:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.156 2003/10/02 22:24:54 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -4030,6 +4030,7 @@ get_opclass_name(Oid opclass, Oid actual_datatype,
Form_pg_opclass opcrec;
char *opcname;
char *nspname;
+ bool isvisible;
/* Domains use their base type's default opclass */
if (OidIsValid(actual_datatype))
@@ -4049,12 +4050,16 @@ get_opclass_name(Oid opclass, Oid actual_datatype,
OidIsValid(get_element_type(actual_datatype)))
actual_datatype = opcrec->opcintype;
}
+
+ /* Must force use of opclass name if not in search path */
+ isvisible = OpclassIsVisible(opclass);
- if (actual_datatype != opcrec->opcintype || !opcrec->opcdefault)
+ if (actual_datatype != opcrec->opcintype || !opcrec->opcdefault ||
+ !isvisible)
{
/* Okay, we need the opclass name. Do we need to qualify it? */
opcname = NameStr(opcrec->opcname);
- if (OpclassIsVisible(opclass))
+ if (isvisible)
appendStringInfo(buf, " %s", quote_identifier(opcname));
else
{