|
12 | 12 | * by PostgreSQL
|
13 | 13 | *
|
14 | 14 | * IDENTIFICATION
|
15 |
| - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.513 2009/01/06 18:01:57 momjian Exp $ |
| 15 | + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.514 2009/01/18 20:44:45 tgl Exp $ |
16 | 16 | *
|
17 | 17 | *-------------------------------------------------------------------------
|
18 | 18 | */
|
@@ -1008,28 +1008,39 @@ selectDumpableTable(TableInfo *tbinfo)
|
1008 | 1008 | /*
|
1009 | 1009 | * selectDumpableType: policy-setting subroutine
|
1010 | 1010 | * Mark a type as to be dumped or not
|
| 1011 | + * |
| 1012 | + * If it's a table's rowtype or an autogenerated array type, we also apply a |
| 1013 | + * special type code to facilitate sorting into the desired order. (We don't |
| 1014 | + * want to consider those to be ordinary types because that would bring tables |
| 1015 | + * up into the datatype part of the dump order.) Those tests should be made |
| 1016 | + * first to ensure the objType change is applied regardless of namespace etc. |
1011 | 1017 | */
|
1012 | 1018 | static void
|
1013 | 1019 | selectDumpableType(TypeInfo *tinfo)
|
1014 | 1020 | {
|
1015 |
| - /* Dump only types in dumpable namespaces */ |
1016 |
| - if (!tinfo->dobj.namespace->dobj.dump) |
| 1021 | + /* skip complex types, except for standalone composite types */ |
| 1022 | + if (OidIsValid(tinfo->typrelid) && |
| 1023 | + tinfo->typrelkind != RELKIND_COMPOSITE_TYPE) |
| 1024 | + { |
1017 | 1025 | tinfo->dobj.dump = false;
|
| 1026 | + tinfo->dobj.objType = DO_DUMMY_TYPE; |
| 1027 | + } |
1018 | 1028 |
|
1019 |
| - /* skip complex types, except for standalone composite types */ |
1020 |
| - /* (note: this test should now be unnecessary) */ |
1021 |
| - else if (OidIsValid(tinfo->typrelid) && |
1022 |
| - tinfo->typrelkind != RELKIND_COMPOSITE_TYPE) |
| 1029 | + /* skip auto-generated array types */ |
| 1030 | + else if (tinfo->isArray) |
| 1031 | + { |
| 1032 | + tinfo->dobj.dump = false; |
| 1033 | + tinfo->dobj.objType = DO_DUMMY_TYPE; |
| 1034 | + } |
| 1035 | + |
| 1036 | + /* dump only types in dumpable namespaces */ |
| 1037 | + else if (!tinfo->dobj.namespace->dobj.dump) |
1023 | 1038 | tinfo->dobj.dump = false;
|
1024 | 1039 |
|
1025 | 1040 | /* skip undefined placeholder types */
|
1026 | 1041 | else if (!tinfo->isDefined)
|
1027 | 1042 | tinfo->dobj.dump = false;
|
1028 | 1043 |
|
1029 |
| - /* skip auto-generated array types */ |
1030 |
| - else if (tinfo->isArray) |
1031 |
| - tinfo->dobj.dump = false; |
1032 |
| - |
1033 | 1044 | else
|
1034 | 1045 | tinfo->dobj.dump = true;
|
1035 | 1046 | }
|
@@ -2310,16 +2321,6 @@ getTypes(int *numTypes)
|
2310 | 2321 | tinfo[i].typtype = *PQgetvalue(res, i, i_typtype);
|
2311 | 2322 | tinfo[i].shellType = NULL;
|
2312 | 2323 |
|
2313 |
| - /* |
2314 |
| - * If it's a table's rowtype, use special type code to facilitate |
2315 |
| - * sorting into the desired order. (We don't want to consider it an |
2316 |
| - * ordinary type because that would bring the table up into the |
2317 |
| - * datatype part of the dump order.) |
2318 |
| - */ |
2319 |
| - if (OidIsValid(tinfo[i].typrelid) && |
2320 |
| - tinfo[i].typrelkind != RELKIND_COMPOSITE_TYPE) |
2321 |
| - tinfo[i].dobj.objType = DO_TABLE_TYPE; |
2322 |
| - |
2323 | 2324 | if (strcmp(PQgetvalue(res, i, i_typisdefined), "t") == 0)
|
2324 | 2325 | tinfo[i].isDefined = true;
|
2325 | 2326 | else
|
@@ -5836,8 +5837,8 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj)
|
5836 | 5837 | case DO_TABLE_DATA:
|
5837 | 5838 | dumpTableData(fout, (TableDataInfo *) dobj);
|
5838 | 5839 | break;
|
5839 |
| - case DO_TABLE_TYPE: |
5840 |
| - /* table rowtypes are never dumped separately */ |
| 5840 | + case DO_DUMMY_TYPE: |
| 5841 | + /* table rowtypes and array types are never dumped separately */ |
5841 | 5842 | break;
|
5842 | 5843 | case DO_TSPARSER:
|
5843 | 5844 | dumpTSParser(fout, (TSParserInfo *) dobj);
|
|
0 commit comments