Обсуждение: Absent output from psql

Поиск
Список
Период
Сортировка

Absent output from psql

От
John Gage
Дата:
This is a series of commands I issued to psql:

1) EFN=# \o aatest01.txt \i ./TestQuery01.txt
2) EFN=# \i ./TestQuery01.txt
3) EFN=# \p
4) select * from vocabulary_sources
;
5) EFN=# \g
6) EFN=# \p
7) select * from vocabulary_sources
;
8) EFN=# \echo yes man
9) yes man

I have numbered the lines for convenience only.

After I execute line 1), the results of the two queries contained in the TestQuery01.txt file can be found in aatest01.txt.  Good.  Excellent.

However, line 2) results in no output to any place I can discover.  Definitely not to the terminal screen I am typing in.

Nonetheless line 3) prints the query buffer on the screen.  And \echo prints what follows to the screen.

There seem to be two different STDOUT, one of which is in another dimension.

Please tell me what I am doing wrong.

Thanks very much,

John

Re: Absent output from psql

От
Nilesh Govindarajan
Дата:
On Sun, Feb 28, 2010 at 10:12 PM, John Gage <jsmgage@gmail.com> wrote:
This is a series of commands I issued to psql:

1) EFN=# \o aatest01.txt \i ./TestQuery01.txt
2) EFN=# \i ./TestQuery01.txt
3) EFN=# \p
4) select * from vocabulary_sources
;
5) EFN=# \g
6) EFN=# \p
7) select * from vocabulary_sources
;
8) EFN=# \echo yes man
9) yes man

I have numbered the lines for convenience only.

After I execute line 1), the results of the two queries contained in the TestQuery01.txt file can be found in aatest01.txt.  Good.  Excellent.

However, line 2) results in no output to any place I can discover.  Definitely not to the terminal screen I am typing in.

Nonetheless line 3) prints the query buffer on the screen.  And \echo prints what follows to the screen.

There seem to be two different STDOUT, one of which is in another dimension.

Please tell me what I am doing wrong.

Thanks very much,

John


You need to type \o without any parameters again after your job of getting the output in the file is over and you desire output on the screen.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

Re: Absent output from psql

От
Tom Lane
Дата:
John Gage <jsmgage@gmail.com> writes:
> 1) EFN=# \o aatest01.txt \i ./TestQuery01.txt
> 2) EFN=# \i ./TestQuery01.txt

> After I execute line 1), the results of the two queries contained in the
> TestQuery01.txt file can be found in aatest01.txt.  Good.  Excellent.
> However, line 2) results in no output to any place I can discover.

Doesn't it get appended to aatest01.txt?  My recollection is that \o's
effects persist till you reset it.  But it only affects query output,
not interactive commands like \p.

            regards, tom lane