Archery icon indicating copy to clipboard operation
Archery copied to clipboard

[ bug ] PG实例,表名纯大写或者大小写混合不能查询表结构

Open Liuzhj opened this issue 5 years ago • 2 comments

重现步骤

  • SQL 查询 -> 在线查询
  • 选择PG实例 -> 选择数据库 -> 选择模式
  • 查看表结构 -> 选择一个包含大小写或者大写的表名
  • 最下面查询结果出现error
relation "adminusers" does not exist

期待结果和实际结果

期待结果:

  • PG表名包含大小写或者纯大写,可以正常查询表结构。

实际结果:

  • 查询结果出现error

截图

image

错误日志

[2020-04-02 16:48:28,002][DummyThread-3:139900950932296][task_id:default][pgsql.py:164][WARNING]- PgSQL命令执行报错,语句:select
        col.column_name,
        col.data_type,
        col.character_maximum_length,
        col.numeric_precision,
        col.numeric_scale,
        col.is_nullable,
        col.column_default,
        des.description
        from
        information_schema.columns col left join pg_description des on
        col.table_name::regclass = des.objoid
        and col.ordinal_position = des.objsubid
        where table_name = 'AdminUsers'
        order by ordinal_position;, 错误信息:Traceback (most recent call last):
  File "/opt/archery/sql/engines/pgsql.py", line 152, in query
    cursor.execute(sql)
psycopg2.errors.UndefinedTable: relation "adminusers" does not exist

版本信息

应用版本/分支: 1.7.7

部署方式:Docker

Liuzhj avatar Apr 02 '20 08:04 Liuzhj

可以看如何改写这个SQL https://github.com/hhyo/Archery/blob/7e4f2ce15b3346030e120e36d5bb1fe6bfecd6c4/sql/engines/pgsql.py#L97-L122

hhyo avatar Apr 15 '20 14:04 hhyo

你已经很久没有回复这个issue了,如果没有进一步的信息的话, 会作为不活跃issue关闭, 感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 30 '20 15:04 stale[bot]