diff --git a/docs/en_US/images/index_definition.png b/docs/en_US/images/index_definition.png index 17b941bd703..5696eed5f92 100644 Binary files a/docs/en_US/images/index_definition.png and b/docs/en_US/images/index_definition.png differ diff --git a/docs/en_US/images/index_general.png b/docs/en_US/images/index_general.png index c7e7cb373be..4c152777547 100644 Binary files a/docs/en_US/images/index_general.png and b/docs/en_US/images/index_general.png differ diff --git a/docs/en_US/images/index_sql.png b/docs/en_US/images/index_sql.png index d1a1e54f2bc..48bdd691adb 100644 Binary files a/docs/en_US/images/index_sql.png and b/docs/en_US/images/index_sql.png differ diff --git a/docs/en_US/images/index_with.png b/docs/en_US/images/index_with.png new file mode 100644 index 00000000000..26e68883205 Binary files /dev/null and b/docs/en_US/images/index_with.png differ diff --git a/docs/en_US/index_dialog.rst b/docs/en_US/index_dialog.rst index ee3133bd8c4..68d44cf037d 100644 --- a/docs/en_US/index_dialog.rst +++ b/docs/en_US/index_dialog.rst @@ -51,6 +51,27 @@ Use the fields in the *Definition* tab to define the index: * Use the drop-down listbox next to *Depends on extensions* to select the extension that this index depends on (for example, edbspl). If set, dropping the extension will automatically drop the index as well. +* Move the switch next to *Only Table?* to the *Yes* position to create the index + only on the parent table without recursing to its partitions. The default is *No*. +* Move the switch next to *Unique?* to the *Yes* position to check for duplicate values + in the table when the index is created and when data is added. The default is *No*. +* Move the switch next to *NULLs not distinct?* to the *Yes* position to treat null values as not distinct. + The default is *No*. This option is available only on PostgreSQL 15 and above. +* Move the *Clustered?* switch to the *Yes* position to instruct the server to + cluster the table. +* Move the *Concurrent build?* switch to the *Yes* position to build the index + without taking any locks that prevent concurrent inserts, updates, or deletes + on the table. +* Use the *Constraint* field to provide a constraint expression; a constraint + expression limits the entries in the index to those rows that satisfy the + constraint. + +Click the *With* tab to continue. + +.. image:: images/index_with.png + :alt: Index dialog with tab + :align: center + * Use the *Fill Factor* field to specify a fill factor for the index. The fill factor specifies how full the selected method will try to fill each index page. @@ -66,18 +87,6 @@ Use the fields in the *Definition* tab to define the index: The default is *Yes*. * Move the switch next to *Autosummarize* to the *Yes* position to define whether a summarization run is queued for the previous page range whenever an insertion is detected on the next one. The default is *No* -* Move the switch next to *Unique?* to the *Yes* position to check for duplicate values - in the table when the index is created and when data is added. The default is *No*. -* Move the switch next to *NULLs not distinct?* to the *Yes* position to treat null values as not distinct. - The default is *No*. This option is available only on PostgreSQL 15 and above. -* Move the *Clustered?* switch to the *Yes* position to instruct the server to - cluster the table. -* Move the *Concurrent build?* switch to the *Yes* position to build the index - without taking any locks that prevent concurrent inserts, updates, or deletes - on the table. -* Use the *Constraint* field to provide a constraint expression; a constraint - expression limits the entries in the index to those rows that satisfy the - constraint. Click the *Columns* tab to continue. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js index c1bbf72ed41..9753327152e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js @@ -364,6 +364,7 @@ export default class IndexSchema extends BaseUISchema { amname: undefined, fastupdate: false, autosummarize: false, + indisonly: false, columns: [], ...initValues }); @@ -522,7 +523,20 @@ export default class IndexSchema extends BaseUISchema { mode: ['create', 'edit', 'properties'] }, { - type: 'nested-fieldset', label: gettext('With'), group: gettext('Definition'), + id: 'indisonly', label: gettext('Only Table?'), + type: 'switch', group: gettext('Definition'), + disabled: () => { + // ONLY is only applicable to partitioned tables + // Disable if not a partitioned table or if viewing in schema (view mode) + return inSchema(indexSchemaObj.node_info) || + !indexSchemaObj.node_info?.table?.is_partitioned; + }, + mode: ['create'], + min_version: 110000, + helpMessage: gettext('When enabled, the index will only be created on this table, not on its partitions.'), + }, + { + type: 'nested-fieldset', label: gettext('With'), group: gettext('With'), schema: this.withSchema, },{ id: 'indisunique', label: gettext('Unique?'), cell: 'string', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql index 2800857d5d5..b264f42cec9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql @@ -1,6 +1,6 @@ CREATE{% if data.indisunique %} UNIQUE{% endif %} INDEX{% if add_not_exists_clause %} IF NOT EXISTS{% endif %}{% if data.isconcurrent %} CONCURRENTLY{% endif %}{% if data.name %} {{conn|qtIdent(data.name)}}{% endif %} - ON {{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %} + ON {% if data.indisonly %}ONLY {% endif %}{{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %} {% if mode == 'create' %} ({% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{% if c.is_exp %}({{c.colname}}){% else %}{{conn|qtIdent(c.colname)}}{% endif %}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.op_class %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/create.sql index e4a2d368e98..4ce3030af56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/create.sql @@ -1,6 +1,6 @@ CREATE{% if data.indisunique %} UNIQUE{% endif %} INDEX{% if add_not_exists_clause %} IF NOT EXISTS{% endif %}{% if data.isconcurrent %} CONCURRENTLY{% endif %}{% if data.name %} {{conn|qtIdent(data.name)}}{% endif %} - ON {{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %} + ON {% if data.indisonly %}ONLY {% endif %}{{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %} {% if mode == 'create' %} ({% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{% if c.is_exp %}({{c.colname}}){% else %}{{conn|qtIdent(c.colname)}}{% endif %}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.op_class %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/create.sql index f6740fcb3ab..d433cf71e89 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/create.sql @@ -1,6 +1,6 @@ CREATE{% if data.indisunique %} UNIQUE{% endif %} INDEX{% if add_not_exists_clause %} IF NOT EXISTS{% endif %}{% if data.isconcurrent %} CONCURRENTLY{% endif %}{% if data.name %} {{conn|qtIdent(data.name)}}{% endif %} - ON {{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %} + ON {% if data.indisonly %}ONLY {% endif %}{{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %} {% if mode == 'create' %} ({% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{% if c.is_exp %}({{c.colname}}){% else %}{{conn|qtIdent(c.colname)}}{% endif %}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.op_class %}