More on the same tune. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "This is what I like so much about PostgreSQL. Most of the surprises are of the "oh wow! That's cool" Not the "oh shit!" kind. :)" Scott Marlowe, http://archives.postgresql.org/pgsql-admin/2008-10/msg00152.php
>From 5e031fadc778365491f9e58da83a4b64f21e3bcd Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvhe...@alvh.no-ip.org> Date: Wed, 20 Jul 2022 10:04:27 +0200 Subject: [PATCH] More goto error_return in describe.c
--- src/bin/psql/describe.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 77b0f87e39..46999f26f2 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -1129,19 +1129,13 @@ permissionsList(const char *pattern) "n.nspname", "c.relname", NULL, "n.nspname !~ '^pg_' AND pg_catalog.pg_table_is_visible(c.oid)", NULL, 3)) - { - termPQExpBuffer(&buf); - return false; - } + goto error_return; appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); res = PSQLexec(buf.data); if (!res) - { - termPQExpBuffer(&buf); - return false; - } + goto error_return; myopt.nullPrint = NULL; printfPQExpBuffer(&buf, _("Access privileges")); @@ -1155,6 +1149,10 @@ permissionsList(const char *pattern) termPQExpBuffer(&buf); PQclear(res); return true; + +error_return: + termPQExpBuffer(&buf); + return false; } @@ -4983,19 +4981,13 @@ listSchemas(const char *pattern, bool verbose, bool showSystem) NULL, "n.nspname", NULL, NULL, NULL, 2)) - { - termPQExpBuffer(&buf); - return false; - } + goto error_return; appendPQExpBufferStr(&buf, "ORDER BY 1;"); res = PSQLexec(buf.data); if (!res) - { - termPQExpBuffer(&buf); - return false; - } + goto error_return; myopt.nullPrint = NULL; myopt.title = _("List of schemas"); @@ -5016,10 +5008,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem) pattern); result = PSQLexec(buf.data); if (!result) - { - termPQExpBuffer(&buf); - return false; - } + goto error_return; else pub_schema_tuples = PQntuples(result); @@ -5066,6 +5055,10 @@ listSchemas(const char *pattern, bool verbose, bool showSystem) } return true; + +error_return: + termPQExpBuffer(&buf); + return false; } -- 2.30.2