Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,7 @@ def _fetch_properties(self, did, tid, idx):
"/".join([self.template_path, self._PROPERTIES_SQL]),
did=did, tid=tid, idx=idx,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_sys_objects=self.blueprint.show_system_objects
)
show_sys_objects=self.blueprint.show_system_objects)

status, res = self.conn.execute_dict(SQL)
if not status:
Expand Down Expand Up @@ -724,8 +723,7 @@ def delete(self, gid, sid, did, scid, tid, **kwargs):
"/".join([self.template_path, self._PROPERTIES_SQL]),
did=did, tid=tid, idx=idx,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_sys_objects=self.blueprint.show_system_objects
)
show_sys_objects=self.blueprint.show_system_objects)

status, res = self.conn.execute_dict(SQL)
if not status:
Expand Down Expand Up @@ -879,8 +877,7 @@ def sql(self, gid, sid, did, scid, tid, idx):
self.conn, schema=self.schema, table=self.table, did=did,
tid=tid, idx=idx, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
add_not_exists_clause=True,
show_sys_objects=self.blueprint.show_system_objects
)
show_sys_objects=self.blueprint.show_system_objects)

return ajax_response(response=SQL)

Expand Down Expand Up @@ -1010,8 +1007,7 @@ def statistics(self, gid, sid, did, scid, tid, idx=None):
"/".join([self.template_path, self._PROPERTIES_SQL]),
did=did, tid=tid, idx=idx,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_sys_objects=self.blueprint.show_system_objects
)
show_sys_objects=self.blueprint.show_system_objects)
status, res = self.conn.execute_dict(SQL)
if not status:
return internal_server_error(errormsg=res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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_$%{}[]()&*^!@""'`\/#"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +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)
WITH (fillfactor=90)
TABLESPACE pg_default;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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)
INCLUDE(name, id)
WITH (fillfactor=10, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +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=10, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.test_table_for_indexes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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_$%{}[]()&*^!@""'`\/#"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ 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;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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)
INCLUDE(name, id)
WITH (fillfactor=10, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.test_table_for_indexes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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_$%{}[]()&*^!@""'`\/#"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ 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;
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.test_table_for_indexes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
@@ -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, deduplicate_items=True)
WITH (fillfactor=10)
TABLESPACE pg_default
WHERE id < 100;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,54 +38,13 @@ SELECT DISTINCT ON (cls.relname)
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
substring(array_to_string(cls.reloptions, ',') FROM 'fillfactor=([0-9]*)')::int AS fillfactor,
substring(array_to_string(cls.reloptions, ',') FROM 'gin_pending_list_limit=([0-9]*)')::int AS gin_pending_list_limit,
substring(array_to_string(cls.reloptions, ',') FROM 'pages_per_range=([0-9]*)')::int AS pages_per_range,
substring(array_to_string(cls.reloptions, ',') FROM 'buffering=([a-z]*)') AS buffering,
substring(array_to_string(cls.reloptions, ',') FROM 'fastupdate=([a-z]*)')::boolean AS fastupdate,
substring(array_to_string(cls.reloptions, ',') FROM 'autosummarize=([a-z]*)')::boolean AS autosummarize,
substring(array_to_string(cls.reloptions, ',') FROM 'lists=([0-9]*)')::int AS lists

{% if datlastsysoid %}
, (cls.oid <= {{ datlastsysoid }}::oid) AS is_sys_idx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,60 +45,14 @@ SELECT DISTINCT ON (cls.relname)
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
substring(array_to_string(cls.reloptions, ',') FROM 'fillfactor=([0-9]*)')::int AS fillfactor,
substring(array_to_string(cls.reloptions, ',') FROM 'deduplicate_items=([a-z]*)')::boolean AS deduplicate_items,
substring(array_to_string(cls.reloptions, ',') FROM 'gin_pending_list_limit=([0-9]*)')::int AS gin_pending_list_limit,
substring(array_to_string(cls.reloptions, ',') FROM 'pages_per_range=([0-9]*)')::int AS pages_per_range,
substring(array_to_string(cls.reloptions, ',') FROM 'buffering=([a-z]*)') AS buffering,
substring(array_to_string(cls.reloptions, ',') FROM 'fastupdate=([a-z]*)') AS fastupdate,
substring(array_to_string(cls.reloptions, ',') FROM 'autosummarize=([a-z]*)')::boolean AS autosummarize,
substring(array_to_string(cls.reloptions, ',') FROM 'lists=([0-9]*)')::int AS lists
{% if datlastsysoid %}
, (cls.oid <= {{ datlastsysoid }}::oid) AS is_sys_idx
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,60 +46,14 @@ SELECT DISTINCT ON (cls.relname)
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
substring(array_to_string(cls.reloptions, ',') FROM 'fillfactor=([0-9]*)')::int AS fillfactor,
substring(array_to_string(cls.reloptions, ',') FROM 'deduplicate_items=([a-z]*)')::boolean AS deduplicate_items,
substring(array_to_string(cls.reloptions, ',') FROM 'gin_pending_list_limit=([0-9]*)')::int AS gin_pending_list_limit,
substring(array_to_string(cls.reloptions, ',') FROM 'pages_per_range=([0-9]*)')::int AS pages_per_range,
substring(array_to_string(cls.reloptions, ',') FROM 'buffering=([a-z]*)') AS buffering,
substring(array_to_string(cls.reloptions, ',') FROM 'fastupdate=([a-z]*)')::boolean AS fastupdate,
substring(array_to_string(cls.reloptions, ',') FROM 'autosummarize=([a-z]*)')::boolean AS autosummarize,
substring(array_to_string(cls.reloptions, ',') FROM 'lists=([0-9]*)')::int AS lists
{% if datlastsysoid %}
, (cls.oid <= {{ datlastsysoid }}::oid) AS is_sys_idx
{% endif %}
Expand Down
Loading
Loading