Fixed issue found during testing of #7163.
parent
7c6fdcb12e
commit
e18a8bf620
|
@ -200,31 +200,29 @@ tab related to tables that should be included in the backup.
|
|||
contents of the table that they have access to. This option is relevant
|
||||
only when dumping the contents of a table which has row security.
|
||||
|
||||
* Move the switch next to *With OIDs* towards right position to include object
|
||||
identifiers as part of the table data for each table.
|
||||
|
||||
* Use the *Table and Children* field to dump the tables and any partitions
|
||||
or inheritance child tables of the tables matching the table pattern. Multiple patterns
|
||||
can be given separated by space. **Note:** This option is visible only
|
||||
for database server greater than or equal to 16.
|
||||
|
||||
* Use the *Exclude table* field to not dump the tables matching the table
|
||||
pattern. Multiple patterns can be given separated by space.
|
||||
|
||||
* Use the *Exclude table data* field to not dump data for any tables
|
||||
matching the table pattern. Multiple patterns can be given separated by
|
||||
spaces.
|
||||
|
||||
* Use the *Exclude table and children* field to not dump the tables and any
|
||||
partitions or inheritance child tables of the tables matching the table
|
||||
pattern. Multiple patterns can be given separated by space. **Note:** This
|
||||
option is visible only for database server greater than or equal to 16.
|
||||
|
||||
* Use the *Exclude table data and children* field to not dump data for the
|
||||
tables and any partitions or inheritance child tables of the tables matching
|
||||
the table pattern. Multiple patterns can be given separated by space.
|
||||
* Use the *Include table(s) and Children* field to dump the tables and any partitions
|
||||
or inheritance child tables of the tables matching the pattern.
|
||||
**Note:** This option is visible only for database server greater than or
|
||||
equal to 16.
|
||||
|
||||
* The Exclude patterns field is utilized to exclude patterns in the following manner:
|
||||
|
||||
* Use the *Table(s)* field to not dump the tables matching the
|
||||
pattern. Multiple patterns can be given separated by space.
|
||||
|
||||
* Use the *Table(s) data* field to not dump data for any tables
|
||||
matching the pattern. Multiple patterns can be given separated by
|
||||
spaces.
|
||||
|
||||
* Use the *Table(s) and children* field to not dump the tables and any
|
||||
partitions or inheritance child tables of the tables matching the pattern.
|
||||
**Note:** This option is visible only for database server greater than or
|
||||
equal to 16.
|
||||
|
||||
* Use the *Table(s) data and children* field to not dump data for the
|
||||
tables and any partitions or inheritance child tables of the tables matching
|
||||
the table pattern. **Note:** This option is visible only for database server
|
||||
greater than or equal to 16.
|
||||
|
||||
Click the *Options* tab to continue. Use the fields in the *Options*
|
||||
tab to provide other backup options.
|
||||
|
|
|
@ -136,9 +136,6 @@ tab related to tables that should be included in the backup.
|
|||
partition itself. **Note:** This option is visible only for database server
|
||||
greater than or equal to 11.
|
||||
|
||||
* Move the switch next to *With OIDs* towards right position to include object
|
||||
identifiers as part of the table data for each table.
|
||||
|
||||
Click the *Options* tab to continue. Use the fields in the *Options*
|
||||
tab to provide other backup options.
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 56 KiB |
Binary file not shown.
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
|
@ -236,10 +236,13 @@ def _get_args_params_values(data, conn, backup_obj_type, backup_file, server,
|
|||
return
|
||||
val = data.get(key, default_value)
|
||||
if val:
|
||||
val = val.split()
|
||||
for c_val in val:
|
||||
args.append(param)
|
||||
args.append(c_val)
|
||||
if isinstance(val, list):
|
||||
for c_val in val:
|
||||
args.append(param)
|
||||
args.append(c_val)
|
||||
return
|
||||
args.append(param)
|
||||
args.append(val)
|
||||
|
||||
if backup_obj_type != 'objects':
|
||||
args.append('--database')
|
||||
|
@ -317,7 +320,6 @@ def _get_args_params_values(data, conn, backup_obj_type, backup_file, server,
|
|||
set_param('use_column_inserts', '--column-inserts')
|
||||
set_param('load_via_partition_root', '--load-via-partition-root',
|
||||
manager.version >= 110000)
|
||||
set_param('with_oids', '--oids')
|
||||
set_param('enable_row_security', '--enable-row-security')
|
||||
set_value('exclude_table_data', '--exclude-table-data')
|
||||
set_value('table_and_children', '--table-and-children', None,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
import { getNodeListByName, getNodeAjaxOptions } from '../../../../browser/static/js/node_ajax';
|
||||
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getDisabledOptionSchema, getMiscellaneousSchema} from './backup.ui';
|
||||
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getDisabledOptionSchema, getMiscellaneousSchema, getExcludePatternsSchema} from './backup.ui';
|
||||
import BackupGlobalSchema, {getMiscellaneousSchema as getMiscellaneousGlobalSchema} from './backupGlobal.ui';
|
||||
import getApiInstance from 'sources/api_instance';
|
||||
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
|
||||
|
@ -244,6 +244,7 @@ define([
|
|||
()=> getSaveOptSchema({nodeInfo: treeNodeInfo}),
|
||||
()=> getDisabledOptionSchema({nodeInfo: treeNodeInfo}),
|
||||
()=> getMiscellaneousSchema({nodeInfo: treeNodeInfo}),
|
||||
()=> getExcludePatternsSchema(),
|
||||
{
|
||||
role: ()=>getNodeListByName('role', treeNodeInfo, itemNodeData),
|
||||
encoding: ()=>getNodeAjaxOptions('get_encodings', pgBrowser.Nodes['database'], treeNodeInfo, itemNodeData, {
|
||||
|
|
|
@ -382,18 +382,20 @@ export class MiscellaneousSchema extends BaseUISchema {
|
|||
}, {
|
||||
id: 'exclude_schema',
|
||||
label: gettext('Exclude schema'),
|
||||
type: 'text',
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
group: gettext('Miscellaneous'),
|
||||
visible: isVisibleForServerBackup(obj?._top?.backupType)
|
||||
visible: isVisibleForServerBackup(obj?._top?.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}, {
|
||||
id: 'exclude_database',
|
||||
label: gettext('Exclude database'),
|
||||
type: 'text',
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
min_version: 160000,
|
||||
group: gettext('Miscellaneous'),
|
||||
visible: isVisibleForObjectBackup(obj?._top?.backupType)
|
||||
visible: isVisibleForObjectBackup(obj?._top?.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}, {
|
||||
id: 'extra_float_digits',
|
||||
label: gettext('Extra float digits'),
|
||||
|
@ -415,8 +417,67 @@ export function getMiscellaneousSchema(fieldOptions) {
|
|||
return new MiscellaneousSchema(fieldOptions);
|
||||
}
|
||||
|
||||
export class ExcludePatternsSchema extends BaseUISchema {
|
||||
constructor(fieldOptions={}, initValues={}) {
|
||||
super({
|
||||
...initValues,
|
||||
});
|
||||
|
||||
this.fieldOptions = {
|
||||
...fieldOptions,
|
||||
};
|
||||
}
|
||||
|
||||
get idAttribute() {
|
||||
return 'id';
|
||||
}
|
||||
|
||||
get baseFields() {
|
||||
let obj = this;
|
||||
return [{
|
||||
id: 'exclude_table',
|
||||
label: gettext('Table(s)'),
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
visible: isVisibleForServerBackup(obj?._top?.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}, {
|
||||
id: 'exclude_table_data',
|
||||
label: gettext('Table(s) data'),
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
visible: isVisibleForServerBackup(obj?._top?.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}, {
|
||||
id: 'exclude_table_and_children',
|
||||
label: gettext('Table(s) and children'),
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
min_version: 160000,
|
||||
visible: isVisibleForServerBackup(obj?._top?.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}, {
|
||||
id: 'exclude_table_data_and_children',
|
||||
label: gettext('Table(s) data and children'),
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
min_version: 160000,
|
||||
visible: isVisibleForServerBackup(obj?._top?.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
export function getExcludePatternsSchema() {
|
||||
return new ExcludePatternsSchema();
|
||||
}
|
||||
|
||||
export default class BackupSchema extends BaseUISchema {
|
||||
constructor(sectionSchema, typeObjSchema, saveOptSchema, disabledOptionSchema, miscellaneousSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null, backupType='server', objects={}) {
|
||||
constructor(sectionSchema, typeObjSchema, saveOptSchema, disabledOptionSchema, miscellaneousSchema, excludePatternsSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null, backupType='server', objects={}) {
|
||||
super({
|
||||
file: undefined,
|
||||
format: 'custom',
|
||||
|
@ -439,6 +500,7 @@ export default class BackupSchema extends BaseUISchema {
|
|||
this.getSaveOptSchema = saveOptSchema;
|
||||
this.getDisabledOptionSchema = disabledOptionSchema;
|
||||
this.getMiscellaneousSchema = miscellaneousSchema;
|
||||
this.getExcludePatternsSchema = excludePatternsSchema;
|
||||
}
|
||||
|
||||
get idAttribute() {
|
||||
|
@ -640,62 +702,21 @@ export default class BackupSchema extends BaseUISchema {
|
|||
},
|
||||
visible: isVisibleForServerBackup(obj.backupType),
|
||||
helpMessage: gettext('This option is enabled only when Use INSERT Commands is enabled.')
|
||||
}, {
|
||||
id: 'with_oids',
|
||||
label: gettext('With OID(s)'),
|
||||
type: 'switch',
|
||||
deps: ['use_column_inserts', 'use_insert_commands'],
|
||||
group: gettext('Table Options'),
|
||||
disabled: function(state) {
|
||||
let serverInfo = _.isUndefined(obj.treeNodeInfo) ? undefined : obj.treeNodeInfo.server;
|
||||
|
||||
if (!_.isUndefined(serverInfo) && serverInfo.version >= 120000)
|
||||
return true;
|
||||
|
||||
if (state.use_column_inserts || state.use_insert_commands) {
|
||||
state.with_oids = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}, {
|
||||
id: 'table_and_children',
|
||||
label: gettext('Table and Children'),
|
||||
type: 'text',
|
||||
label: gettext('Include table(s) and Children'),
|
||||
type: 'select',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
min_version: 160000,
|
||||
visible: isVisibleForServerBackup(obj.backupType)
|
||||
visible: isVisibleForServerBackup(obj.backupType),
|
||||
controlProps: { multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: ' ' }
|
||||
}, {
|
||||
id: 'exclude_table',
|
||||
label: gettext('Exclude table'),
|
||||
type: 'text',
|
||||
disabled: false,
|
||||
type: 'nested-fieldset',
|
||||
label: gettext('Exclude patterns'),
|
||||
group: gettext('Table Options'),
|
||||
visible: isVisibleForServerBackup(obj.backupType)
|
||||
}, {
|
||||
id: 'exclude_table_data',
|
||||
label: gettext('Exclude table data'),
|
||||
type: 'text',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
visible: isVisibleForServerBackup(obj.backupType)
|
||||
}, {
|
||||
id: 'exclude_table_and_children',
|
||||
label: gettext('Exclude table and children'),
|
||||
type: 'text',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
min_version: 160000,
|
||||
visible: isVisibleForServerBackup(obj.backupType)
|
||||
}, {
|
||||
id: 'exclude_table_data_and_children',
|
||||
label: gettext('Exclude table data and children'),
|
||||
type: 'text',
|
||||
disabled: false,
|
||||
group: gettext('Table Options'),
|
||||
min_version: 160000,
|
||||
visible: isVisibleForServerBackup(obj.backupType)
|
||||
schema: obj.getExcludePatternsSchema(),
|
||||
visible: isVisibleForServerBackup(obj.backupType),
|
||||
}, {
|
||||
type: 'nested-fieldset',
|
||||
label: gettext('Disable'),
|
||||
|
|
|
@ -500,7 +500,7 @@ class BackupCreateJobTest(BaseTestGenerator):
|
|||
schemas=[],
|
||||
tables=[],
|
||||
database='postgres',
|
||||
exclude_table_data='table1',
|
||||
exclude_table_data=['table1'],
|
||||
),
|
||||
url=BACKUP_OBJECT_URL,
|
||||
expected_cmd_opts=['--exclude-table-data', 'table1'],
|
||||
|
@ -560,12 +560,11 @@ class BackupCreateJobTest(BaseTestGenerator):
|
|||
database='postgres',
|
||||
disable_quoting=True,
|
||||
use_set_session_auth=True,
|
||||
with_oids=True,
|
||||
dqoute=True
|
||||
),
|
||||
url=BACKUP_OBJECT_URL,
|
||||
expected_cmd_opts=[VERBOSE, '--quote-all-identifiers',
|
||||
'--disable-dollar-quoting', '--oids',
|
||||
'--disable-dollar-quoting',
|
||||
'--use-set-session-authorization'],
|
||||
not_expected_cmd_opts=[],
|
||||
expected_exit_code=[0, None]
|
||||
|
@ -588,7 +587,7 @@ class BackupCreateJobTest(BaseTestGenerator):
|
|||
schemas=[],
|
||||
tables=[],
|
||||
database='postgres',
|
||||
exclude_schema="sch*"
|
||||
exclude_schema=["sch*"]
|
||||
),
|
||||
url=BACKUP_OBJECT_URL,
|
||||
expected_cmd_opts=[VERBOSE, '--exclude-schema', 'sch*'],
|
||||
|
@ -726,7 +725,7 @@ class BackupCreateJobTest(BaseTestGenerator):
|
|||
schemas=[],
|
||||
tables=[],
|
||||
database='postgres',
|
||||
exclude_table="table1"
|
||||
exclude_table=["table1"]
|
||||
),
|
||||
url=BACKUP_OBJECT_URL,
|
||||
expected_cmd_opts=['--exclude-table', 'table1'],
|
||||
|
@ -1174,12 +1173,11 @@ class BackupCreateJobTest(BaseTestGenerator):
|
|||
verbose=True,
|
||||
disable_quoting=True,
|
||||
use_set_session_auth=True,
|
||||
with_oids=True,
|
||||
dqoute=True
|
||||
),
|
||||
url=BACKUP_SERVER_URL,
|
||||
expected_cmd_opts=[VERBOSE, '--quote-all-identifiers',
|
||||
'--disable-dollar-quoting', '--oids',
|
||||
'--disable-dollar-quoting',
|
||||
'--use-set-session-authorization'],
|
||||
not_expected_cmd_opts=[],
|
||||
expected_exit_code=[0, None]
|
||||
|
|
|
@ -11,7 +11,7 @@ import React from 'react';
|
|||
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getDisabledOptionSchema, getMiscellaneousSchema} from '../../../pgadmin/tools/backup/static/js/backup.ui';
|
||||
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getDisabledOptionSchema, getMiscellaneousSchema, getExcludePatternsSchema} from '../../../pgadmin/tools/backup/static/js/backup.ui';
|
||||
import { getCreateView, withBrowser } from '../genericFunctions';
|
||||
import { act, render } from '@testing-library/react';
|
||||
|
||||
|
@ -23,6 +23,7 @@ describe('BackupSchema', ()=>{
|
|||
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getExcludePatternsSchema(),
|
||||
{
|
||||
role: ()=>[],
|
||||
encoding: ()=>[],
|
||||
|
@ -44,6 +45,7 @@ describe('BackupSchema', ()=>{
|
|||
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getExcludePatternsSchema(),
|
||||
{
|
||||
role: ()=>[],
|
||||
encoding: ()=>[],
|
||||
|
@ -83,6 +85,7 @@ describe('BackupSchema', ()=>{
|
|||
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getExcludePatternsSchema(),
|
||||
{
|
||||
role: ()=>[],
|
||||
encoding: ()=>[],
|
||||
|
|
Loading…
Reference in New Issue