When using Redshift - PostgresSyntaxError: syntax error at or near "ORDER" - in query with no "ORDER"
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu với entry point connection.fetch và truy vấn được tái hiện select 'all' = any($1::text[]), sau đó so sánh hành vi của truy vấn này trên Redshift với hành vi trên PostgreSQL Docker image được báo cáo. Xác định liệu lỗi cú pháp bắt nguồn từ asyncpg hay Redshift, và ghi lại một workaround đã được xác nhận hoặc giới hạn tương thích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- 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.
- Ngôn ngữ chính
- Python
- Star
- 8.1k
- Fork
- 469
- Merge trung bình
- 2 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 9
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MagicStack/asyncpg
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MagicStack/asyncpg#1357 · 1 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
MagicStack/asyncpg#1342 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
MagicStack/asyncpg#1340 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 28/100
MagicStack/asyncpg#1337 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
MagicStack/asyncpg#1330 · 1 bình luận ·
Tất cả issue của MagicStack/asyncpg
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
huggingface/Repo2RLEnv#163 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·