Skip to content

ALTER SEQUENCE can be misclassified as a DuckDB table when duckdb access method OID is InvalidOid (0) #1035

@xingyingone

Description

@xingyingone

What happens?

When pg_duckdb is loaded but the duckdb table access method is not present in pg_am (and/or CREATE EXTENSION pg_duckdb was not run in the current database), ALTER SEQUENCE ... may incorrectly
go through the DuckDB-table path in the DDL hook.

To Reproduce

DROP EXTENSION pg_duckdb;
DROP SEQUENCE IF EXISTS public.alex_orders_order_id_seq CASCADE;
CREATE SEQUENCE public.alex_orders_order_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;

BEGIN;
CREATE EXTENSION IF NOT EXISTS pg_duckdb;
ALTER SEQUENCE public.orders_order_id_seq OWNER TO "xingying.1024";  

 ERROR: (PGDuckDB/DuckdbUtilityHook_Cpp) Not implemented Error: Writing to DuckDB and Postgres tables in the same transaction block is not supported

ROLLBACK;

OS:

debian10

pg_duckdb Version (if built from source use commit hash):

dafe12d

Postgres Version (if built from source use commit hash):

17

Hardware:

No response

Full Name:

ying xing

Affiliation:

bytedance

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

Did you include all relevant data sets for reproducing the issue?

No - Other reason (please specify in the issue body)

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions