Within a trigger body, a reference to new.oid is always interpreted as a reference to the rowid. However, if there is an explicitly declared column named "oid", then "new.oid" should refer to the explicit column. Example:
<verbatim>
SQLite version 3.6.21
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE foo(k INTEGER PRIMARY KEY, oid INTEGER);
sqlite> CREATE TABLE log(a, b);
sqlite>
sqlite> CREATE TRIGGER tr1 AFTER INSERT ON foo BEGIN
...> INSERT INTO log VALUES(new.k, new.oid);
...> END;
sqlite> INSERT INTO foo VALUES(100, 200);
sqlite> SELECT a, b FROM log;
100|100
</verbatim>
The result of the above SELECT should be "100|200".
<hr><i>dan added on 2009-12-30 07:41:28:</i><br>
Dup of [34d2ae1c6d].
|