Re: pg_upgrade test chatter

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "Bossart, Nathan" <bossartn@amazon.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-10-20T01:55:31Z
Lists: pgsql-hackers
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/



Commits

  1. Improve pg_regress.c's infrastructure for issuing psql commands.