tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
9.54k stars 252 forks source link

apply alter column command only to the table #1532

Closed sivukhin closed 2 months ago

sivukhin commented 2 months ago

Context

ALTER COLUMN doesn't work for tables with associated indices/triggers (for example https://github.com/tursodatabase/libsql/issues/1299) and failing with the error:

libsql> CREATE TABLE t(id);
libsql> CREATE INDEX i ON t(id);
libsql> ALTER TABLE t ALTER COLUMN id TO id;
Runtime error: error in adding id to t: Only ordinary tables can be altered, not indexes

But actually, since LibSQL only changes column "attributes" (not name) - this operation is safe and doesn't affect indices/triggers/etc in any way

Changes