Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hT5dh-0007ft-Ap for pgsql-committers@arkaria.postgresql.org; Tue, 21 May 2019 14:21:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hT5de-0007sJ-U0 for pgsql-committers@arkaria.postgresql.org; Tue, 21 May 2019 14:21:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hT5de-0007on-Ks for pgsql-committers@lists.postgresql.org; Tue, 21 May 2019 14:21:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hT5dc-0000mH-DH; Tue, 21 May 2019 14:21:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4LEKvIA015697; Tue, 21 May 2019 10:20:57 -0400 From: Tom Lane To: Andres Freund cc: Peter Eisentraut , Michael Paquier , Fujii Masao , Fujii Masao , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Make VACUUM accept 1 and 0 as a boolean value. In-reply-to: <20190521004717.qsktdsugj3shagco@alap3.anarazel.de> References: <26460.1558366996@sss.pgh.pa.us> <20190520163652.l7ibpe52pbq6lecc@alap3.anarazel.de> <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> Comments: In-reply-to Andres Freund message dated "Mon, 20 May 2019 17:47:17 -0700" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <15651.1558448374.0@sss.pgh.pa.us> Date: Tue, 21 May 2019 10:20:57 -0400 Message-ID: <15696.1558448457@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15651.1558448374.1@sss.pgh.pa.us> Andres Freund 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 ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="suppress-if-exists-noise-in-pg_regress-1.patch"; charset="us-ascii" Content-ID: <15651.1558448374.2@sss.pgh.pa.us> Content-Description: suppress-if-exists-noise-in-pg_regress-1.patch Content-Transfer-Encoding: quoted-printable 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 *que= ry,...) } *d =3D '\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") !=3D NULL || + strstr(query, "IF NOT EXISTS") !=3D NULL) + quiet =3D " -c \"SET client_min_messages =3D warning\""; + else + quiet =3D ""; + /* 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); = ------- =_aaaaaaaaaa0--