Re: Added schema level support for publication.

Поиск
Список
Период
Сортировка
От Greg Nancarrow
Тема Re: Added schema level support for publication.
Дата
Msg-id CAJcOf-cE5vmF=Gq=OHGznxKcMsaN1unVCd3egYw3tkSfg3KVhw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Added schema level support for publication.  (vignesh C <vignesh21@gmail.com>)
Ответы Re: Added schema level support for publication.  (vignesh C <vignesh21@gmail.com>)
Список pgsql-hackers
On Mon, Sep 27, 2021 at 2:32 PM vignesh C <vignesh21@gmail.com> wrote:
>
> Attached v33 patch has the preprocess_pubobj_list review comment fix
> suggested by Alvaro at [1].

A minor point I noticed in the v33-0002 patch, in the code added to
the listSchemas() function of src/bin/psql/describe.c, shouldn't it
"return false" (not true) if PSQLexec() fails?
Also, since the PQExpBufferData buf is re-used in the added code, it's
handling is a little inconsistent to similar existing code.
See below for suggested update.

Regards,
Greg Nancarrow
Fujitsu Australia


diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 953e1f52cf..1d28809050 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -5077,9 +5077,11 @@ listSchemas(const char *pattern, bool verbose,
bool showSystem)
     appendPQExpBufferStr(&buf, "ORDER BY 1;");

     res = PSQLexec(buf.data);
-    termPQExpBuffer(&buf);
     if (!res)
+    {
+        termPQExpBuffer(&buf);
         return false;
+    }

     myopt.nullPrint = NULL;
     myopt.title = _("List of schemas");
@@ -5100,7 +5102,10 @@ listSchemas(const char *pattern, bool verbose,
bool showSystem)
                           pattern);
         result = PSQLexec(buf.data);
         if (!result)
-            return true;
+        {
+            termPQExpBuffer(&buf);
+            return false;
+        }
         else
             pub_schema_tuples = PQntuples(result);

@@ -5132,6 +5137,7 @@ listSchemas(const char *pattern, bool verbose,
bool showSystem)

     printQuery(res, &myopt, pset.queryFout, false, pset.logfile);

+    termPQExpBuffer(&buf);
     PQclear(res);

     /* Free the memory allocated for the footer */



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Timeout failure in 019_replslot_limit.pl
Следующее
От: Jean-Christophe Arnu
Дата:
Сообщение: Re: Empty string in lexeme for tsvector