Re: [HACKERS] One-shot expanded output in psql using \gx

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: [HACKERS] One-shot expanded output in psql using \gx
Дата
Msg-id 20170208151214.GA8118@fetter.org
обсуждение исходный текст
Ответ на Re: [HACKERS] One-shot expanded output in psql using \gx  (Christoph Berg <christoph.berg@credativ.de>)
Ответы Re: [HACKERS] One-shot expanded output in psql using \gx  (Christoph Berg <christoph.berg@credativ.de>)
Список pgsql-hackers
On Wed, Feb 08, 2017 at 03:52:40PM +0100, Christoph Berg wrote:
> Re: David Fetter 2017-02-07 <20170207051659.GC3552@fetter.org>
> > On Mon, Feb 06, 2017 at 08:54:13PM +0100, Christoph Berg wrote:
> > > The majority of voices here was in favor of using \gx, so here is
> > > another version of the same patch which implements that.
> > 
> > Patch is useful, and works as documented.
> > 
> > Maybe it could get a test or two in src/test/regress/*/psql.*
> 
> Good point. The new version tests \g and \gx with a new query, and
> re-running it on the last query buffer.
>   
> !     /* \g [filename] -- send query, optionally with output to file/pipe */
> !     else if (strcmp(cmd, "g") == 0)
>       {
>           char       *fname = psql_scan_slash_option(scan_state,
>                                                      OT_FILEPIPE, NULL, false);
> --- 910,920 ----
>           free(fname);
>       }
>   
> !     /*
> !      * \g [filename] -- send query, optionally with output to file/pipe
> !      * \gx [filename] -- same as \g, with expanded mode forced
> !      */
> !     else if (strcmp(cmd, "g") == 0 || strcmp(cmd, "gx") == 0)
>       {
>           char       *fname = psql_scan_slash_option(scan_state,
>                                                      OT_FILEPIPE, NULL, false);
> *************** exec_command(const char *cmd,
> *** 924,929 ****
> --- 927,934 ----
>               pset.gfname = pg_strdup(fname);
>           }
>           free(fname);
> +         if (strcmp(cmd, "gx") == 0)
> +             pset.g_expanded = true;
>           status = PSQL_CMD_SEND;
>       }

Would you be open to saving the next person some work by doing
something similar to how \d is done, namely looking for an 'x'
modifier after g without regard to how far after?  As of this writing,
the \d version starts at line 398 in master.

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



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

Предыдущее
От: Christoph Berg
Дата:
Сообщение: Re: [HACKERS] One-shot expanded output in psql using \gx
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: [HACKERS] multivariate statistics (v19)