1
0
mirror of synced 2026-10-23 07:08:55 +03:00

Add support for 'ONLY' in Index creation dialog. #6386

This commit is contained in:
Rohit Bhati
2026-02-24 12:14:36 +05:30
committed by GitHub
parent 4bb6b72377
commit 3995ba9a95
9 changed files with 40 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -51,6 +51,28 @@ 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. This button will be
enabled for partition tables only. 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 +88,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.

View File

@@ -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',

View File

@@ -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 %}

View File

@@ -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 %}

View File

@@ -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 %}