Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/en_US/backup_dialog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ tab to provide options related to data or pgAdmin objects that correspond to *pg
* Move the switch next to *Only schemas* to limit the back up to schema-level
database objects.

* Move the switch next to *Only statistics* to the *Yes* position to limit
the back up to optimizer statistics. **Note:** This option is visible only
for database server greater than or equal to 18.

* Move the switch next to *Blobs* to the *No* position to exclude large
objects in the backup.

Expand Down Expand Up @@ -143,6 +147,18 @@ tab to provide options related to data or pgAdmin objects that correspond to *pg
Table access methods. **Note:** This option is visible only for
database server greater than or equal to 15.

* Move the switch next to *Row security policies* to the *Yes* position to
exclude row security policies. **Note:** This option is visible only for
database server greater than or equal to 18.

* Move the switch next to *Data* to the *Yes* position to exclude data from
the backup. **Note:** This option is visible only for database server
greater than or equal to 18.

* Move the switch next to *Schema* to the *Yes* position to exclude schema
(the data definitions) from the backup. **Note:** This option is visible
only for database server greater than or equal to 18.

.. image:: images/backup_queries.png
:alt: Queries option on backup dialog
:align: center
Expand Down Expand Up @@ -259,6 +275,14 @@ tab to provide other backup options.
position to include a statement that will use a SET SESSION AUTHORIZATION
command to determine object ownership (instead of an ALTER OWNER command).

* Move the switch next to *Dump statistics* to the *Yes* position to include
optimizer statistics in the backup. **Note:** This option is visible only
for database server greater than or equal to 18.

* Move the switch next to *Sequence data* to the *Yes* position to include
sequence data that would normally be excluded. **Note:** This option is
visible only for database server greater than or equal to 18.

* Use the *Exclude schema* field to not dump schemas whose name matches
pattern.

Expand Down
24 changes: 24 additions & 0 deletions docs/en_US/backup_server_dialog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ tab to provide options related to data or pgAdmin objects that correspond to *pg

* Move the switch next to *Only roles* to limit the back up to roles only.

* Move the switch next to *Only statistics* to the *Yes* position to limit
the back up to optimizer statistics. **Note:** This option is visible only
for database server greater than or equal to 18.

.. image:: images/backup_server_do_not_save.png
:alt: Do not save option on backup server dialog
:align: center
Expand Down Expand Up @@ -88,6 +92,18 @@ tab to provide options related to data or pgAdmin objects that correspond to *pg
Table access methods. **Note:** This option is visible only for
database server greater than or equal to 15.

* Move the switch next to *Row security policies* to the *Yes* position to
exclude row security policies. **Note:** This option is visible only for
database server greater than or equal to 18.

* Move the switch next to *Data* to the *Yes* position to exclude data from
the backup. **Note:** This option is visible only for database server
greater than or equal to 18.

* Move the switch next to *Schema* to the *Yes* position to exclude schema
(the data definitions) from the backup. **Note:** This option is visible
only for database server greater than or equal to 18.

.. image:: images/backup_server_queries.png
:alt: Queries option on backup server dialog
:align: center
Expand Down Expand Up @@ -171,6 +187,14 @@ tab to provide other backup options.
position to include a statement that will use a SET SESSION AUTHORIZATION
command to determine object ownership (instead of an ALTER OWNER command).

* Move the switch next to *Dump statistics* to the *Yes* position to include
optimizer statistics in the backup. **Note:** This option is visible only
for database server greater than or equal to 18.

* Move the switch next to *Sequence data* to the *Yes* position to include
sequence data that would normally be excluded. **Note:** This option is
visible only for database server greater than or equal to 18.

* Use the *Exclude database* field to not dump databases whose name matches
pattern.

Expand Down
3 changes: 3 additions & 0 deletions docs/en_US/release_notes_9_16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Bundled PostgreSQL Utilities
New features
************

| `Issue #9064 <https://github.com/pgadmin-org/pgadmin4/issues/9064>`_ - Add the new PostgreSQL 18 pg_dump options to the Backup dialog: Only statistics, Dump statistics, Sequence data, and Do not save Row security policies/Data/Schema.
| `Issue #9065 <https://github.com/pgadmin-org/pgadmin4/issues/9065>`_ - Add the new PostgreSQL 18 pg_dumpall options (Row security policies and Sequence data, among others) to the server Backup dialog.
| `Issue #9066 <https://github.com/pgadmin-org/pgadmin4/issues/9066>`_ - Add the new PostgreSQL 18 pg_restore options to the Restore dialog: Only statistics and Do not restore Row security policies/Data/Schema/Statistics.
| `Issue #9626 <https://github.com/pgadmin-org/pgadmin4/issues/9626>`_ - Add support for the TOAST tuple target storage parameter in the Materialized View dialog.
| `Issue #9646 <https://github.com/pgadmin-org/pgadmin4/issues/9646>`_ - Make the init container security context in the Helm chart configurable via containerSecurityContext, consistent with the main container.
| `Issue #9699 <https://github.com/pgadmin-org/pgadmin4/issues/9699>`_ - Add support for closing a tab with a middle-click on its title.
Expand Down
20 changes: 20 additions & 0 deletions docs/en_US/restore_dialog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ tab to provide options related to data or pgAdmin objects that correspond to *pg
* Move the switch next to *Only schema* to limit the restoration to
schema-level database objects.

* Move the switch next to *Only statistics* to the *Yes* position to limit
the restoration to optimizer statistics. **Note:** This option is visible
only for database server greater than or equal to 18.

.. image:: images/restore_do_not_save.png
:alt: Restore dialog do not save section
:align: center
Expand Down Expand Up @@ -110,6 +114,22 @@ tab to provide options related to data or pgAdmin objects that correspond to *pg
Table access methods. **Note:** This option is visible only for
database server greater than or equal to 15.

* Move the switch next to *Row security policies* to the *Yes* position to
exclude row security policies. **Note:** This option is visible only for
database server greater than or equal to 18.

* Move the switch next to *Data* to the *Yes* position to exclude data from
the restore. **Note:** This option is visible only for database server
greater than or equal to 18.

* Move the switch next to *Schema* to the *Yes* position to exclude schema
(the data definitions) from the restore. **Note:** This option is visible
only for database server greater than or equal to 18.

* Move the switch next to *Statistics* to the *Yes* position to exclude
optimizer statistics from the restore. **Note:** This option is visible
only for database server greater than or equal to 18.

.. image:: images/restore_queries.png
:alt: Restore dialog queries section
:align: center
Expand Down
7 changes: 7 additions & 0 deletions web/pgadmin/tools/backup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def set_value(key, param, default_value=None, assertion=True):
data.get('only_tablespaces', None))
set_param('only_roles', '--roles-only',
data.get('only_roles', None))
set_param('only_statistics', '--statistics-only',
manager.version >= 180000)
Comment on lines +297 to +298

# Sections
set_param('pre_data', '--section=pre-data')
Expand All @@ -317,6 +319,9 @@ def set_value(key, param, default_value=None, assertion=True):
set_param('dns_table_access_method', '--no-table-access-method',
manager.version >= 150000)
set_param('dns_no_role_passwords', '--no-role-passwords')
set_param('no_policies', '--no-policies', manager.version >= 180000)
set_param('no_data', '--no-data', manager.version >= 180000)
set_param('no_schema', '--no-schema', manager.version >= 180000)

# Query Options
set_param('use_insert_commands', '--inserts')
Expand Down Expand Up @@ -353,6 +358,8 @@ def set_value(key, param, default_value=None, assertion=True):
set_param('verbose', '--verbose')
set_param('dqoute', '--quote-all-identifiers')
set_param('use_set_session_auth', '--use-set-session-authorization')
set_param('statistics', '--statistics', manager.version >= 180000)
set_param('sequence_data', '--sequence-data', manager.version >= 180000)
set_value('exclude_schema', '--exclude-schema')
set_value('extra_float_digits', '--extra-float-digits', None,
manager.version >= 120000)
Expand Down
78 changes: 70 additions & 8 deletions web/pgadmin/tools/backup/static/js/backup.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ export class TypeObjSchema extends BaseUISchema {
type: 'switch',
group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data', 'only_schema',
'only_tablespaces', 'only_roles'],
'only_tablespaces', 'only_roles', 'only_statistics'],
disabled: function(state) {
return state.pre_data ||
state.data ||
state.post_data ||
state.only_schema ||
state.only_tablespaces ||
state.only_roles;
state.only_roles ||
state.only_statistics;
},
inlineGroup: 'type_of_objects',
}, {
Expand All @@ -114,14 +115,15 @@ export class TypeObjSchema extends BaseUISchema {
type: 'switch',
group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data', 'only_data',
'only_tablespaces', 'only_roles'],
'only_tablespaces', 'only_roles', 'only_statistics'],
disabled: function(state) {
return state.pre_data ||
state.data ||
state.post_data ||
state.only_data ||
state.only_tablespaces ||
state.only_roles;
state.only_roles ||
state.only_statistics;
},
inlineGroup: 'type_of_objects',
}, {
Expand All @@ -130,14 +132,15 @@ export class TypeObjSchema extends BaseUISchema {
type: 'switch',
group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data', 'only_data', 'only_schema',
'only_roles'],
'only_roles', 'only_statistics'],
disabled: function(state) {
return state.pre_data ||
state.data ||
state.post_data ||
state.only_data ||
state.only_schema ||
state.only_roles;
state.only_roles ||
state.only_statistics;
},
visible: isVisibleForObjectBackup(obj?.top?.backupType),
inlineGroup: 'type_of_objects',
Expand All @@ -147,17 +150,36 @@ export class TypeObjSchema extends BaseUISchema {
type: 'switch',
group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data', 'only_data', 'only_schema',
'only_tablespaces'],
'only_tablespaces', 'only_statistics'],
inlineGroup: 'type_of_objects',
disabled: function(state) {
return state.pre_data ||
state.data ||
state.post_data ||
state.only_data ||
state.only_schema ||
state.only_tablespaces;
state.only_tablespaces ||
state.only_statistics;
},
visible: isVisibleForObjectBackup(obj?.top?.backupType)
}, {
id: 'only_statistics',
label: gettext('Only statistics'),
type: 'switch',
group: gettext('Type of objects'),
min_version: 180000,
deps: ['pre_data', 'data', 'post_data', 'only_data', 'only_schema',
'only_tablespaces', 'only_roles'],
inlineGroup: 'type_of_objects',
disabled: function(state) {
return state.pre_data ||
state.data ||
state.post_data ||
state.only_data ||
state.only_schema ||
state.only_tablespaces ||
state.only_roles;
},
Comment on lines +166 to +182

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Shared root cause: only_statistics was added without reciprocal section wiring.
Both backup and restore schemas add the new “Only statistics” switch, but section controls still don’t consistently depend on it. This leaves a path for conflicting --statistics-only + section flags. Fixing section deps and section disabled predicates in both files resolves both sites.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/pgadmin/tools/backup/static/js/backup.ui.js` around lines 166 - 182, The
new switch with id 'only_statistics' was added but sections that represent
dump/restore sections were not wired to it, allowing conflicting flags; update
any section control definitions (the objects that have properties 'deps' and
'disabled'—e.g., the section controls grouping under 'Type of objects' that
currently list deps like
['pre_data','data','post_data','only_data','only_schema','only_tablespaces','only_roles'])
to include 'only_statistics' in their deps arrays and add the corresponding
check in their disabled predicate (i.e., include state.only_statistics in the OR
chain used in disabled functions); make the same symmetric change in the restore
schema file where the section controls are defined so both backup and restore
honor the only_statistics switch.

}, {
id: 'blobs',
label: gettext('Blobs'),
Expand Down Expand Up @@ -282,6 +304,30 @@ export class SaveOptSchema extends BaseUISchema {
group: gettext('Do not save'),
inlineGroup: 'do_not_save',
min_version: 150000
}, {
id: 'no_policies',
label: gettext('Row security policies'),
type: 'switch',
disabled: false,
group: gettext('Do not save'),
inlineGroup: 'do_not_save',
min_version: 180000
}, {
id: 'no_data',
label: gettext('Data'),
type: 'switch',
disabled: false,
group: gettext('Do not save'),
inlineGroup: 'do_not_save',
min_version: 180000
}, {
id: 'no_schema',
label: gettext('Schema'),
type: 'switch',
disabled: false,
group: gettext('Do not save'),
inlineGroup: 'do_not_save',
min_version: 180000
}];
}
}
Expand Down Expand Up @@ -384,6 +430,22 @@ export class MiscellaneousSchema extends BaseUISchema {
disabled: false,
group: gettext('Miscellaneous'),
inlineGroup: 'miscellaneous',
}, {
id: 'statistics',
label: gettext('Dump statistics'),
type: 'switch',
disabled: false,
group: gettext('Miscellaneous'),
inlineGroup: 'miscellaneous',
min_version: 180000
}, {
id: 'sequence_data',
label: gettext('Sequence data'),
type: 'switch',
disabled: false,
group: gettext('Miscellaneous'),
inlineGroup: 'miscellaneous',
min_version: 180000
}, {
id: 'exclude_schema',
label: gettext('Exclude schema'),
Expand Down
Loading
Loading