postgres: only force a generic query plan where EXPLAIN is available (#4286)
The query macros set `plan_cache_mode = 'force_generic_plan'` on their describe connection (#3541) to keep nullability inference from being skewed by the NULL placeholder arguments. It was issued inside a `DO` block, which CockroachDB rejects at parse time -- `SET` inside a function body, SQLSTATE 0A000 -- breaking the query macros against CockroachDB since 0.9.0 (#4274). The setting only benefits the EXPLAIN-based inference, which already runs only when `is_explain_available()` is true (false for CockroachDB, Materialize and QuestDB). Gate the setting on that same check so it is never issued on a database that cannot use it, replacing the `pg_settings` probe with a `server_version_num() >= 12` guard.
B
Bastien Clément committed
1d674f51581598f55436451d5b4b73100cae0b56
Parent: ea7d589
Committed by GitHub <noreply@github.com>
on 7/2/2026, 11:44:07 PM