Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSERT .. SELECT .. UNION crashes JVM when run from JDBC #13

Open
1 task done
lukaseder opened this issue Mar 26, 2024 · 0 comments
Open
1 task done

INSERT .. SELECT .. UNION crashes JVM when run from JDBC #13

lukaseder opened this issue Mar 26, 2024 · 0 comments

Comments

@lukaseder
Copy link

lukaseder commented Mar 26, 2024

What happens?

I can crash the JVM with an INSERT .. SELECT .. UNION statement if there's a DEFAULT NEXTVAL('sequence') expression on the primary key

To Reproduce

try (Connection c = DriverManager.getConnection("jdbc:duckdb:c:/temp/duckdb");
    Statement s = c.createStatement()
) {
    s.executeUpdate("drop table if exists t");
    s.executeUpdate("drop sequence if exists s");
    s.executeUpdate("create sequence s");
    s.executeUpdate("create table t (id integer default nextval('s'), val int, primary key (id))");

    for (int i = 0; i < 100; i++) {
        System.out.println(i);
        s.executeUpdate("insert into t (val) select 41 union select 42");
    }
}

This prints something like this:

Exception in WAL playback: Duplicate key "id: 27" violates primary key constraint. If this is an unexpected constraint violation please double check with the known index limitations section in our documentation (https://duckdb.org/docs/sql/indexes).
0
1
2
3
4
5
6
7
8
9
10
11
12
13

Or:

Exception in WAL playback: Duplicate key "id: 27" violates primary key constraint. If this is an unexpected constraint violation please double check with the known index limitations section in our documentation (https://duckdb.org/docs/sql/indexes).
0
1
2
3
4
5

And then stops silently, i.e. there's no crash log or stack trace, so the JVM might as well have exited "normally."

These statement don't reproduce the problem of the crash, though the "Exception in WAL playback" message persists:

insert into t (val) select 41 union all select 42;
insert into t (val) values (41), (42);

Though that "WAL playback" error might as well be unrelated. I've tried adding Thread.sleep(100L); in the loop, which makes the "WAL playback" error disappear, but the JVM still stops.

OS:

Microsoft Windows [Version 10.0.22631.3296]

DuckDB Version:

0.10.0

DuckDB Client:

JDBC

Full Name:

Lukas Eder

Affiliation:

Data Geekery

Have you tried this on the latest nightly build?

I have tested with a release build (and could not test with a nightly build)

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have
@hannes hannes transferred this issue from duckdb/duckdb May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant