When using Redshift - PostgresSyntaxError: syntax error at or near "ORDER" - in query with no "ORDER"
还没有人认领这个 Issue。
评估
调研方向
从 connection.fetch 入口点和复现的查询 select 'all' = any($1::text[]) 开始,然后将其在 Redshift 上的行为与报告中的 PostgreSQL Docker 镜像进行比较。确定语法错误是源自 asyncpg 还是 Redshift,并记录已确认的解决方法或兼容性限制。
由索引模型根据 Issue 内容生成。
描述
- asyncpg version: asyncpg==0.27.0.
- PostgreSQL version: PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.46987.
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: I am using Amazon Redshift. I could not reproduce the issue withpotgres:9.0Docker image. - Python version: Python 3.9.12.
- Platform: Windows 10 Pro, 22H2, 19045.2604.
- Do you use pgbouncer?: No.
- Did you install asyncpg with pip?: Yes.
- If you built asyncpg locally, which version of Cython did you use?: -
- Can the issue be reproduced under both asyncio and
uvloop?: Have not trieduvloop.
Running this snippet:
options = ConnectionOptions()
sslctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
sslctx.check_hostname = False
sslctx.verify_mode = ssl.CERT_NONE
connection = await asyncpg.connect(options.dsn, ssl=sslctx)
try:
query = "select 'all' = any($1::text[])"
await connection.fetch(query, ["all"])
finally:
await connection.close()
I get this exception:
asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "ORDER"
I am wondering, where the "syntax error at or near "ORDER" comes from, as there is no "ORDER" in the original query.
If asyncpg does not rewrite queries in any way, and the query passed to fetch is forwarded to the database without modification (https://github.com/MagicStack/asyncpg/issues/434#issuecomment-910474719, https://github.com/MagicStack/asyncpg/discussions/859#discussioncomment-1742492) - where does the "ORDER" come from?
Can this issue be worked around, or I should abandon asyncpg as a Redshift client? I do understand that Redshift is not officially supported, but this client is very good otherwise.
I was not able to reproduce the error with the postgres:9.0 instance (the oldest I was able to find quickly). The same (except ssl=False) snippet works without errors.
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 469
- 平均合并
- 4 天 1 小时
- 30 天内合并 PR
- 14
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/asyncpg 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
MagicStack/asyncpg#1371 ·
-
难度 3/5 1-2 天 新手友好度 72/100
MagicStack/asyncpg#1342 ·
-
难度 3/5 1-2 天 新手友好度 56/100
MagicStack/asyncpg#1340 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 28/100
MagicStack/asyncpg#1337 ·
-
难度 4/5 3-5 天 新手友好度 42/100
MagicStack/asyncpg#1330 · 1 条评论 ·
查看 MagicStack/asyncpg 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100