Commit 37995812 authored by Tom Lane's avatar Tom Lane

Update pg_dump to support dumping operator families.

parent 867c1335
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.95 2007/01/05 22:19:48 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.96 2007/01/23 17:54:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -77,6 +77,7 @@ getSchemaData(int *numTablesPtr) ...@@ -77,6 +77,7 @@ getSchemaData(int *numTablesPtr)
ProcLangInfo *proclanginfo; ProcLangInfo *proclanginfo;
CastInfo *castinfo; CastInfo *castinfo;
OpclassInfo *opcinfo; OpclassInfo *opcinfo;
OpfamilyInfo *opfinfo;
ConvInfo *convinfo; ConvInfo *convinfo;
int numNamespaces; int numNamespaces;
int numAggregates; int numAggregates;
...@@ -85,6 +86,7 @@ getSchemaData(int *numTablesPtr) ...@@ -85,6 +86,7 @@ getSchemaData(int *numTablesPtr)
int numProcLangs; int numProcLangs;
int numCasts; int numCasts;
int numOpclasses; int numOpclasses;
int numOpfamilies;
int numConversions; int numConversions;
if (g_verbose) if (g_verbose)
...@@ -117,6 +119,10 @@ getSchemaData(int *numTablesPtr) ...@@ -117,6 +119,10 @@ getSchemaData(int *numTablesPtr)
write_msg(NULL, "reading user-defined operator classes\n"); write_msg(NULL, "reading user-defined operator classes\n");
opcinfo = getOpclasses(&numOpclasses); opcinfo = getOpclasses(&numOpclasses);
if (g_verbose)
write_msg(NULL, "reading user-defined operator families\n");
opfinfo = getOpfamilies(&numOpfamilies);
if (g_verbose) if (g_verbose)
write_msg(NULL, "reading user-defined conversions\n"); write_msg(NULL, "reading user-defined conversions\n");
convinfo = getConversions(&numConversions); convinfo = getConversions(&numConversions);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.138 2006/11/21 22:19:46 tgl Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.139 2007/01/23 17:54:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2443,7 +2443,8 @@ _getObjectDescription(PQExpBuffer buf, TocEntry *te, ArchiveHandle *AH) ...@@ -2443,7 +2443,8 @@ _getObjectDescription(PQExpBuffer buf, TocEntry *te, ArchiveHandle *AH)
if (strcmp(type, "AGGREGATE") == 0 || if (strcmp(type, "AGGREGATE") == 0 ||
strcmp(type, "FUNCTION") == 0 || strcmp(type, "FUNCTION") == 0 ||
strcmp(type, "OPERATOR") == 0 || strcmp(type, "OPERATOR") == 0 ||
strcmp(type, "OPERATOR CLASS") == 0) strcmp(type, "OPERATOR CLASS") == 0 ||
strcmp(type, "OPERATOR FAMILY") == 0)
{ {
/* Chop "DROP " off the front and make a modifiable copy */ /* Chop "DROP " off the front and make a modifiable copy */
char *first = strdup(te->dropStmt + 5); char *first = strdup(te->dropStmt + 5);
...@@ -2571,6 +2572,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat ...@@ -2571,6 +2572,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
strcmp(te->desc, "FUNCTION") == 0 || strcmp(te->desc, "FUNCTION") == 0 ||
strcmp(te->desc, "OPERATOR") == 0 || strcmp(te->desc, "OPERATOR") == 0 ||
strcmp(te->desc, "OPERATOR CLASS") == 0 || strcmp(te->desc, "OPERATOR CLASS") == 0 ||
strcmp(te->desc, "OPERATOR FAMILY") == 0 ||
strcmp(te->desc, "SCHEMA") == 0 || strcmp(te->desc, "SCHEMA") == 0 ||
strcmp(te->desc, "TABLE") == 0 || strcmp(te->desc, "TABLE") == 0 ||
strcmp(te->desc, "TYPE") == 0 || strcmp(te->desc, "TYPE") == 0 ||
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.h,v 1.131 2007/01/05 22:19:48 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.h,v 1.132 2007/01/23 17:54:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -96,6 +96,7 @@ typedef enum ...@@ -96,6 +96,7 @@ typedef enum
DO_AGG, DO_AGG,
DO_OPERATOR, DO_OPERATOR,
DO_OPCLASS, DO_OPCLASS,
DO_OPFAMILY,
DO_CONVERSION, DO_CONVERSION,
DO_TABLE, DO_TABLE,
DO_ATTRDEF, DO_ATTRDEF,
...@@ -192,6 +193,12 @@ typedef struct _opclassInfo ...@@ -192,6 +193,12 @@ typedef struct _opclassInfo
char *rolname; char *rolname;
} OpclassInfo; } OpclassInfo;
typedef struct _opfamilyInfo
{
DumpableObject dobj;
char *rolname;
} OpfamilyInfo;
typedef struct _convInfo typedef struct _convInfo
{ {
DumpableObject dobj; DumpableObject dobj;
...@@ -421,6 +428,7 @@ extern FuncInfo *getFuncs(int *numFuncs); ...@@ -421,6 +428,7 @@ extern FuncInfo *getFuncs(int *numFuncs);
extern AggInfo *getAggregates(int *numAggregates); extern AggInfo *getAggregates(int *numAggregates);
extern OprInfo *getOperators(int *numOperators); extern OprInfo *getOperators(int *numOperators);
extern OpclassInfo *getOpclasses(int *numOpclasses); extern OpclassInfo *getOpclasses(int *numOpclasses);
extern OpfamilyInfo *getOpfamilies(int *numOpfamilies);
extern ConvInfo *getConversions(int *numConversions); extern ConvInfo *getConversions(int *numConversions);
extern TableInfo *getTables(int *numTables); extern TableInfo *getTables(int *numTables);
extern InhInfo *getInherits(int *numInherits); extern InhInfo *getInherits(int *numInherits);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.16 2007/01/05 22:19:48 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.17 2007/01/23 17:54:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,6 +33,7 @@ static const int oldObjectTypePriority[] = ...@@ -33,6 +33,7 @@ static const int oldObjectTypePriority[] =
3, /* DO_AGG */ 3, /* DO_AGG */
3, /* DO_OPERATOR */ 3, /* DO_OPERATOR */
4, /* DO_OPCLASS */ 4, /* DO_OPCLASS */
4, /* DO_OPFAMILY */
5, /* DO_CONVERSION */ 5, /* DO_CONVERSION */
6, /* DO_TABLE */ 6, /* DO_TABLE */
8, /* DO_ATTRDEF */ 8, /* DO_ATTRDEF */
...@@ -62,6 +63,7 @@ static const int newObjectTypePriority[] = ...@@ -62,6 +63,7 @@ static const int newObjectTypePriority[] =
5, /* DO_AGG */ 5, /* DO_AGG */
6, /* DO_OPERATOR */ 6, /* DO_OPERATOR */
7, /* DO_OPCLASS */ 7, /* DO_OPCLASS */
7, /* DO_OPFAMILY */
9, /* DO_CONVERSION */ 9, /* DO_CONVERSION */
10, /* DO_TABLE */ 10, /* DO_TABLE */
12, /* DO_ATTRDEF */ 12, /* DO_ATTRDEF */
...@@ -996,6 +998,11 @@ describeDumpableObject(DumpableObject *obj, char *buf, int bufsize) ...@@ -996,6 +998,11 @@ describeDumpableObject(DumpableObject *obj, char *buf, int bufsize)
"OPERATOR CLASS %s (ID %d OID %u)", "OPERATOR CLASS %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); obj->name, obj->dumpId, obj->catId.oid);
return; return;
case DO_OPFAMILY:
snprintf(buf, bufsize,
"OPERATOR FAMILY %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid);
return;
case DO_CONVERSION: case DO_CONVERSION:
snprintf(buf, bufsize, snprintf(buf, bufsize,
"CONVERSION %s (ID %d OID %u)", "CONVERSION %s (ID %d OID %u)",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment