I was unable to replicate a double call of the udf using the sql you provided.
Can you provide the original SQL (both for the INSERT and the CREATE TRIGGER) and the explain output (SQLite byte code, i.e .explain followed by explain <query>)? -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von no...@null.net Gesendet: Montag, 20. November 2017 11:53 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: [EXTERNAL] [sqlite] Possible User Defined Function (UDF) Bug? [ version: sqlite-snapshot-201711181730.tar.gz embedded in Perl's DBD::SQLite module. ] I have a user-defined function used as follows: CREATE TRIGGER after_insert_x AFTER INSERT ON x FOR EACH ROW BEGIN INSERT INTO y(id) VALUES( udf() ); END; What I am seeing is that for a row inserted into table y the udf() is called *twice*. This behaviour only seems to occur with the INSERT/VALUES combination. If I change the trigger contents to be the following then the udf is only called once: INSERT INTO y(id) SELECT udf() ; I'm having a hard time duplicating this with a standalone test case, and I'm also having difficulty with EXPLAIN QUERY PLAN returning no data for some statements... so I have a bit of a rabbit hole to explore before I can come back with more information. But perhaps someone else knows what might be going on? -- Mark Lawrence _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0 May be privileged. May be confidential. Please delete if not the addressee. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users