@@ -147,6 +147,8 @@ InitDumpOptions(DumpOptions *opts)
147147 opts -> include_everything = true;
148148 opts -> cparams .promptPassword = TRI_DEFAULT ;
149149 opts -> dumpSections = DUMP_UNSECTIONED ;
150+ opts -> dumpSchema = true;
151+ opts -> dumpData = true;
150152}
151153
152154/*
@@ -165,8 +167,8 @@ dumpOptionsFromRestoreOptions(RestoreOptions *ropt)
165167 dopt -> cparams .username = ropt -> cparams .username ? pg_strdup (ropt -> cparams .username ) : NULL ;
166168 dopt -> cparams .promptPassword = ropt -> cparams .promptPassword ;
167169 dopt -> outputClean = ropt -> dropSchema ;
168- dopt -> dataOnly = ropt -> dataOnly ;
169- dopt -> schemaOnly = ropt -> schemaOnly ;
170+ dopt -> dumpData = ropt -> dumpData ;
171+ dopt -> dumpSchema = ropt -> dumpSchema ;
170172 dopt -> if_exists = ropt -> if_exists ;
171173 dopt -> column_inserts = ropt -> column_inserts ;
172174 dopt -> dumpSections = ropt -> dumpSections ;
@@ -419,12 +421,12 @@ RestoreArchive(Archive *AHX)
419421 * Work out if we have an implied data-only restore. This can happen if
420422 * the dump was data only or if the user has used a toc list to exclude
421423 * 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.
423425 *
424426 * 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).
426428 */
427- if (! ropt -> dataOnly )
429+ if (ropt -> dumpSchema )
428430 {
429431 int impliedDataOnly = 1 ;
430432
@@ -438,7 +440,7 @@ RestoreArchive(Archive *AHX)
438440 }
439441 if (impliedDataOnly )
440442 {
441- ropt -> dataOnly = impliedDataOnly ;
443+ ropt -> dumpSchema = false ;
442444 pg_log_info ("implied data-only restore" );
443445 }
444446 }
@@ -824,7 +826,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel)
824826 /* Dump any relevant dump warnings to stderr */
825827 if (!ropt -> suppressDumpWarnings && strcmp (te -> desc , "WARNING" ) == 0 )
826828 {
827- if (! ropt -> dataOnly && te -> defn != NULL && strlen (te -> defn ) != 0 )
829+ if (ropt -> dumpSchema && te -> defn != NULL && strlen (te -> defn ) != 0 )
828830 pg_log_warning ("warning from original dump file: %s" , te -> defn );
829831 else if (te -> copyStmt != NULL && strlen (te -> copyStmt ) != 0 )
830832 pg_log_warning ("warning from original dump file: %s" , te -> copyStmt );
@@ -1080,6 +1082,8 @@ NewRestoreOptions(void)
10801082 opts -> dumpSections = DUMP_UNSECTIONED ;
10811083 opts -> compression_spec .algorithm = PG_COMPRESSION_NONE ;
10821084 opts -> compression_spec .level = 0 ;
1085+ opts -> dumpSchema = true;
1086+ opts -> dumpData = true;
10831087
10841088 return opts ;
10851089}
@@ -1090,7 +1094,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
10901094 RestoreOptions * ropt = AH -> public .ropt ;
10911095
10921096 /* This hack is only needed in a data-only restore */
1093- if (! ropt -> dataOnly || !ropt -> disable_triggers )
1097+ if (ropt -> dumpSchema || !ropt -> disable_triggers )
10941098 return ;
10951099
10961100 pg_log_info ("disabling triggers for %s" , te -> tag );
@@ -1116,7 +1120,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
11161120 RestoreOptions * ropt = AH -> public .ropt ;
11171121
11181122 /* This hack is only needed in a data-only restore */
1119- if (! ropt -> dataOnly || !ropt -> disable_triggers )
1123+ if (ropt -> dumpSchema || !ropt -> disable_triggers )
11201124 return ;
11211125
11221126 pg_log_info ("enabling triggers for %s" , te -> tag );
@@ -3147,13 +3151,13 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
31473151 if ((strcmp (te -> desc , "<Init>" ) == 0 ) && (strcmp (te -> tag , "Max OID" ) == 0 ))
31483152 return 0 ;
31493153
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 )
31523156 {
31533157 /*
3154- * The sequence_data option overrides schemaOnly for SEQUENCE SET.
3158+ * The sequence_data option overrides dumpData for SEQUENCE SET.
31553159 *
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
31573161 * out large objects. (Only large object definitions, comments and
31583162 * other metadata should be generated in binary-upgrade mode, not the
31593163 * actual data, but that need not concern us here.)
@@ -3171,8 +3175,8 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
31713175 res = res & REQ_SCHEMA ;
31723176 }
31733177
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 )
31763180 res = res & REQ_DATA ;
31773181
31783182 return res ;
0 commit comments