Skip to content

Cannot alter entry on valid(?) syntax #9713

@igitur

Description

@igitur

What happens?

My apologies if this isn't a bug, but I'm fairly sure that this SQL syntax should be valid.

The SQL statements mentioned below yields the error:

SQL Error: Dependency Error: Cannot alter entry "articles" because there are entries that depend on it.

To Reproduce

This is the typical pattern a schema generation script would follow, dropping entities if they exist and then recreating. Parent entities are handled first.

Removing the INDEX statements solves the error, but the index is required.

DROP TABLE IF EXISTS articles CASCADE;
CREATE TABLE articles (
    id              INTEGER PRIMARY KEY,
    uuid uuid       NOT NULL UNIQUE,
    title           TEXT NOT NULL UNIQUE,
    body            TEXT NOT NULL,
);

DROP INDEX IF EXISTS idx_articles_title; CREATE UNIQUE INDEX idx_articles_title ON articles(LOWER(title));

DROP TABLE IF EXISTS comments CASCADE;
CREATE TABLE comments (
    article_id         INTEGER REFERENCES articles(id) ,
    comment            TEXT NOT NULL,
);

OS:

x64

DuckDB Version:

64

DuckDB Client:

DuckDB CLI

Full Name:

Francois Botha

Affiliation:

Personal capacity - trying to add support for an embedded database to listmonk

Have you tried this on the latest main branch?

I have tested with a release build (and could not test with a main 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions