From http://www.sqlite.org/c3ref/last_insert_rowid.html:

"If an INSERT occurs within a trigger, then the rowid of the inserted
row is returned by this routine as long as the trigger is running. But
once the trigger terminates, the value returned by this routine
reverts to the last value inserted before the trigger fired."

Your insert definitely happens in the trigger, so no access to rowid outside.


Pavel

On Tue, Mar 30, 2010 at 7:29 AM, Alexey Pechnikov
<pechni...@mobigroup.ru> wrote:
> Hello!
>
> CREATE TABLE test (
>  id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
> );
> CREATE VIEW view_test as select * from test;
> CREATE TRIGGER view_test_insert instead of insert on view_test
> begin
>  insert into test (id) values (NULL);
> end;
>
> insert into view_test (id) values (NULL);
> select last_insert_rowid();
> 0
> select max(rowid) from test;
> 1
>
> insert into view_test default values;
> Segmentation error
>
>
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to