antares
antares copied to clipboard
Columns missing in the result if they have same names
Describe the bug When the result set has two or more columns that have the same name and datatype, Antares hides duplicate columns. This can be seen in the attached screenshot.
To Reproduce Steps to reproduce the behavior:
- Connect to PostgreSQL database Antares SQL client
- Run the below query (this can be replicated by any query that selects the columns twice)
SELECT
class_table.relname,
class_table.relkind,
class_depend.relname,
class_depend.relkind
FROM pg_depend
INNER JOIN pg_class AS class_depend
ON class_depend.oid = pg_depend.objid
INNER JOIN pg_class AS class_table
ON class_table.oid = pg_depend.refobjid;
- See the results have missing columns
Expected behavior Results should show all columns, even if they are duplicates.
Screenshots
Application (please complete the following information):
- App client PostgreSQL
- App version 0.7.12
- Installation source: Linux DEB
Environment (please complete the following information):
- OS name: Ubuntu
- OS version 23.04
- DB name PostgreSQL
- DB version 11, 15 (I did not test on PostgreSQL v12, v13 and v14, but I suspect they are impacted too)
Additional context NA
Its something that happens with join queries on pg_catalog.
Sadly from PostgreSQL driver i receive in metadata the same table ID for all fields and I'm unable to provide them a different keys.
However, I will try to figure out if there is a way to solve this problem. Until then as a workaround I suggest applying aliases in selects.
Please let me know if you noticed this behavior outside pg_catalog.
Thanks for the update. I noticed this behavior outside pg_catalog tables as well.
For example, the below query outputs just one column-
CREATE TABLE employees (id int, name text);
INSERT INTO employees
VALUES (1, 'abc');
SELECT
id,
id
FROM public.employees;
Output:
Aliasing the columns does work though :)
This also happens with mysql/mariadb with no joins.
This also happens with mysql/mariadb with no joins.
Can you give me an example?
This also happens with mysql/mariadb with no joins.
Can you give me an example?
SELECT some_id, some_id, some_id, other_colum FROM some_table;
SELECT some_id, some_id, some_id, other_colum FROM some_table;
In this case is because mysql library returns me an array of objects as results and an object can't have properties with same name.
SELECT some_id, some_id, some_id, other_colum FROM some_table;In this case is because mysql library returns me an array of objects as results and an object can't have properties with same name.
Would it make sense to check for duplicates and throw an error instead, or maybe alias it behind the scenes to avoid displaying the table with offset columns?