diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-10 17:30:18 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-10 17:30:46 -0500 |
commit | 7564654adf07ec26b83c7effc7f54f7183e04519 (patch) | |
tree | 0c532167c51cba9e1ae963762594402dcf834dcc /src/bin/pg_dump/common.c | |
parent | 551c07d84ae2f0d3b7dde68e52322edf9cb87ba5 (diff) | |
download | postgresql-7564654adf07ec26b83c7effc7f54f7183e04519.tar.gz postgresql-7564654adf07ec26b83c7effc7f54f7183e04519.zip |
Revert addition of third argument to format_type().
Including collation in the behavior of that function promotes a world view
we do not want. Moreover, it was producing the wrong behavior for pg_dump
anyway: what we want is to dump a COLLATE clause on attributes whose
attcollation is different from the underlying type, and likewise for
domains, and the function cannot do that for us. Doing it the hard way
in pg_dump is a bit more tedious but produces more correct output.
In passing, fix initdb so that the initial entry in pg_collation is
properly pinned. It was droppable before :-(
Diffstat (limited to 'src/bin/pg_dump/common.c')
-rw-r--r-- | src/bin/pg_dump/common.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 12b22bc256c..472760edf1b 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -54,10 +54,12 @@ static int numTables; static int numTypes; static int numFuncs; static int numOperators; +static int numCollations; static DumpableObject **tblinfoindex; static DumpableObject **typinfoindex; static DumpableObject **funinfoindex; static DumpableObject **oprinfoindex; +static DumpableObject **collinfoindex; static void flagInhTables(TableInfo *tbinfo, int numTables, @@ -105,7 +107,6 @@ getSchemaData(int *numTablesPtr) int numCasts; int numOpclasses; int numOpfamilies; - int numCollations; int numConversions; int numTSParsers; int numTSTemplates; @@ -187,6 +188,7 @@ getSchemaData(int *numTablesPtr) if (g_verbose) write_msg(NULL, "reading user-defined collations\n"); collinfo = getCollations(&numCollations); + collinfoindex = buildIndexArray(collinfo, numCollations, sizeof(CollInfo)); if (g_verbose) write_msg(NULL, "reading user-defined conversions\n"); @@ -784,6 +786,17 @@ findOprByOid(Oid oid) return (OprInfo *) findObjectByOid(oid, oprinfoindex, numOperators); } +/* + * findCollationByOid + * finds the entry (in collinfo) of the collation with the given oid + * returns NULL if not found + */ +CollInfo * +findCollationByOid(Oid oid) +{ + return (CollInfo *) findObjectByOid(oid, collinfoindex, numCollations); +} + /* * findParentsByOid |