diff --git a/redash/data/query_runner_pg.py b/redash/data/query_runner_pg.py index 7facb76c..cf094e46 100644 --- a/redash/data/query_runner_pg.py +++ b/redash/data/query_runner_pg.py @@ -43,7 +43,9 @@ def pg(connection_string): cursor.execute(query) wait(connection) - column_names = set() + # While set would be more efficient here, it sorts the data which is not what we want, but due to the small + # size of the data we can assume it's ok. + column_names = [] columns = [] duplicates_counter = 1 @@ -54,7 +56,7 @@ def pg(connection_string): column_name = column_name + str(duplicates_counter) duplicates_counter += 1 - column_names.add(column_name) + column_names.append(column_name) columns.append({ 'name': column_name,