title: Can't prevent Trigger recursion in Android Room Database
body: <p>I've been unable to prevent recursive triggers in my room database. I am trying to update a column is_updated in my RecipeEntity table to false whenever RecipeEntity has a value change through an Update trigger.</p>
  <pre><code>                // prevent recursion
                  db.execSQL(&quot;PRAGMA recursive_triggers = OFF;&quot;);
  
                  // create recipe trigger to update is_updated to false every time recipe is updated
                  db.execSQL(&quot;CREATE TRIGGER is_updated_trigger BEFORE UPDATE&quot; +
                          &quot;       ON RecipeEntity&quot; +
                          &quot;       BEGIN&quot; +
                          &quot;           UPDATE RecipeEntity SET is_updated=false&quot; +
                          &quot;           WHERE recipeId = NEW.recipeId; &quot; +
                          &quot;       END; &quot;); 
  </code></pre>
  <p>This is called on database creation through onCreate using RoomDatabase.Callback();</p>
  <p>The Query to update the RecipeEntity is just a normal Room @Update method.</p>
  <p><strong>Error message:</strong></p>
  <pre><code>2021-05-25 15:03:07.422 4668-4821/com.habbybolan.groceryplanner E/SQLiteLog: (1) statement aborts at 64: [UPDATE OR ABORT `RecipeEntity` SET `recipeId` = ?,`onlineRecipeId` = ?,`name` = ?,`is_favorite` = ?,`description` = ?,`prep_time` = ?,`cook_time` = ?,`serving_size` = ?,`calories` = ?,
      
      
      --------- beginning of crash
  2021-05-25 15:03:07.429 4668-4821/com.habbybolan.groceryplanner E/AndroidRuntime: FATAL EXCEPTION: Thread-3
      Process: com.habbybolan.groceryplanner, PID: 4668
      android.database.sqlite.SQLiteException: too many levels of trigger recursion (code 1 SQLITE_ERROR)
          at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
          at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:890)
          at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:756)
          at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:66)
          at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeUpdateDelete(FrameworkSQLiteStatement.java:46)
          at androidx.room.EntityDeletionOrUpdateAdapter.handle(EntityDeletionOrUpdateAdapter.java:70)
          at com.habbybolan.groceryplanner.database.dao.RecipeDao_Impl.updateRecipes(RecipeDao_Impl.java:531)
          at com.habbybolan.groceryplanner.database.DatabaseAccessImpl.lambda$updateRecipe$14$DatabaseAccessImpl(DatabaseAccessImpl.java:427)
          at com.habbybolan.groceryplanner.database.-$$Lambda$DatabaseAccessImpl$3OxencYWN3idP4iK5ncgMxJDuQc.run(Unknown Source:4)
          at java.lang.Thread.run(Thread.java:923)
  2021-05-25 15:03:07.453 1017-1023/? E/statsd: Predicate 5980654721335871649 dropping data for dimension key (10)0x2010101-&gt;10361[I] (10)0x30000-&gt;*launch*[S] 
  2021-05-25 15:03:07.488 1620-2075/? E/InputDispatcher: channel '99b1b43 Toast (server)' ~ Channel is unrecoverably broken and will be disposed!
  </code></pre>
  <p>For some reason, when I download the database from the device and run it inside the DB Browser software it works fine without causing any trigger recursion. It seems like something specifically with Room perhaps?</p>
  <p>Any insight would be greatly appreciated. Thank you for you help.</p>