duckdb / postgres_scanner

MIT License
194 stars 35 forks source link

update gp by duck:ERROR: multiple updates to a row by the same query is not allowed #226

Open wonb168 opened 2 months ago

wonb168 commented 2 months ago

my sql:

update gp.tenant_peacebird_biz.rst_ra_sku_org_detail a 
set compute_status='0'
    from tmp_distinct_order_id b
    where a.skc_order_id=b.skc_order_id
    and a.day_date = '2024-04-29' and a.is_deleted = '0';

raise error:

ERROR: duckdb.duckdb.Error: Failed to execute query "UPDATE "tenant_peacebird_biz"."rst_ra_sku_org_detail" 
SET "compute_status" = "update_data_63f7bf5c-4235-4a4b-8c40-ddbdf9382dfa"."compute_status" FROM "update_data_63f7bf5c-4235-4a4b-8c40-ddbdf9382dfa" WHERE "rst_ra_sku_org_detail".ctid=__page_id_string::TID":
 ERROR:  multiple updates to a row by the same query is not allowed  (seg0 172.18.10.106:33000 pid=61539) (plpy_elog.c:121)
  在位置:Traceback (most recent call last):
  PL/Python function "p_rst_ra_skc_org_detail", line 2743, in <module>
    exesql(sql) 
  PL/Python function "p_rst_ra_skc_org_detail", line 19, in exesql
    dd.execute(sql)
PL/Python function "p_rst_ra_skc_org_detail"

If I write the duck table into gp,and then run sql, it's OK:

update tenant_peacebird_biz.rst_ra_sku_org_detail a 
set compute_status='0'
    from tenant_peacebird_biz.tmp_id b
    where a.skc_order_id=b.skc_order_id
    and a.day_date = '2024-04-29' and a.is_deleted = '0';

why? and how to resolve?

OS: Centos7

Greenplum Version: 6.12 (pg:9.4)

DuckDB Version: 0.10.1

DuckDB Client: python

wonb168 commented 1 month ago

how to do?