Skip to content

Table created in the rollback-ed transaction is visible #180

Description

@dentiny

Hi team, I found when I'm using quack_query_by_name to execute query, it doesn't explicitly start a transaction at client and server side, so later ROLLBACK statement does execute.

Repro SQL statement

# name: test/sql/quack_query_by_name_rollback_repro.test
# description: quack_query_by_name should participate in the outer transaction rollback
# group: [sql]

require quack

require httpfs

statement ok con1
CALL quack_serve('quack:localhost', token='asdf');

statement ok con2
CREATE SECRET (TYPE quack, TOKEN 'asdf');

statement ok con2
ATTACH 'quack:localhost' AS rpc;

statement ok con2
BEGIN;

statement ok con2
CALL system.main.quack_query_by_name('rpc', 'CREATE TABLE rollback_bug(i INTEGER); INSERT INTO rollback_bug VALUES (42);');

statement ok con2
ROLLBACK;

# Refresh the attached catalog snapshot so we observe the remote server state.
statement ok con2
CALL quack_clear_cache();

# Correct behavior: table creation/insert should have rolled back remotely too.
statement error con2
SELECT * FROM rpc.rollback_bug;
----
Table with name rollback_bug does not exist

The error message that I get is

Query unexpectedly succeeded! (test/sql/quack_query_by_name_rollback_repro.test:32)!
================================================================================
SELECT * FROM rpc.rollback_bug;
================================================================================
i
INTEGER
[ Rows: 1]
42

The reason why I have to use quack_query_by_name instead of normal SQL statements is DuckLake does so.
I file an issue at DuckLake repo as well, along with some analysis: duckdb/ducklake#1267 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions