mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where indexes showing TABLESPACE pg_default for partition SQL, which should not be shown.
refs #6329
This commit is contained in:
parent
5a302684f7
commit
f5ef022ef5
@ -1,4 +1,5 @@
|
||||
SELECT DISTINCT ON(cls.relname) cls.oid, cls.relname as name
|
||||
SELECT DISTINCT ON(cls.relname) cls.oid, cls.relname as name,
|
||||
(SELECT (CASE WHEN count(i.inhrelid) > 0 THEN true ELSE false END) FROM pg_inherits i WHERE i.inhrelid = cls.oid) as is_inherited
|
||||
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
|
||||
|
@ -1,6 +1,6 @@
|
||||
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 THEN spcname ELSE
|
||||
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)
|
||||
@ -9,6 +9,7 @@ SELECT DISTINCT ON(cls.relname) cls.oid, cls.relname as name, indrelid, indkey,
|
||||
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
|
||||
{% if datlastsysoid %}, (CASE WHEN cls.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_idx {% endif %}
|
||||
FROM pg_catalog.pg_index idx
|
||||
|
@ -703,6 +703,12 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
from pgadmin.browser.server_groups.servers.databases.schemas. \
|
||||
tables.indexes import utils as index_utils
|
||||
for row in rset['rows']:
|
||||
# Do not include inherited indexes as those are automatically
|
||||
# created by postgres. If index is inherited, exclude it
|
||||
# from main sql
|
||||
if 'is_inherited' in row and row['is_inherited'] is True:
|
||||
continue
|
||||
|
||||
index_sql = index_utils.get_reverse_engineered_sql(
|
||||
self.conn, schema=schema, table=table, did=did, tid=tid,
|
||||
idx=row['oid'], datlastsysoid=self.datlastsysoid,
|
||||
@ -943,6 +949,10 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
# Add into partition sql to partition array
|
||||
partition_sql_arr.append(partition_main_sql)
|
||||
|
||||
# Get Reverse engineered sql for index
|
||||
self._get_resql_for_index(did, row['oid'], partition_sql_arr,
|
||||
json_resp, schema, table)
|
||||
|
||||
# Get Reverse engineered sql for ROW SECURITY POLICY
|
||||
self._get_resql_for_row_security_policy(scid, row['oid'],
|
||||
json_resp,
|
||||
|
Loading…
Reference in New Issue
Block a user