xo / usql

Universal command-line interface for SQL databases
MIT License
8.94k stars 352 forks source link

Shows columns from tables with same name in different database in clickhouse #351

Closed v4run closed 2 years ago

v4run commented 2 years ago

I have two tables with same name (tab) in different databases (one and two).

ch:localhost=> \dt+ tab
               List of relations
 Schema | Name | Type  | Rows | Size | Comment
--------+------+-------+------+------+---------
 one    | tab  | TABLE |    0 | 0    |
 two    | tab  | TABLE |    0 | 0    |

Both tables have one column each.

ch:localhost=> select * from one.tab;
 ok
----
 1
(1 row)

ch:localhost=> select * from two.tab;
 notok
-------
 1
(1 row)

But, if I use \t one.tab, it show columns from both the tables.

ch:localhost=> \d one.tab
           TABLE "one.tab"
 Name  |  Type  | Nullable | Default
-------+--------+----------+---------
 notok | String | ""       |
 ok    | String | ""       |