Skip to content

Commit 4569799

Browse files
Changed logic to display default values only in properties tab.
1 parent 0258c50 commit 4569799

24 files changed

Lines changed: 140 additions & 61 deletions

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ def sql(self, gid, sid, did, scid, tid):
14401440

14411441
return BaseTableView.get_reverse_engineered_sql(
14421442
self, did=did, scid=scid, tid=tid, main_sql=main_sql, data=data,
1443-
add_not_exists_clause=True)
1443+
add_not_exists_clause=True, show_default_values_for_indexes=False)
14441444

14451445
@BaseTableView.check_precondition
14461446
def select_sql(self, gid, sid, did, scid, tid):

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,20 +505,22 @@ def properties(self, gid, sid, did, scid, tid, idx):
505505
status=200
506506
)
507507

508-
def _fetch_properties(self, did, tid, idx):
508+
def _fetch_properties(self, did, tid, idx, show_default_values=True):
509509
"""
510510
This function is used to fetch the properties of specified object.
511511
:param did:
512512
:param tid:
513513
:param idx:
514+
:param show_default_values:
515+
Whether to show default values in CASE statements
514516
:return:
515517
"""
516518
SQL = render_template(
517519
"/".join([self.template_path, self._PROPERTIES_SQL]),
518520
did=did, tid=tid, idx=idx,
519521
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
520522
show_sys_objects=self.blueprint.show_system_objects,
521-
show_defaults=True
523+
show_default_values=show_default_values
522524
)
523525

524526
status, res = self.conn.execute_dict(SQL)
@@ -725,7 +727,8 @@ def delete(self, gid, sid, did, scid, tid, **kwargs):
725727
"/".join([self.template_path, self._PROPERTIES_SQL]),
726728
did=did, tid=tid, idx=idx,
727729
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
728-
show_sys_objects=self.blueprint.show_system_objects
730+
show_sys_objects=self.blueprint.show_system_objects,
731+
show_default_values=True
729732
)
730733

731734
status, res = self.conn.execute_dict(SQL)
@@ -880,7 +883,8 @@ def sql(self, gid, sid, did, scid, tid, idx):
880883
self.conn, schema=self.schema, table=self.table, did=did,
881884
tid=tid, idx=idx, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
882885
add_not_exists_clause=True,
883-
show_sys_objects=self.blueprint.show_system_objects
886+
show_sys_objects=self.blueprint.show_system_objects,
887+
show_default_values=False
884888
)
885889

886890
return ajax_response(response=SQL)
@@ -1011,7 +1015,8 @@ def statistics(self, gid, sid, did, scid, tid, idx=None):
10111015
"/".join([self.template_path, self._PROPERTIES_SQL]),
10121016
did=did, tid=tid, idx=idx,
10131017
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
1014-
show_sys_objects=self.blueprint.show_system_objects
1018+
show_sys_objects=self.blueprint.show_system_objects,
1019+
show_default_values=True
10151020
)
10161021
status, res = self.conn.execute_dict(SQL)
10171022
if not status:

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/11_plus/alter_reset_fillfactor_cluster.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
66
ON public.test_table_for_indexes USING btree
77
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
88
INCLUDE(name, id)
9-
WITH (fillfactor=100)
109
TABLESPACE pg_default;
1110

1211
COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx3_$%{}[]()&*^!@""'`\/#"
66
ON public.test_table_for_indexes USING btree
77
(id ASC NULLS LAST, lower(name) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST)
88
INCLUDE(name, id)
9-
WITH (fillfactor=10, deduplicate_items=True)
9+
WITH (fillfactor=10)
1010
TABLESPACE pg_default
1111
WHERE id < 100;
1212

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
66
ON public.test_table_for_indexes USING btree
77
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
88
INCLUDE(name, id)
9-
WITH (fillfactor=10, deduplicate_items=True)
9+
WITH (fillfactor=10)
1010
TABLESPACE pg_default;
1111

1212
ALTER TABLE IF EXISTS public.test_table_for_indexes

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
66
ON public.test_table_for_indexes USING btree
77
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
88
INCLUDE(name, id)
9-
WITH (fillfactor=90, deduplicate_items=True)
109
TABLESPACE pg_default;
1110

1211
COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx3_$%{}[]()&*^!@""'`\/#"
66
ON public.test_table_for_indexes USING btree
77
(id ASC NULLS LAST, lower(name) COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST)
88
INCLUDE(name, id)
9-
WITH (fillfactor=10, deduplicate_items=True)
9+
WITH (fillfactor=10)
1010
TABLESPACE pg_default
1111
WHERE id < 100;
1212

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
77
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
88
INCLUDE(name, id)
99
NULLS NOT DISTINCT
10-
WITH (fillfactor=10, deduplicate_items=True)
10+
WITH (fillfactor=10)
1111
TABLESPACE pg_default;
1212

1313
ALTER TABLE IF EXISTS public.test_table_for_indexes

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/alter_reset_fillfactor_cluster.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx1_$%{}[]()&*^!@""'`\/#"
77
(id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
88
INCLUDE(name, id)
99
NULLS NOT DISTINCT
10-
WITH (fillfactor=90, deduplicate_items=True)
1110
TABLESPACE pg_default;
1211

1312
COMMENT ON INDEX public."Idx1_$%{}[]()&*^!@""'`\/#"

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/15_plus/create_btree_asc_null_first.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
77
(id ASC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS FIRST)
88
INCLUDE(name, id)
99
NULLS NOT DISTINCT
10-
WITH (fillfactor=10, deduplicate_items=True)
10+
WITH (fillfactor=10)
1111
TABLESPACE pg_default
1212
WHERE id < 100;
1313

0 commit comments

Comments
 (0)