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

BUG: duckdb::data_t* duckdb::Allocator::AllocateData(duckdb::idx_t): Assertion `size > 0' failed #334

Open
OliverKillane opened this issue Jun 8, 2024 · 1 comment

Comments

@OliverKillane
Copy link

Issue

Failing on constraints referring to an enum's value.

Reproduce

Go to this repo, and cargo test

#[cfg(test)]
mod tests {
    use duckdb::{params, Connection};

    #[test]
    fn incorrect_behaviour() {
        let conn = Connection::open_in_memory().unwrap();
        conn.execute_batch(
            "
            CREATE TYPE MyEnum AS ENUM ('A');
            CREATE TABLE purchases (
                currency MyEnum NOT NULL,
                CHECK (
                    currency = 'A'
                )
            );
        ",
        )
        .unwrap();
        conn.execute(
            "
         INSERT INTO purchases (currency) VALUES ('A'::MyEnum)
        ",
            params![],
        )
        .unwrap();
    }

    #[test]
    fn correct_behaviour() {
        let conn = Connection::open_in_memory().unwrap();
        conn.execute_batch(
            "
            CREATE TYPE MyEnum AS ENUM ('A');
            CREATE TABLE purchases (
                currency MyEnum NOT NULL,
            );
        ",
        )
        .unwrap();
        conn.execute(
            "
         INSERT INTO purchases (currency) VALUES ('A'::MyEnum)
        ",
            params![],
        )
        .unwrap();
    }
}

Incorrect causes:

duckdb_allocator_size_0_assert-55c63b607dff2947: duckdb/src/common/allocator.cpp:122: duckdb::data_t* duckdb::Allocator::AllocateData(duckdb::idx_t): Assertion `size > 0' failed.
@carlopi
Copy link

carlopi commented Jun 13, 2024

Might be already fixed by duckdb/duckdb#12370 ?

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

2 participants