On 2021-Oct-19, Tom Lane wrote: > I tried doing this as a one-liner change in pg_regress's > drop_database_if_exists(), but the idea fell over pretty > quickly, because what underlies that is a "psql -c" call: > > $ psql -c 'set client_min_messages = warning; drop database if exists foo' > ERROR: DROP DATABASE cannot run inside a transaction block > > We could dodge that, with modern versions of psql, by issuing > two -c switches.
Isn't it easier to pass client_min_messages via PGOPTIONS? PGOPTIONS="-c client_min_messages=warning" psql -c "drop database if exists foo" -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/