Skip to content

Commit 31b1af2

Browse files
committed
Fixed an issue where filtering on a view caused an error. #8630
1 parent 4c56e49 commit 31b1af2

File tree

2 files changed

+6
-50
lines changed

2 files changed

+6
-50
lines changed

docs/en_US/release_notes_9_3.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ Bug fixes
3434
| `Issue #8443 <https://github.com/pgadmin-org/pgadmin4/issues/8443>`_ - Fixed an issue where the debugger hangs when stepping into nested function/procedure.
3535
| `Issue #8497 <https://github.com/pgadmin-org/pgadmin4/issues/8497>`_ - Fixed an issue where the scroll position in the Object Explorer was not retained when switching workspaces.
3636
| `Issue #8556 <https://github.com/pgadmin-org/pgadmin4/issues/8556>`_ - Ensure that graph data is updated even when the Dashboard tab is inactive.
37-
| `Issue #8572 <https://github.com/pgadmin-org/pgadmin4/issues/8572>`_ - Fixed an issue where Ctrl/Cmd+A in cell editor would select all rows.
37+
| `Issue #8572 <https://github.com/pgadmin-org/pgadmin4/issues/8572>`_ - Fixed an issue where Ctrl/Cmd+A in cell editor would select all rows.
38+
| `Issue #8630 <https://github.com/pgadmin-org/pgadmin4/issues/8630>`_ - Fixed an issue where filtering on a view caused an error.

web/pgadmin/tools/sqleditor/command.py

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def __init__(self, **kwargs):
369369
def get_primary_keys(self, *args, **kwargs):
370370
return None, None
371371

372-
def get_all_columns_with_order(self, default_conn):
372+
def get_all_columns_with_order(self):
373373
"""
374374
Responsible for fetching columns from given object
375375
@@ -382,38 +382,14 @@ def get_all_columns_with_order(self, default_conn):
382382
all_columns: List of all the column for given object which will
383383
be used to fill columns options
384384
"""
385-
driver = get_driver(PG_DEFAULT_DRIVER)
386-
if default_conn is None:
387-
manager = driver.connection_manager(self.sid)
388-
conn = manager.connection(did=self.did, conn_id=self.conn_id)
389-
else:
390-
conn = default_conn
391-
392385
all_sorted_columns = []
393386
data_sorting = self.get_data_sorting()
394-
all_columns = []
395-
if conn.connected():
396-
# Fetch the rest of the column names
397-
query = render_template(
398-
"/".join([self.sql_path, 'get_columns.sql']),
399-
table_name=self.object_name,
400-
table_nspname=self.nsp_name,
401-
conn=conn,
402-
)
403-
status, result = conn.execute_dict(query)
404-
if not status:
405-
raise ExecuteError(result)
406387

407-
for row in result['rows']:
408-
all_columns.append(row['attname'])
409-
else:
410-
raise InternalServerError(SERVER_CONNECTION_CLOSED)
411-
412-
# If user has custom data sorting then pass as it as it is
388+
# If user has custom data sorting then pass as it is.
413389
if data_sorting and len(data_sorting) > 0:
414390
all_sorted_columns = data_sorting
415391

416-
return all_sorted_columns, all_columns
392+
return all_sorted_columns
417393

418394
def save(self, changed_data, default_conn=None):
419395
return forbidden(
@@ -563,27 +539,6 @@ def get_primary_keys(self, default_conn=None):
563539

564540
return pk_names, primary_keys
565541

566-
def get_all_columns_with_order(self, default_conn=None):
567-
"""
568-
It is overridden method specially for Table because we all have to
569-
fetch primary keys.
570-
571-
Args:
572-
default_conn: Connection object
573-
574-
Returns:
575-
all_sorted_columns: Sorted columns for the Grid
576-
"""
577-
578-
all_sorted_columns = []
579-
data_sorting = self.get_data_sorting()
580-
581-
# If user has custom data sorting then pass as it is
582-
if data_sorting and len(data_sorting) > 0:
583-
all_sorted_columns = data_sorting
584-
585-
return all_sorted_columns
586-
587542
def can_edit(self):
588543
return True
589544

@@ -865,7 +820,7 @@ def __init__(self, **kwargs):
865820
def get_sql(self, default_conn=None):
866821
return None
867822

868-
def get_all_columns_with_order(self, default_conn=None):
823+
def get_all_columns_with_order(self):
869824
return None
870825

871826
def get_primary_keys(self):

0 commit comments

Comments
 (0)