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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [HACKERS] One-shot expanded output in psql using \G
Дата
Msg-id CAKFQuwY7s9RAFy-05KH=ngQy-RYPfcWSuJBESkheTF0VFaw4yA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] One-shot expanded output in psql using \G  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: [HACKERS] One-shot expanded output in psql using \G  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
On Fri, Jan 27, 2017 at 8:31 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Alvaro Herrera (alvherre@2ndquadrant.com) wrote:
> D'Arcy Cain wrote:
>
> > I am a pretty heavy user of psql but I don't think that that would be so
> > helpful.  I assume you mean a new option, let's call it "\X" the causes the
> > next query to be expanded.  I type "\X" then a query.  I realize that I made
> > a mistake and have to redo the query so I have to type "\X" again.  If I
> > forget then I have to run the query yet again.
>
> I think the suggestion is that \G replaces \g (which is the same thing
> as the semicolon).  So you would do this:
>
> SELECT * FROM table WHERE table_status = 1; % get a short list; normal output
> SELECT * FROM table WHERE table_id = 123 \G % drill down to one ID

Uh, I figured it was more like \g, which just re-runs the last query..
As in, you'd do:

table pg_proc; % blargh, I can't read it like this
\G % ahh, much nicer

​This information surprised me.  It was unexpected that the last successfully executed query remains in the query buffer until the next SQL (and not meta) command is started.  I was expecting that as soon as result was returned to the screen the current query buffer would be cleared in preparation for the next query.​

A sentence or two describing this behavior (or, more generally the query buffer itself), probably placed at the end of the "Entering SQL Commands" section, would help to make this common knowledge.

David J.

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] One-shot expanded output in psql using \G
Следующее
От: Haribabu Kommi
Дата:
Сообщение: Re: [HACKERS] macaddr 64 bit (EUI-64) datatype support