- 
                Notifications
    You must be signed in to change notification settings 
- Fork 142
Open
Milestone
Description
What happens?
With duckdb.force_execution set to TRUE, this query crashes user backend:
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;
$$; Result:
psql:orig.sql:18: 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
psql:orig.sql:18: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
psql:orig.sql:18: error: connection to server was lostThis seems to be happening only in PostgreSQL 17+ versions due to this change that treats any error in subtransaction as fatal.
In PostgreSQL 16, for instance, we won't get backend crash:
ERROR:  (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 
This may look as expected behavior in PostgreSQL 17+, the question is if we really want to get backend crashed in these situations or we may find some way to handle unsupported SAVEPOINTS without causing backend crash.
To Reproduce
- Start a fresh server with pg_duckdb and duckdb.force_executionset to TRUE
- Run this query:
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;
$$; - Get a backend crash
OS:
Linux
pg_duckdb Version (if built from source use commit hash):
Postgres Version (if built from source use commit hash):
17
Hardware:
No response
Full Name:
Jora Babayan
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?
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
Labels
No labels