Re: [HACKERS] One-shot expanded output in psql using \gx - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: [HACKERS] One-shot expanded output in psql using \gx
Date
Msg-id 4d84079e-325b-48c5-83e6-bb54bb567bb1@manitou-mail.org
Whole thread Raw
In response to Re: [HACKERS] One-shot expanded output in psql using \gx  (Christoph Berg <christoph.berg@credativ.de>)
Responses Re: [HACKERS] One-shot expanded output in psql using \gx  (Christoph Berg <christoph.berg@credativ.de>)
List pgsql-hackers
Christoph Berg wrote:

> The new version tests \g and \gx with a new query, and
> re-running it on the last query buffer.

Thanks, here's a review:

The patch compiles and works as expected.

The code follows the same pattern as other one-shot command
modifiers, setting a flag in the global "pset" struct
in exec_command() and resetting it at the end of SendQuery().

- make installcheck-world: ok

- sgml doc: ok

- help text: ok

- includes regression tests: ok

- tab-completion: works but the list in tab-complete.c:backslash_commands[]
is sorted alphabetically so "\\gx" should come after "\\gset"

- another nitpick: in PrintQueryTuples() it assigns a bool:
+    /* one-shot expanded output requested via \gx */
+    if (pset.g_expanded)
+        my_popt.topt.expanded = true;
+

"expanded" is defined as a tri-valued short int (print.h:98): typedef struct printTableOpt {   //....   unsigned short
intexpanded;    /* expanded/vertical output (if supported 
by                 * output format); 0=no, 1=yes, 2=auto */
Although there is still code that puts true/false in this variable
(probably because it was a bool before?), I assume that for new
code, assigning 0/1/2 should be preferred.


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: [HACKERS] Two phase commit in ECPG
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Provide list of subscriptions and publications inpsql's completion