SDB902[info]Engine
Dynamic SQL not analysed statically
DO blocks and EXECUTE strings can't be checked before running.
Why it's risky in PostgreSQL
Static rules can't see inside dynamic SQL. Execution evidence (locks, rewrites, timing) still applies.
What triggers it, and the safer way
DO $$ BEGIN EXECUTE 'ALTER TABLE ' || 'orders ADD COLUMN x int'; END $$;ALTER TABLE orders ADD COLUMN x int;Suppress it when you're sure
Put this comment on the line before the statement. The reason is required and shows in the report.
-- shadowdb:allow SDB902 <why this is safe here>Applies to PostgreSQL 14, 15, 16, 17.