Skip to content

Commit f06668a

Browse files
Add support of DEPENDS/NO DEPENDS ON EXTENSION for INDEX. #6388
1 parent 4129d38 commit f06668a

25 files changed

+508
-32
lines changed
87.6 KB
Loading

docs/en_US/index_dialog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Use the fields in the *Definition* tab to define the index:
4848
* Select *brin* to create a BRIN index. A BRIN index may improve
4949
performance when managing minimum and maximum values and ranges.
5050

51+
* Use the drop-down listbox next to *Depends on extensions* to select the extension
52+
that this index depends on (for example, edbspl). If set, dropping the extension
53+
will automatically drop the index as well.
5154
* Use the *Fill Factor* field to specify a fill factor for the index. The fill
5255
factor specifies how full the selected method will try to fill each index
5356
page.

docs/en_US/materialized_view_dialog.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ the REFRESH MATERIALIZED VIEW command to update the content of a materialized
1010
view.
1111

1212
The *Materialized View* dialog organizes the development of a materialized_view
13-
through the following dialog tabs: *General*, *Definition*, *Storage*,
13+
through the following dialog tabs: *General*, *Definition*, *Code*,
1414
*Parameter*, and *Security*. The *SQL* tab displays the SQL code generated by
1515
dialog selections.
1616

@@ -31,10 +31,10 @@ Use the fields in the *General* tab to identify the materialized view:
3131
Click the *Definition* tab to continue.
3232

3333
.. image:: images/materialized_view_definition.png
34-
:alt: Materialized view dialog storage tab
34+
:alt: Materialized view dialog definition tab
3535
:align: center
3636

37-
Use the fields in the *Storage* tab to maintain the materialized view:
37+
Use the fields in the *Definition* tab to maintain the materialized view:
3838

3939
* Move the *With Data* switch to the *Yes* position to specify the materialized
4040
view should be populated at creation time. If not, the materialized view
@@ -54,7 +54,7 @@ Use the fields in the *Storage* tab to maintain the materialized view:
5454
Click the *Code* tab to continue.
5555

5656
.. image:: images/materialized_view_code.png
57-
:alt: Materialized view dialog definition tab
57+
:alt: Materialized view dialog code tab
5858
:align: center
5959

6060
Use the text editor field in the *Code* tab to provide the query that will

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ define('pgadmin.node.index', [
125125
},
126126
getSchema: (treeNodeInfo, itemNodeData) => {
127127
let nodeObj = pgAdmin.Browser.Nodes['index'];
128+
let nodeExtObj = pgBrowser.Nodes['extension'];
129+
128130
return new IndexSchema(
129131
{
130132
tablespaceList: ()=>getNodeListByName('tablespace', treeNodeInfo, itemNodeData, {}, (m)=>{
@@ -133,7 +135,17 @@ define('pgadmin.node.index', [
133135
amnameList : ()=>getNodeAjaxOptions('get_access_methods', nodeObj, treeNodeInfo, itemNodeData, {jumpAfterNode: 'schema'}),
134136
columnList: ()=>getNodeListByName('column', treeNodeInfo, itemNodeData, {}),
135137
collationList: ()=>getNodeAjaxOptions('get_collations', nodeObj, treeNodeInfo, itemNodeData, {jumpAfterNode: 'schema'}),
136-
opClassList: ()=>getNodeAjaxOptions('get_op_class', nodeObj, treeNodeInfo, itemNodeData, {jumpAfterNode: 'schema'})
138+
opClassList: ()=>getNodeAjaxOptions('get_op_class', nodeObj, treeNodeInfo, itemNodeData, {jumpAfterNode: 'schema'}),
139+
extensionsList:()=>getNodeAjaxOptions('nodes', nodeExtObj, treeNodeInfo, itemNodeData, { cacheLevel: 'server'},
140+
(data)=>{
141+
let res = [];
142+
if (data && _.isArray(data)) {
143+
_.each(data, function(d) {
144+
res.push({label: d.label, value: d.label, data: d});
145+
});
146+
}
147+
return res;
148+
}),
137149
},
138150
{
139151
node_info: treeNodeInfo

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,23 @@ export default class IndexSchema extends BaseUISchema {
505505
return Promise.resolve(()=>{/*This is intentional (SonarQube)*/});
506506
}
507507
},
508-
},{
508+
},
509+
{
510+
id: 'dependsonextensions',
511+
label: gettext('Depends on extensions'),
512+
group: gettext('Definition'),
513+
type: 'select',
514+
options: this.fieldOptions.extensionsList,
515+
controlProps: {
516+
multiple: true,
517+
allowClear: true,
518+
allowSelectAll: true,
519+
placeholder: gettext('Select the Depends on extensions...'),
520+
},
521+
min_version: 130000,
522+
mode: ['create', 'edit', 'properties']
523+
},
524+
{
509525
type: 'nested-fieldset', label: gettext('With'), group: gettext('Definition'),
510526
schema: this.withSchema,
511527
},{
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
2+
NO DEPENDS ON EXTENSION postgres_fdw;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Index: Idx_$%{}[]()&*^!@"'`\/#
2+
3+
-- DROP INDEX IF EXISTS public."Idx_$%{}[]()&*^!@""'`\/#";
4+
5+
CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
6+
ON public.test_table_for_indexes USING btree
7+
(id ASC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST)
8+
INCLUDE(name, id)
9+
WITH (fillfactor=10, deduplicate_items=False)
10+
TABLESPACE pg_default
11+
WHERE id < 100;
12+
13+
ALTER INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
14+
DEPENDS ON EXTENSION plpgsql;
15+
16+
COMMENT ON INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
17+
IS 'Test Comment';

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_name_fillfactor_comment.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
1111

1212
ALTER TABLE IF EXISTS public.test_table_for_indexes
1313
CLUSTER ON "Idx1_$%{}[]()&*^!@""'`\/#";
14-
1514
COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#"
1615
IS 'Test Comment';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#"
2+
ON public.test_table_for_indexes USING btree
3+
(id ASC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST)
4+
INCLUDE(name, id)
5+
WITH (fillfactor=10, deduplicate_items=False)
6+
TABLESPACE pg_default
7+
WHERE id < 100;
8+
9+
ALTER INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
10+
DEPENDS ON EXTENSION plpgsql;
11+
12+
ALTER INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
13+
DEPENDS ON EXTENSION postgres_fdw;
14+
15+
COMMENT ON INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
16+
IS 'Test Comment';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Index: Idx_$%{}[]()&*^!@"'`\/#
2+
3+
-- DROP INDEX IF EXISTS public."Idx_$%{}[]()&*^!@""'`\/#";
4+
5+
CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
6+
ON public.test_table_for_indexes USING btree
7+
(id ASC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST)
8+
INCLUDE(name, id)
9+
WITH (fillfactor=10, deduplicate_items=False)
10+
TABLESPACE pg_default
11+
WHERE id < 100;
12+
13+
ALTER INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
14+
DEPENDS ON EXTENSION plpgsql;
15+
16+
ALTER INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
17+
DEPENDS ON EXTENSION postgres_fdw;
18+
19+
COMMENT ON INDEX public."Idx_$%{}[]()&*^!@""'`\/#"
20+
IS 'Test Comment';

0 commit comments

Comments
 (0)