@@ -147,6 +147,8 @@ InitDumpOptions(DumpOptions *opts)
147
147
opts -> include_everything = true;
148
148
opts -> cparams .promptPassword = TRI_DEFAULT ;
149
149
opts -> dumpSections = DUMP_UNSECTIONED ;
150
+ opts -> dumpSchema = true;
151
+ opts -> dumpData = true;
150
152
}
151
153
152
154
/*
@@ -165,8 +167,8 @@ dumpOptionsFromRestoreOptions(RestoreOptions *ropt)
165
167
dopt -> cparams .username = ropt -> cparams .username ? pg_strdup (ropt -> cparams .username ) : NULL ;
166
168
dopt -> cparams .promptPassword = ropt -> cparams .promptPassword ;
167
169
dopt -> outputClean = ropt -> dropSchema ;
168
- dopt -> dataOnly = ropt -> dataOnly ;
169
- dopt -> schemaOnly = ropt -> schemaOnly ;
170
+ dopt -> dumpData = ropt -> dumpData ;
171
+ dopt -> dumpSchema = ropt -> dumpSchema ;
170
172
dopt -> if_exists = ropt -> if_exists ;
171
173
dopt -> column_inserts = ropt -> column_inserts ;
172
174
dopt -> dumpSections = ropt -> dumpSections ;
@@ -419,12 +421,12 @@ RestoreArchive(Archive *AHX)
419
421
* Work out if we have an implied data-only restore. This can happen if
420
422
* the dump was data only or if the user has used a toc list to exclude
421
423
* all of the schema data. All we do is look for schema entries - if none
422
- * are found then we set the dataOnly flag.
424
+ * are found then we unset the dumpSchema flag.
423
425
*
424
426
* We could scan for wanted TABLE entries, but that is not the same as
425
- * dataOnly . At this stage, it seems unnecessary (6-Mar-2001).
427
+ * data-only . At this stage, it seems unnecessary (6-Mar-2001).
426
428
*/
427
- if (! ropt -> dataOnly )
429
+ if (ropt -> dumpSchema )
428
430
{
429
431
int impliedDataOnly = 1 ;
430
432
@@ -438,7 +440,7 @@ RestoreArchive(Archive *AHX)
438
440
}
439
441
if (impliedDataOnly )
440
442
{
441
- ropt -> dataOnly = impliedDataOnly ;
443
+ ropt -> dumpSchema = false ;
442
444
pg_log_info ("implied data-only restore" );
443
445
}
444
446
}
@@ -824,7 +826,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel)
824
826
/* Dump any relevant dump warnings to stderr */
825
827
if (!ropt -> suppressDumpWarnings && strcmp (te -> desc , "WARNING" ) == 0 )
826
828
{
827
- if (! ropt -> dataOnly && te -> defn != NULL && strlen (te -> defn ) != 0 )
829
+ if (ropt -> dumpSchema && te -> defn != NULL && strlen (te -> defn ) != 0 )
828
830
pg_log_warning ("warning from original dump file: %s" , te -> defn );
829
831
else if (te -> copyStmt != NULL && strlen (te -> copyStmt ) != 0 )
830
832
pg_log_warning ("warning from original dump file: %s" , te -> copyStmt );
@@ -1080,6 +1082,8 @@ NewRestoreOptions(void)
1080
1082
opts -> dumpSections = DUMP_UNSECTIONED ;
1081
1083
opts -> compression_spec .algorithm = PG_COMPRESSION_NONE ;
1082
1084
opts -> compression_spec .level = 0 ;
1085
+ opts -> dumpSchema = true;
1086
+ opts -> dumpData = true;
1083
1087
1084
1088
return opts ;
1085
1089
}
@@ -1090,7 +1094,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
1090
1094
RestoreOptions * ropt = AH -> public .ropt ;
1091
1095
1092
1096
/* This hack is only needed in a data-only restore */
1093
- if (! ropt -> dataOnly || !ropt -> disable_triggers )
1097
+ if (ropt -> dumpSchema || !ropt -> disable_triggers )
1094
1098
return ;
1095
1099
1096
1100
pg_log_info ("disabling triggers for %s" , te -> tag );
@@ -1116,7 +1120,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
1116
1120
RestoreOptions * ropt = AH -> public .ropt ;
1117
1121
1118
1122
/* This hack is only needed in a data-only restore */
1119
- if (! ropt -> dataOnly || !ropt -> disable_triggers )
1123
+ if (ropt -> dumpSchema || !ropt -> disable_triggers )
1120
1124
return ;
1121
1125
1122
1126
pg_log_info ("enabling triggers for %s" , te -> tag );
@@ -3147,13 +3151,13 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
3147
3151
if ((strcmp (te -> desc , "<Init>" ) == 0 ) && (strcmp (te -> tag , "Max OID" ) == 0 ))
3148
3152
return 0 ;
3149
3153
3150
- /* Mask it if we only want schema */
3151
- if (ropt -> schemaOnly )
3154
+ /* Mask it if we don't want data */
3155
+ if (! ropt -> dumpData )
3152
3156
{
3153
3157
/*
3154
- * The sequence_data option overrides schemaOnly for SEQUENCE SET.
3158
+ * The sequence_data option overrides dumpData for SEQUENCE SET.
3155
3159
*
3156
- * In binary-upgrade mode, even with schemaOnly set , we do not mask
3160
+ * In binary-upgrade mode, even with dumpData unset , we do not mask
3157
3161
* out large objects. (Only large object definitions, comments and
3158
3162
* other metadata should be generated in binary-upgrade mode, not the
3159
3163
* actual data, but that need not concern us here.)
@@ -3171,8 +3175,8 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
3171
3175
res = res & REQ_SCHEMA ;
3172
3176
}
3173
3177
3174
- /* Mask it if we only want data */
3175
- if (ropt -> dataOnly )
3178
+ /* Mask it if we don't want schema */
3179
+ if (! ropt -> dumpSchema )
3176
3180
res = res & REQ_DATA ;
3177
3181
3178
3182
return res ;
0 commit comments