duckdb icon indicating copy to clipboard operation
duckdb copied to clipboard

ALTER TABLE ALTER column dependency error

Open ankrgyl opened this issue 7 months ago • 3 comments

What happens?

alterting a column without an index on a table with a unique key returns an error

To Reproduce

duckdb> create table t (id int, j json);
┌┐
└┘

duckdb> create unique index if not exists foo on t (id);
┌┐
└┘

duckdb> ALTER TABLE t ALTER j TYPE USING struct_pack(a := 0.5);
Dependency Error: Cannot alter entry "t" because there are entries that depend on it.

OS:

anything

DuckDB Version:

1.2.2

DuckDB Client:

wasm

Hardware:

No response

Full Name:

Ankur Goyal

Affiliation:

Braintrust

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • [x] Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • [x] Yes, I have

ankrgyl avatar May 03 '25 19:05 ankrgyl

Thanks for the report, this is unfortunately an expected limitation currently, because we don't have dependencies on columns, only tables. Since the table is referenced by the index, it can't be altered.

Tishj avatar May 19 '25 11:05 Tishj

same problem!

Yurunsoft avatar May 29 '25 08:05 Yurunsoft