hhyo / hhyo/Archery

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

Open
#698 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
7k
Forks
1.9k
Avg merge
2d 11h
Merged PRs (30d)
6

Description

### 重现步骤

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

### 期待结果和实际结果
期待结果:
- PG表名包含大小写或者纯大写,可以正常查询表结构。

实际结果:
- 查询结果出现error

### 截图

![image](https://user-images.githubusercontent.com/14147011/78229086-17ecca00-7502-11ea-94fd-4012f48db960.png)


### 错误日志

```
[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

Contributor guide

Open the contributing guide

Research direction

Start in /opt/archery/sql/engines/pgsql.py around the query method and inspect the PostgreSQL schema query shown in the error log. Reproduce the issue with a mixed-case or uppercase table name, then verify that viewing its table structure completes without an UndefinedTable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.