MagicStack / MagicStack/asyncpg

text encoding of composite types error with schema and table name.

Đang mở
#779 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
8.1k
Fork
468
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

  • asyncpg version: 0.23.0
  • PostgreSQL version: 10.13
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : No. I ran PG on local machine.
  • Python version: 3.8.2
  • Platform: MacOs catalina 10.15.7
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Yes
  • If you built asyncpg locally, which version of Cython did you use?: No
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : Not tried

Hello!

I have table with ltree column:

create table product
(
    product_id    varchar(18)                                    not null
        constraint product_pkey
            primary key,
    category_path ltree
);

And trying execute this SQL query:

    insert into product
    (product_id, category_path)
    (select  r.product_id, r.category_path from unnest($1::product[]) as r)

Args:

[[{'category_path': 'A.B', 'product_id': '3912331'}]]

And i get this error:

File "/venv/lib/python3.8/site-packages/asyncpg/pool.py", line 530, in execute
    return await con.execute(query, *args, timeout=timeout)
  File "/venv/lib/python3.8/site-packages/asyncpg/connection.py", line 299, in execute
    _, status, _ = await self._execute(
  File "/venv/lib/python3.8/site-packages/asyncpg/connection.py", line 1623, in _execute
    result, _ = await self.__execute(
  File "/venv/lib/python3.8/site-packages/asyncpg/connection.py", line 1648, in __execute
    return await self._do_execute(
  File "/venv/lib/python3.8/site-packages/asyncpg/connection.py", line 1675, in _do_execute
    stmt = await self._get_statement(
  File "/venv/lib/python3.8/site-packages/asyncpg/connection.py", line 392, in _get_statement
    settings.register_data_types(types)
  File "asyncpg/protocol/settings.pyx", line 35, in asyncpg.protocol.protocol.ConnectionSettings.register_data_types
  File "asyncpg/protocol/settings.pyx", line 36, in asyncpg.protocol.protocol.ConnectionSettings.register_data_types
  File "asyncpg/protocol/codecs/base.pyx", line 506, in asyncpg.protocol.protocol.DataCodecConfig.add_types
  File "asyncpg/protocol/codecs/base.pyx", line 371, in asyncpg.protocol.protocol.Codec.new_composite_codec
  File "asyncpg/protocol/codecs/base.pyx", line 76, in asyncpg.protocol.protocol.Codec.init
asyncpg.exceptions._base.UnsupportedClientFeatureError: cannot decode type "public"."product": text encoding of composite types is not supported

But "public"."product" -- it's schema and table name.

If i create new table with category_path = text instead ltree, all ok.

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện truy vấn sử dụng cột ltree và kiểu sản phẩm composite, sau đó kiểm tra asyncpg/protocol/settings.pyx và asyncpg/protocol/codecs/base.pyx, là những tệp xuất hiện trong traceback. Theo dõi việc đăng ký kiểu composite và xác minh rằng hành vi đã được sửa cho trường hợp này mà không làm hỏng việc xử lý các kiểu composite hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
postgresql, python
Lĩnh vực
databases
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.