Not just Postgres extensions, most of Postgres’ own administrative functions can be triggered in SELECT statements. e.g. pg_terminate_backend()
https://www.postgresql.org/docs/current/functions-admin.html
https://www.postgresql.org/docs/current/functions-admin.html