Interesting study: Leaky Forms

The issue is quite clearly with the order of the statements, as yubiuser has pointed out.

The script issues statements that must fail because executing them would violate a foreign key constraint. In any database that honors foreign key constraints, those constraints must be kept, or your database may become corrupted.

The reason why this works with different versions of SQLite3 is that the internal, SQLite3-specific PRAGMA foreign_keys that controls whether those constraints are honored may have a different default value in different versions, and that default value may even differ for the same SQLite3 version, depending on the actual compile time options used.

You could decide to add PRAGMA foreign_keys = OFF; to your personal script, but it wouldn't be a good idea to have Pi-hole simply gloss over this to allow arbitrary statements to complete when they would be expected to fail.

As SQL as a language would not target a specific database implementation, the whotracks.me maintainers should adopt their script to the order that would be required for a successful completion within a database system with active foreign constraints.

EDIT: I've added a respective comment to the whotracks.me issue.

1 Like