pg_duckdb icon indicating copy to clipboard operation
pg_duckdb copied to clipboard

FATAL: (...) Not implemented Error: SAVEPOINT is not supported in DuckDB

Open saygoodbyye opened this issue 6 months ago • 4 comments

What happens?

PostgreSQL configure options:

CPPFLAGS="-O2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=nonnull-attribute -fstack-protector" LDFLAGS='-fsanitize=address -fsanitize=undefined -static-libasan' ./configure --enable-crash-info --enable-tap-tests --with-openssl --enable-debug --enable-cassert --with-icu --with-lz4 --with-libxml --quiet --prefix="$PGPREFIX"
export ASAN_OPTIONS=detect_stack_use_after_return=0:detect_leaks=0:abort_on_error=1:disable_coredump=0:strict_string_checks=1:check_initialization_order=1:strict_init_order=1:detect_odr_violation=0

To Reproduce

I catch FATAL error when executing query from Postgres's src/test/regress/sql/object_address.sql test: postgresql.conf:

shared_preload_libraries='pg_duckdb'
duckdb.force_execution = true
duckdb.postgres_role = 'duckdb_group'
log_temp_files = -1

test.sql:

CREATE EXTENSION pg_duckdb;

DO $$
DECLARE
    objtype text;
BEGIN
    FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'),
        ('toast table column'), ('view column'), ('materialized view column')
    LOOP
        BEGIN
            PERFORM pg_get_object_address(objtype, '{one}', '{}');
        EXCEPTION WHEN invalid_parameter_value THEN
            RAISE WARNING 'error for %: %', objtype, sqlerrm;
        END;
    END LOOP;
END;
$$;

The result:

test=# CREATE EXTENSION pg_duckdb;
DO $$
DECLARE
    objtype text;
BEGIN
    FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'),
        ('toast table column'), ('view column'), ('materialized view column')
    LOOP
        BEGIN
            PERFORM pg_get_object_address(objtype, '{one}', '{}');
        EXCEPTION WHEN invalid_parameter_value THEN
            RAISE WARNING 'error for %: %', objtype, sqlerrm;
        END;
    END LOOP;
END;
$$;
CREATE EXTENSION
FATAL:  (PGDuckDB/DuckdbSubXactCallback_Cpp) Not implemented Error: SAVEPOINT is not supported in DuckDB
CONTEXT:  PL/pgSQL function inline_code_block line 8 during statement block entry
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.

OS:

Debian-12

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

49cd67618e683a15404f9edd78e2b4e79b401547

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

002938f15c63a52bfb191dce9496486a4bbfb757

Hardware:

No response

Full Name:

Egor Chindyaskin

Affiliation:

Postgres Professional

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

I have tested with a source build

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

Yes

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

saygoodbyye avatar Jun 05 '25 12:06 saygoodbyye

This is a duplicate of https://github.com/duckdb/pg_duckdb/issues/761. We have a PR opened for it, will try to fix ASAP

Y-- avatar Jun 05 '25 12:06 Y--

@Y-- , Hello! Are there any news on this ticket?

saygoodbyye avatar Nov 11 '25 11:11 saygoodbyye

@Y--, Hello! Found another way to reproduce the error, might be useful for testing!

CREATE EXTENSION pg_duckdb;

CREATE TABLE tenk1 (
        unique1         int4,
        unique2         int4,
        two                     int4,
        four            int4,
        ten                     int4,
        twenty          int4,
        hundred         int4,
        thousand        int4,
        age                     int4,
        location        point
);


begin;
select count((unique1)) from tenk1
where hundred = any ((select array_agg(i) from generate_series(1, 100, 15) i)::int[]);

DO $$
BEGIN
 SET effective_io_concurrency = 50;
EXCEPTION WHEN invalid_parameter_value THEN
END $$;
FATAL:  (PGDuckDB/DuckdbSubXactCallback_Cpp) Not implemented Error: SAVEPOINT is not supported in DuckDB
CONTEXT:  PL/pgSQL function inline_code_block line 2 during statement block entry
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.

saygoodbyye avatar Nov 18 '25 07:11 saygoodbyye

Thanks @saygoodbyye. I haven't gotten a chance to come back to this one. I'll make sure to discuss this with @JelteF in the next few weeks.

Y-- avatar Nov 18 '25 13:11 Y--