Krikri::PluginHelpers::PostgresqlQueryHeuristics
PostgresqlQueryHeuristics - pure logic for postgresql_query (see plugins/postgresql_query.cr): the changed-determination the real module performs on psycopg's statusmessage (it cannot see row counts for SELECT either - anything whose command tag is not SELECT/SHOW counts as a change), and psycopg %(name)s named-arg expansion down to positional binds (crystal-pg has no named-arg binding).
Class methods
JSON::Any bind value down to crystal-pg's accepted set - JSON numbers are always Float64-or-Int64 from parse; keep everything else as its rendered string (matching the module's own string passthrough for arrays etc.).
The real module's rule, applied to the synthesized command tag: SELECT/SHOW never report changed; UPDATE/INSERT/DELETE report changed only when the affected-row count is non-zero (its "len(s) == 2/3" checks); anything else (CREATE, DROP, ALTER, TRUNCATE, SET, ...) always reports changed.
Rewrites psycopg-style %(name)s placeholders to $N binds and returns the values in that order. Names appearing repeatedly reuse their position. Raises on a name missing from the dict - real psycopg raises "KeyError" equivalently.