diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-10-02 22:25:08 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-10-02 22:25:08 +0000 |
| commit | f8ee74faebbfaabd254790964cbf64dcffef54a1 (patch) | |
| tree | 1c794e6c1117a186341edd406d50c1859570da1f /src/backend/utils/adt/ruleutils.c | |
| parent | 243f11ccf1ed132b0ceff7b5515561a37a1ee2fc (diff) | |
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.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index c70e74caab2..5613ffc40b0 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.124.2.1 2003/01/08 22:54:36 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.124.2.2 2003/10/02 22:25:08 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -2951,6 +2951,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)) @@ -2962,11 +2963,16 @@ get_opclass_name(Oid opclass, Oid actual_datatype, if (!HeapTupleIsValid(ht_opc)) elog(ERROR, "cache lookup failed for opclass %u", opclass); opcrec = (Form_pg_opclass) GETSTRUCT(ht_opc); - if (actual_datatype != opcrec->opcintype || !opcrec->opcdefault) + + /* Must force use of opclass name if not in search path */ + isvisible = OpclassIsVisible(opclass); + + 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 { |
