Issue altering table name

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue altering table name

Luke Amery-2
Hi sqliters,

Is this a bug?

sqlite> SELECT sqlite_version();
3.25.1
sqlite> CREATE TABLE x(f1 integer NOT NULL PRIMARY KEY);
sqlite> CREATE VIEW y AS SELECT f1 AS f1 FROM x;
sqlite> CREATE TRIGGER t INSTEAD OF UPDATE OF f1 ON y BEGIN UPDATE x SET f1
= NEW.f1; END;
sqlite> CREATE TABLE z (f1 integer NOT NULL PRIMARY KEY);
sqlite> ALTER TABLE z RENAME TO z2;
Error: error in trigger t: no such column: NEW.f1

My expectation is the new alter table logic would notice this is an instead
of trigger where NEW has special significance and not block my attempt to
rename an unrelated table.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Issue altering table name

Dan Kennedy-4
On 09/30/2018 06:59 PM, Luke Amery wrote:

> Hi sqliters,
>
> Is this a bug?
>
> sqlite> SELECT sqlite_version();
> 3.25.1
> sqlite> CREATE TABLE x(f1 integer NOT NULL PRIMARY KEY);
> sqlite> CREATE VIEW y AS SELECT f1 AS f1 FROM x;
> sqlite> CREATE TRIGGER t INSTEAD OF UPDATE OF f1 ON y BEGIN UPDATE x SET f1
> = NEW.f1; END;
> sqlite> CREATE TABLE z (f1 integer NOT NULL PRIMARY KEY);
> sqlite> ALTER TABLE z RENAME TO z2;
> Error: error in trigger t: no such column: NEW.f1
>
> My expectation is the new alter table logic would notice this is an instead
> of trigger where NEW has special significance and not block my attempt to
> rename an unrelated table.

Thanks for reporting this one. Now fixed here:

   https://www.sqlite.org/src/info/c52f457e56eb9d57

Dan.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users