diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/alter_reset_fillfactor_cluster.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/alter_reset_fillfactor_cluster.sql index d8c7cd5c5..89891dc42 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/alter_reset_fillfactor_cluster.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/alter_reset_fillfactor_cluster.sql @@ -6,6 +6,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) INCLUDE(name, id) + WITH (fillfactor=100) TABLESPACE pg_default; COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#" diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/create_btree_desc_null_first.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/create_btree_desc_null_first.sql index d7f87ff10..329cc493d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/create_btree_desc_null_first.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/create_btree_desc_null_first.sql @@ -6,4 +6,5 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) INCLUDE(name, id) + WITH (fillfactor=100) TABLESPACE pg_default; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_expr_statistics.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_expr_statistics.sql new file mode 100644 index 000000000..0565da209 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_expr_statistics.sql @@ -0,0 +1,14 @@ +-- Index: Idx3_$%{}[]()&*^!@"'`\/# + +-- DROP INDEX IF EXISTS public."Idx3_$%{}[]()&*^!@""'`\/#"; + +CREATE UNIQUE INDEX IF NOT EXISTS "Idx3_$%{}[]()&*^!@""'`\/#" + ON public.test_table_for_indexes USING btree + (id ASC NULLS LAST, lower(name) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) + INCLUDE(name, id) + WITH (fillfactor=10, deduplicate_items=True) + TABLESPACE pg_default + WHERE id < 100; + +COMMENT ON INDEX public."Idx3_$%{}[]()&*^!@""'`\/#" + IS 'Test Comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_name_fillfactor_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_name_fillfactor_comment.sql new file mode 100644 index 000000000..3ffe0803c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_name_fillfactor_comment.sql @@ -0,0 +1,16 @@ +-- Index: Idx1_$%{}[]()&*^!@"'`\/# + +-- DROP INDEX IF EXISTS public."Idx1_$%{}[]()&*^!@""'`\/#"; + +CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#" + ON public.test_table_for_indexes USING btree + (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) + INCLUDE(name, id) + WITH (fillfactor=10, deduplicate_items=True) + TABLESPACE pg_default; + +ALTER TABLE IF EXISTS public.test_table_for_indexes + CLUSTER ON "Idx1_$%{}[]()&*^!@""'`\/#"; + +COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#" + IS 'Test Comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_reset_fillfactor_cluster.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_reset_fillfactor_cluster.sql new file mode 100644 index 000000000..562e2f5b4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/alter_reset_fillfactor_cluster.sql @@ -0,0 +1,13 @@ +-- Index: Idx1_$%{}[]()&*^!@"'`\/# + +-- DROP INDEX IF EXISTS public."Idx1_$%{}[]()&*^!@""'`\/#"; + +CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#" + ON public.test_table_for_indexes USING btree + (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) + INCLUDE(name, id) + WITH (fillfactor=100, deduplicate_items=True) + TABLESPACE pg_default; + +COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#" + IS 'Test Comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/create_btree_desc_null_first.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/create_btree_desc_null_first.sql new file mode 100644 index 000000000..a3a731427 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/create_btree_desc_null_first.sql @@ -0,0 +1,10 @@ +-- Index: Idx_$%{}[]()&*^!@"'`\/# + +-- DROP INDEX IF EXISTS public."Idx_$%{}[]()&*^!@""'`\/#"; + +CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" + ON public.test_table_for_indexes USING btree + (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) + INCLUDE(name, id) + WITH (fillfactor=100, deduplicate_items=True) + TABLESPACE pg_default; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/create_btree_expr_asc_null_last.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/create_btree_expr_asc_null_last.sql new file mode 100644 index 000000000..0565da209 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/13_plus/create_btree_expr_asc_null_last.sql @@ -0,0 +1,14 @@ +-- Index: Idx3_$%{}[]()&*^!@"'`\/# + +-- DROP INDEX IF EXISTS public."Idx3_$%{}[]()&*^!@""'`\/#"; + +CREATE UNIQUE INDEX IF NOT EXISTS "Idx3_$%{}[]()&*^!@""'`\/#" + ON public.test_table_for_indexes USING btree + (id ASC NULLS LAST, lower(name) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) + INCLUDE(name, id) + WITH (fillfactor=10, deduplicate_items=True) + TABLESPACE pg_default + WHERE id < 100; + +COMMENT ON INDEX public."Idx3_$%{}[]()&*^!@""'`\/#" + IS 'Test Comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_name_fillfactor_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_name_fillfactor_comment.sql index 4260ca956..176455eb2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_name_fillfactor_comment.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_name_fillfactor_comment.sql @@ -7,7 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#" (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) INCLUDE(name, id) NULLS NOT DISTINCT - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.test_table_for_indexes diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_reset_fillfactor_cluster.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_reset_fillfactor_cluster.sql index f429e8358..ad9e90412 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_reset_fillfactor_cluster.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_reset_fillfactor_cluster.sql @@ -7,6 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#" (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) INCLUDE(name, id) NULLS NOT DISTINCT + WITH (fillfactor=100, deduplicate_items=True) TABLESPACE pg_default; COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#" diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_first.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_first.sql index 802e19500..cd8186547 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_first.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_first.sql @@ -7,7 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" (id ASC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS FIRST) INCLUDE(name, id) NULLS NOT DISTINCT - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_last.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_last.sql index 2cf9c9e3a..c4cbb0145 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_last.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_last.sql @@ -7,7 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" (id ASC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) INCLUDE(name, id) NULLS NOT DISTINCT - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_first.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_first.sql index 6f6c8cd77..a9e1019d9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_first.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_first.sql @@ -7,4 +7,5 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) INCLUDE(name, id) NULLS NOT DISTINCT + WITH (fillfactor=100, deduplicate_items=True) TABLESPACE pg_default; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_last.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_last.sql index 56ed76878..9507fd647 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_last.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_desc_null_last.sql @@ -7,7 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" (id DESC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS LAST) INCLUDE(name, id) NULLS NOT DISTINCT - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_expr_statistics.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_expr_statistics.sql index 51c1afec9..d85d42c14 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_expr_statistics.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_expr_statistics.sql @@ -5,7 +5,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx3_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id ASC NULLS LAST, lower(name) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_name_fillfactor_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_name_fillfactor_comment.sql index 5b3809ce3..418d34eb8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_name_fillfactor_comment.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/alter_name_fillfactor_comment.sql @@ -5,7 +5,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.test_table_for_indexes diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first.sql index 1086639ab..80ded9e15 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first.sql @@ -5,7 +5,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id ASC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS FIRST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql index 1b11cac98..55cb54d36 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql @@ -1,7 +1,7 @@ CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id ASC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS FIRST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last.sql index 3960455db..c457355c3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last.sql @@ -5,7 +5,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id ASC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last.sql index 907664064..763f41642 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last.sql @@ -5,7 +5,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id DESC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS LAST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql index 4c913b1d3..dfb1a18b7 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql @@ -1,7 +1,7 @@ CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id DESC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS LAST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last.sql index 51c1afec9..d85d42c14 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last.sql @@ -5,7 +5,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx3_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id ASC NULLS LAST, lower(name) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last_msql.sql index 53c401357..a6bdce0ce 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_expr_asc_null_last_msql.sql @@ -1,7 +1,7 @@ CREATE UNIQUE INDEX "Idx3_$%{}[]()&*^!@""'`\/#" ON public.test_table_for_indexes USING btree (id ASC NULLS LAST, (lower(name)) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST) - WITH (fillfactor=10) + WITH (fillfactor=10, deduplicate_items=True) TABLESPACE pg_default WHERE id < 100; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/properties.sql index 2a67c61ac..b2129f84c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/properties.sql @@ -1,36 +1,114 @@ -SELECT DISTINCT ON(cls.relname) cls.oid, cls.relname as name, indrelid, indkey, indisclustered, - indisvalid, indisunique, indisprimary, n.nspname,indnatts,cls.reltablespace AS spcoid, - CASE WHEN (length(spcname::text) > 0 OR cls.relkind = 'I') THEN spcname ELSE - (SELECT sp.spcname FROM pg_catalog.pg_database dtb - JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid - WHERE dtb.oid = {{ did }}::oid) - END as spcname, conname, - tab.relname as tabname, indclass, con.oid AS conoid, - CASE WHEN contype IN ('p', 'u', 'x') THEN desp.description - ELSE des.description END AS description, - pg_catalog.pg_get_expr(indpred, indrelid, true) as indconstraint, contype, condeferrable, condeferred, amname, - (SELECT (CASE WHEN count(i.inhrelid) > 0 THEN true ELSE false END) FROM pg_inherits i WHERE i.inhrelid = cls.oid) as is_inherited, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'gin_pending_list_limit=([0-9]*)') AS gin_pending_list_limit, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'pages_per_range=([0-9]*)') AS pages_per_range, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'buffering=([a-z]*)') AS buffering, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'fastupdate=([a-z]*)')::boolean AS fastupdate, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'autosummarize=([a-z]*)')::boolean AS autosummarize, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'lists=([0-9]*)') AS lists - {% if datlastsysoid %}, (CASE WHEN cls.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_idx {% endif %} +SELECT DISTINCT ON (cls.relname) + cls.oid, + cls.relname AS name, + idx.indrelid, + idx.indkey, + idx.indisclustered, + idx.indisvalid, + idx.indisunique, + idx.indisprimary, + n.nspname, + idx.indnatts, + COALESCE(cls.reltablespace, 0) AS spcoid, + COALESCE( + CASE + WHEN (cls.reltablespace <> 0 OR cls.relkind = 'I') THEN ta.spcname + ELSE ( + SELECT sp.spcname + FROM pg_catalog.pg_database dtb + JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace = sp.oid + WHERE dtb.oid = {{ did }}::oid + LIMIT 1 + ) + END, 'pg_default' + ) AS spcname, + con.conname, + tab.relname AS tabname, + idx.indclass, + con.oid AS conoid, + CASE + WHEN con.contype IN ('p', 'u', 'x') THEN desp.description + ELSE des.description + END AS description, + pg_catalog.pg_get_expr(idx.indpred, idx.indrelid, true) AS indconstraint, + con.contype, + con.condeferrable, + con.condeferred, + am.amname, + EXISTS ( + SELECT 1 FROM pg_inherits inh WHERE inh.inhrelid = cls.oid + ) AS is_inherited, + -- Options (with defaults per index type) + COALESCE( + substring(array_to_string(cls.reloptions, ',') FROM 'fillfactor=([0-9]*)')::int, + CASE am.amname + WHEN 'btree' THEN 100 + WHEN 'gist' THEN 90 + ELSE NULL + END + ) AS fillfactor, + COALESCE( + CASE am.amname + WHEN 'gin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'gin_pending_list_limit=([0-9]*)')::int + ELSE NULL + END, + CASE am.amname WHEN 'gin' THEN 4096 * 1024 ELSE NULL END + ) AS gin_pending_list_limit, + COALESCE( + CASE am.amname + WHEN 'brin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'pages_per_range=([0-9]*)')::int + ELSE NULL + END, + CASE am.amname WHEN 'brin' THEN 128 ELSE NULL END + ) AS pages_per_range, + COALESCE( + CASE am.amname + WHEN 'gist' THEN substring(array_to_string(cls.reloptions, ',') FROM 'buffering=([a-z]*)') + ELSE NULL + END, + CASE am.amname WHEN 'gist' THEN 'auto' ELSE NULL END + ) AS buffering, + COALESCE( + CASE am.amname + WHEN 'gin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'fastupdate=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'gin' THEN TRUE ELSE NULL END + ) AS fastupdate, + COALESCE( + CASE am.amname + WHEN 'brin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'autosummarize=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'brin' THEN FALSE ELSE NULL END + ) AS autosummarize, + COALESCE( + substring(array_to_string(cls.reloptions, ',') FROM 'lists=([0-9]*)')::int, + NULL + ) AS lists + + {% if datlastsysoid %} + , (cls.oid <= {{ datlastsysoid }}::oid) AS is_sys_idx + {% endif %} FROM pg_catalog.pg_index idx - JOIN pg_catalog.pg_class cls ON cls.oid=indexrelid - JOIN pg_catalog.pg_class tab ON tab.oid=indrelid - LEFT OUTER JOIN pg_catalog.pg_tablespace ta on ta.oid=cls.reltablespace - JOIN pg_catalog.pg_namespace n ON n.oid=tab.relnamespace - JOIN pg_catalog.pg_am am ON am.oid=cls.relam - LEFT JOIN pg_catalog.pg_depend dep ON (dep.classid = cls.tableoid AND dep.objid = cls.oid AND dep.refobjsubid = '0' AND dep.refclassid=(SELECT oid FROM pg_catalog.pg_class WHERE relname='pg_constraint') AND dep.deptype='i') - LEFT OUTER JOIN pg_catalog.pg_constraint con ON (con.tableoid = dep.refclassid AND con.oid = dep.refobjid) - LEFT OUTER JOIN pg_catalog.pg_description des ON (des.objoid=cls.oid AND des.classoid='pg_class'::regclass) - LEFT OUTER JOIN pg_catalog.pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0 AND desp.classoid='pg_constraint'::regclass) -WHERE indrelid = {{tid}}::OID -{% if not show_sys_objects %} - AND conname is NULL -{% endif %} - {% if idx %}AND cls.oid = {{idx}}::OID {% endif %} - ORDER BY cls.relname + JOIN pg_catalog.pg_class cls ON cls.oid = idx.indexrelid + JOIN pg_catalog.pg_class tab ON tab.oid = idx.indrelid + LEFT JOIN pg_catalog.pg_tablespace ta ON ta.oid = cls.reltablespace + JOIN pg_catalog.pg_namespace n ON n.oid = tab.relnamespace + JOIN pg_catalog.pg_am am ON am.oid = cls.relam + LEFT JOIN pg_catalog.pg_depend dep ON dep.classid = cls.tableoid + AND dep.objid = cls.oid + AND dep.refobjsubid = 0 + AND dep.refclassid = (SELECT oid FROM pg_catalog.pg_class WHERE relname = 'pg_constraint') + AND dep.deptype = 'i' + LEFT JOIN pg_catalog.pg_constraint con ON con.tableoid = dep.refclassid AND con.oid = dep.refobjid + LEFT JOIN pg_catalog.pg_description des ON des.objoid = cls.oid AND des.classoid = 'pg_class'::regclass + LEFT JOIN pg_catalog.pg_description desp ON desp.objoid = con.oid AND desp.objsubid = 0 AND desp.classoid = 'pg_constraint'::regclass +WHERE idx.indrelid = {{ tid }}::OID + {% if not show_sys_objects %} + AND con.conname IS NULL + {% endif %} + {% if idx %} + AND cls.oid = {{ idx }}::OID + {% endif %} +ORDER BY cls.relname; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/properties.sql index 6cafb2357..bc1069352 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/13_plus/properties.sql @@ -1,37 +1,120 @@ -SELECT DISTINCT ON(cls.relname) cls.oid, cls.relname as name, indrelid, indkey, indisclustered, - indisvalid, indisunique, indisprimary, n.nspname,indnatts,cls.reltablespace AS spcoid, - CASE WHEN (length(spcname::text) > 0 OR cls.relkind = 'I') THEN spcname ELSE - (SELECT sp.spcname FROM pg_catalog.pg_database dtb - JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid - WHERE dtb.oid = {{ did }}::oid) - END as spcname, conname, - tab.relname as tabname, indclass, con.oid AS conoid, - CASE WHEN contype IN ('p', 'u', 'x') THEN desp.description - ELSE des.description END AS description, - pg_catalog.pg_get_expr(indpred, indrelid, true) as indconstraint, contype, condeferrable, condeferred, amname, - (SELECT (CASE WHEN count(i.inhrelid) > 0 THEN true ELSE false END) FROM pg_inherits i WHERE i.inhrelid = cls.oid) as is_inherited, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'deduplicate_items=([a-z]*)')::boolean AS deduplicate_items, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'gin_pending_list_limit=([0-9]*)') AS gin_pending_list_limit, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'pages_per_range=([0-9]*)') AS pages_per_range, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'buffering=([a-z]*)') AS buffering, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'fastupdate=([a-z]*)')::boolean AS fastupdate, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'autosummarize=([a-z]*)')::boolean AS autosummarize, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'lists=([0-9]*)') AS lists - {% if datlastsysoid %}, (CASE WHEN cls.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_idx {% endif %} +SELECT DISTINCT ON (cls.relname) + cls.oid, + cls.relname AS name, + idx.indrelid, + idx.indkey, + idx.indisclustered, + idx.indisvalid, + idx.indisunique, + idx.indisprimary, + n.nspname, + idx.indnatts, + COALESCE(cls.reltablespace, 0) AS spcoid, + COALESCE( + CASE + WHEN (cls.reltablespace <> 0 OR cls.relkind = 'I') THEN ta.spcname + ELSE ( + SELECT sp.spcname + FROM pg_catalog.pg_database dtb + JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace = sp.oid + WHERE dtb.oid = {{ did }}::oid + LIMIT 1 + ) + END, 'pg_default' + ) AS spcname, + con.conname, + tab.relname AS tabname, + idx.indclass, + con.oid AS conoid, + CASE + WHEN con.contype IN ('p', 'u', 'x') THEN desp.description + ELSE des.description + END AS description, + pg_catalog.pg_get_expr(idx.indpred, idx.indrelid, true) AS indconstraint, + con.contype, + con.condeferrable, + con.condeferred, + am.amname, + EXISTS ( + SELECT 1 FROM pg_inherits inh WHERE inh.inhrelid = cls.oid + ) AS is_inherited, + -- Options (with defaults per index type) + COALESCE( + substring(array_to_string(cls.reloptions, ',') FROM 'fillfactor=([0-9]*)')::int, + CASE am.amname + WHEN 'btree' THEN 100 + WHEN 'gist' THEN 90 + ELSE NULL + END + ) AS fillfactor, + COALESCE( + CASE am.amname + WHEN 'btree' THEN substring(array_to_string(cls.reloptions, ',') FROM 'deduplicate_items=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'btree' THEN TRUE ELSE NULL END + ) AS deduplicate_items, + COALESCE( + CASE am.amname + WHEN 'gin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'gin_pending_list_limit=([0-9]*)')::int + ELSE NULL + END, + CASE am.amname WHEN 'gin' THEN 4096 * 1024 ELSE NULL END + ) AS gin_pending_list_limit, + COALESCE( + CASE am.amname + WHEN 'brin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'pages_per_range=([0-9]*)')::int + ELSE NULL + END, + CASE am.amname WHEN 'brin' THEN 128 ELSE NULL END + ) AS pages_per_range, + COALESCE( + CASE am.amname + WHEN 'gist' THEN substring(array_to_string(cls.reloptions, ',') FROM 'buffering=([a-z]*)') + ELSE NULL + END, + CASE am.amname WHEN 'gist' THEN 'auto' ELSE NULL END + ) AS buffering, + COALESCE( + CASE am.amname + WHEN 'gin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'fastupdate=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'gin' THEN TRUE ELSE NULL END + ) AS fastupdate, + COALESCE( + CASE am.amname + WHEN 'brin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'autosummarize=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'brin' THEN FALSE ELSE NULL END + ) AS autosummarize, + COALESCE( + substring(array_to_string(cls.reloptions, ',') FROM 'lists=([0-9]*)')::int, + NULL + ) AS lists + {% if datlastsysoid %} + , (cls.oid <= {{ datlastsysoid }}::oid) AS is_sys_idx + {% endif %} FROM pg_catalog.pg_index idx - JOIN pg_catalog.pg_class cls ON cls.oid=indexrelid - JOIN pg_catalog.pg_class tab ON tab.oid=indrelid - LEFT OUTER JOIN pg_catalog.pg_tablespace ta on ta.oid=cls.reltablespace - JOIN pg_catalog.pg_namespace n ON n.oid=tab.relnamespace - JOIN pg_catalog.pg_am am ON am.oid=cls.relam - LEFT JOIN pg_catalog.pg_depend dep ON (dep.classid = cls.tableoid AND dep.objid = cls.oid AND dep.refobjsubid = '0' AND dep.refclassid=(SELECT oid FROM pg_catalog.pg_class WHERE relname='pg_constraint') AND dep.deptype='i') - LEFT OUTER JOIN pg_catalog.pg_constraint con ON (con.tableoid = dep.refclassid AND con.oid = dep.refobjid) - LEFT OUTER JOIN pg_catalog.pg_description des ON (des.objoid=cls.oid AND des.classoid='pg_class'::regclass) - LEFT OUTER JOIN pg_catalog.pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0 AND desp.classoid='pg_constraint'::regclass) -WHERE indrelid = {{tid}}::OID -{% if not show_sys_objects %} - AND conname is NULL -{% endif %} - {% if idx %}AND cls.oid = {{idx}}::OID {% endif %} - ORDER BY cls.relname + JOIN pg_catalog.pg_class cls ON cls.oid = idx.indexrelid + JOIN pg_catalog.pg_class tab ON tab.oid = idx.indrelid + LEFT JOIN pg_catalog.pg_tablespace ta ON ta.oid = cls.reltablespace + JOIN pg_catalog.pg_namespace n ON n.oid = tab.relnamespace + JOIN pg_catalog.pg_am am ON am.oid = cls.relam + LEFT JOIN pg_catalog.pg_depend dep ON dep.classid = cls.tableoid + AND dep.objid = cls.oid + AND dep.refobjsubid = 0 + AND dep.refclassid = (SELECT oid FROM pg_catalog.pg_class WHERE relname = 'pg_constraint') + AND dep.deptype = 'i' + LEFT JOIN pg_catalog.pg_constraint con ON con.tableoid = dep.refclassid AND con.oid = dep.refobjid + LEFT JOIN pg_catalog.pg_description des ON des.objoid = cls.oid AND des.classoid = 'pg_class'::regclass + LEFT JOIN pg_catalog.pg_description desp ON desp.objoid = con.oid AND desp.objsubid = 0 AND desp.classoid = 'pg_constraint'::regclass +WHERE idx.indrelid = {{ tid }}::OID + {% if not show_sys_objects %} + AND con.conname IS NULL + {% endif %} + {% if idx %} + AND cls.oid = {{ idx }}::OID + {% endif %} +ORDER BY cls.relname; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/properties.sql index 71613bea0..694515ee4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/15_plus/properties.sql @@ -1,37 +1,121 @@ -SELECT DISTINCT ON(cls.relname) cls.oid, cls.relname as name, indrelid, indkey, indisclustered, - indisvalid, indisunique, indisprimary, n.nspname,indnatts,cls.reltablespace AS spcoid, indnullsnotdistinct, - CASE WHEN (length(spcname::text) > 0 OR cls.relkind = 'I') THEN spcname ELSE - (SELECT sp.spcname FROM pg_catalog.pg_database dtb - JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid - WHERE dtb.oid = {{ did }}::oid) - END as spcname, conname, - tab.relname as tabname, indclass, con.oid AS conoid, - CASE WHEN contype IN ('p', 'u', 'x') THEN desp.description - ELSE des.description END AS description, - pg_catalog.pg_get_expr(indpred, indrelid, true) as indconstraint, contype, condeferrable, condeferred, amname, - (SELECT (CASE WHEN count(i.inhrelid) > 0 THEN true ELSE false END) FROM pg_inherits i WHERE i.inhrelid = cls.oid) as is_inherited, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'deduplicate_items=([a-z]*)')::boolean AS deduplicate_items, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'gin_pending_list_limit=([0-9]*)') AS gin_pending_list_limit, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'pages_per_range=([0-9]*)') AS pages_per_range, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'buffering=([a-z]*)') AS buffering, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'fastupdate=([a-z]*)')::boolean AS fastupdate, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'autosummarize=([a-z]*)')::boolean AS autosummarize, - substring(pg_catalog.array_to_string(cls.reloptions, ',') from 'lists=([0-9]*)') AS lists - {% if datlastsysoid %}, (CASE WHEN cls.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_idx {% endif %} +SELECT DISTINCT ON (cls.relname) + cls.oid, + cls.relname AS name, + idx.indrelid, + idx.indkey, + idx.indisclustered, + idx.indisvalid, + idx.indisunique, + idx.indisprimary, + n.nspname, + idx.indnatts, + COALESCE(cls.reltablespace, 0) AS spcoid, + idx.indnullsnotdistinct, + COALESCE( + CASE + WHEN (cls.reltablespace <> 0 OR cls.relkind = 'I') THEN ta.spcname + ELSE ( + SELECT sp.spcname + FROM pg_catalog.pg_database dtb + JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace = sp.oid + WHERE dtb.oid = {{ did }}::oid + LIMIT 1 + ) + END, 'pg_default' + ) AS spcname, + con.conname, + tab.relname AS tabname, + idx.indclass, + con.oid AS conoid, + CASE + WHEN con.contype IN ('p', 'u', 'x') THEN desp.description + ELSE des.description + END AS description, + pg_catalog.pg_get_expr(idx.indpred, idx.indrelid, true) AS indconstraint, + con.contype, + con.condeferrable, + con.condeferred, + am.amname, + EXISTS ( + SELECT 1 FROM pg_inherits inh WHERE inh.inhrelid = cls.oid + ) AS is_inherited, + -- Options (with defaults per index type) + COALESCE( + substring(array_to_string(cls.reloptions, ',') FROM 'fillfactor=([0-9]*)')::int, + CASE am.amname + WHEN 'btree' THEN 100 + WHEN 'gist' THEN 90 + ELSE NULL + END + ) AS fillfactor, + COALESCE( + CASE am.amname + WHEN 'btree' THEN substring(array_to_string(cls.reloptions, ',') FROM 'deduplicate_items=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'btree' THEN TRUE ELSE NULL END + ) AS deduplicate_items, + COALESCE( + CASE am.amname + WHEN 'gin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'gin_pending_list_limit=([0-9]*)')::int + ELSE NULL + END, + CASE am.amname WHEN 'gin' THEN 4096 * 1024 ELSE NULL END + ) AS gin_pending_list_limit, + COALESCE( + CASE am.amname + WHEN 'brin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'pages_per_range=([0-9]*)')::int + ELSE NULL + END, + CASE am.amname WHEN 'brin' THEN 128 ELSE NULL END + ) AS pages_per_range, + COALESCE( + CASE am.amname + WHEN 'gist' THEN substring(array_to_string(cls.reloptions, ',') FROM 'buffering=([a-z]*)') + ELSE NULL + END, + CASE am.amname WHEN 'gist' THEN 'auto' ELSE NULL END + ) AS buffering, + COALESCE( + CASE am.amname + WHEN 'gin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'fastupdate=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'gin' THEN TRUE ELSE NULL END + ) AS fastupdate, + COALESCE( + CASE am.amname + WHEN 'brin' THEN substring(array_to_string(cls.reloptions, ',') FROM 'autosummarize=([a-z]*)')::boolean + ELSE NULL + END, + CASE am.amname WHEN 'brin' THEN FALSE ELSE NULL END + ) AS autosummarize, + COALESCE( + substring(array_to_string(cls.reloptions, ',') FROM 'lists=([0-9]*)')::int, + NULL + ) AS lists + {% if datlastsysoid %} + , (cls.oid <= {{ datlastsysoid }}::oid) AS is_sys_idx + {% endif %} FROM pg_catalog.pg_index idx - JOIN pg_catalog.pg_class cls ON cls.oid=indexrelid - JOIN pg_catalog.pg_class tab ON tab.oid=indrelid - LEFT OUTER JOIN pg_catalog.pg_tablespace ta on ta.oid=cls.reltablespace - JOIN pg_catalog.pg_namespace n ON n.oid=tab.relnamespace - JOIN pg_catalog.pg_am am ON am.oid=cls.relam - LEFT JOIN pg_catalog.pg_depend dep ON (dep.classid = cls.tableoid AND dep.objid = cls.oid AND dep.refobjsubid = '0' AND dep.refclassid=(SELECT oid FROM pg_catalog.pg_class WHERE relname='pg_constraint') AND dep.deptype='i') - LEFT OUTER JOIN pg_catalog.pg_constraint con ON (con.tableoid = dep.refclassid AND con.oid = dep.refobjid) - LEFT OUTER JOIN pg_catalog.pg_description des ON (des.objoid=cls.oid AND des.classoid='pg_class'::regclass) - LEFT OUTER JOIN pg_catalog.pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0 AND desp.classoid='pg_constraint'::regclass) -WHERE indrelid = {{tid}}::OID -{% if not show_sys_objects %} - AND conname is NULL -{% endif %} - {% if idx %}AND cls.oid = {{idx}}::OID {% endif %} - ORDER BY cls.relname + JOIN pg_catalog.pg_class cls ON cls.oid = idx.indexrelid + JOIN pg_catalog.pg_class tab ON tab.oid = idx.indrelid + LEFT JOIN pg_catalog.pg_tablespace ta ON ta.oid = cls.reltablespace + JOIN pg_catalog.pg_namespace n ON n.oid = tab.relnamespace + JOIN pg_catalog.pg_am am ON am.oid = cls.relam + LEFT JOIN pg_catalog.pg_depend dep ON dep.classid = cls.tableoid + AND dep.objid = cls.oid + AND dep.refobjsubid = 0 + AND dep.refclassid = (SELECT oid FROM pg_catalog.pg_class WHERE relname = 'pg_constraint') + AND dep.deptype = 'i' + LEFT JOIN pg_catalog.pg_constraint con ON con.tableoid = dep.refclassid AND con.oid = dep.refobjid + LEFT JOIN pg_catalog.pg_description des ON des.objoid = cls.oid AND des.classoid = 'pg_class'::regclass + LEFT JOIN pg_catalog.pg_description desp ON desp.objoid = con.oid AND desp.objsubid = 0 AND desp.classoid = 'pg_constraint'::regclass +WHERE idx.indrelid = {{ tid }}::OID + {% if not show_sys_objects %} + AND con.conname IS NULL + {% endif %} + {% if idx %} + AND cls.oid = {{ idx }}::OID + {% endif %} +ORDER BY cls.relname;