pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: Fujii Masao <fujii@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Make VACUUM accept 1 and 0 as a boolean value.
Date: Tue, 21 May 2019 10:20:57 -0400
Message-ID: <15696.1558448457@sss.pgh.pa.us> (raw)
In-Reply-To: <20190521004717.qsktdsugj3shagco@alap3.anarazel.de>
References: <26460.1558366996@sss.pgh.pa.us>
	<CAHGQGwEvM9X66Ni4OKv4dOQQddw7z=cNUxnG=wEv84sqj9t_ig@mail.gmail.com>
	<20190520163652.l7ibpe52pbq6lecc@alap3.anarazel.de>
	<CAHGQGwEixkoMJy4JHUvBdM0MacR1_h=wmE43KTOTErpA2Z5P0w@mail.gmail.com>
	<20190520164908.t653bdbfjcn3d35p@alap3.anarazel.de>
	<23559.1558374415@sss.pgh.pa.us>
	<20190520180027.zyxosts5yrf2i7mh@alap3.anarazel.de>
	<24497.1558375780@sss.pgh.pa.us>
	<20190520203505.zoeitjlehqypgx26@alap3.anarazel.de>
	<21766.1558397960@sss.pgh.pa.us>
	<20190521004717.qsktdsugj3shagco@alap3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> On 2019-05-20 20:19:20 -0400, Tom Lane wrote:
>> The other thing I had to do below was to suppress "NOTICE: database
>> "regression" does not exist, skipping".  The added createdb is a
>> mighty expensive and grotty way to do that, but I didn't immediately
>> see a better one.

> Hm. Perhaps we ought to just have pg_regress set client_min_messages to
> something less noisy when running DROP DATABASE? I don't think any
> pg_regress caller benefits from having it.

The least invasive way to do that seems to be as attached, building a
little knowledge into pg_regress's psql_command() function.  Alternatively
we could add a "bool quiet" parameter to that function so that callers
had to say what to do, but I'm not sure that's an improvement.

			regards, tom lane

Attachments:

suppress-if-exists-noise-in-pg_regress-1.patch (text/x-diff, 1.1K) download diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index a1a3d48..57a154c 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1087,6 +1087,7 @@ psql_command(const char *database, const char *query,...) char query_formatted[1024]; char query_escaped[2048]; char psql_cmd[MAXPGPATH + 2048]; + const char *quiet; va_list args; char *s; char *d; @@ -1106,11 +1107,23 @@ psql_command(const char *database, const char *query,...) } *d = '\0'; + /* + * If the query uses IF EXISTS or IF NOT EXISTS, suppress useless + * "skipping" notices. We intentionally consider only the constant + * "query" string, not what was interpolated into it. + */ + if (strstr(query, "IF EXISTS") != NULL || + strstr(query, "IF NOT EXISTS") != NULL) + quiet = " -c \"SET client_min_messages = warning\""; + else + quiet = ""; + /* And now we can build and execute the shell command */ snprintf(psql_cmd, sizeof(psql_cmd), - "\"%s%spsql\" -X -c \"%s\" \"%s\"", + "\"%s%spsql\" -X%s -c \"%s\" \"%s\"", bindir ? bindir : "", bindir ? "/" : "", + quiet, query_escaped, database); =

view thread (21+ messages)  latest in thread

Message-ID: <15696.1558448457@sss.pgh.pa.us>
Permalink:  ../15696.1558448457@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15696.1558448457@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, peter_e@gmx.net, michael.paquier@gmail.com, masao.fujii@gmail.com, fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make VACUUM accept 1 and 0 as a boolean value.
  In-Reply-To: <15696.1558448457@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox