Should \o mean "everything?"

Started by David Fetterover 10 years ago5 messages
#1David Fetter
david@fetter.org

Folks,

In a failed attempt to send the output of \pset to a pipe, I noticed
that for reasons I find difficult to explain, not every output gets
redirected with \o.

At first blush, I'd consider this inconsistency as a bug.

What have I missed?

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

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Kevin Grittner
kgrittn@ymail.com
In reply to: David Fetter (#1)
Re: Should \o mean "everything?"

David Fetter <david@fetter.org> wrote:

In a failed attempt to send the output of \pset to a pipe, I
noticed that for reasons I find difficult to explain, not every
output gets redirected with \o.

At first blush, I'd consider this inconsistency as a bug.

What have I missed?

The documentation says:

| Arranges to save future query results to the file filename or
| pipe future results to the shell command command. If no argument
| is specified, the query output is reset to the standard output.
|
| "Query results" includes all tables, command responses, and
| notices obtained from the database server, as well as output of
| various backslash commands that query the database (such as \d),
| but not error messages.

Are you seeing anything inconsistent with the documentation? If
so, what?

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3David Fetter
david@fetter.org
In reply to: Kevin Grittner (#2)
Re: Should \o mean "everything?"

On Mon, Aug 31, 2015 at 07:18:02PM +0000, Kevin Grittner wrote:

David Fetter <david@fetter.org> wrote:

In a failed attempt to send the output of \pset to a pipe, I
noticed that for reasons I find difficult to explain, not every
output gets redirected with \o.

At first blush, I'd consider this inconsistency as a bug.

What have I missed?

The documentation says:

| Arranges to save future query results to the file filename or
| pipe future results to the shell command command. If no argument
| is specified, the query output is reset to the standard output.
|
| "Query results" includes all tables, command responses, and
| notices obtained from the database server, as well as output of
| various backslash commands that query the database (such as \d),
| but not error messages.

Are you seeing anything inconsistent with the documentation? If
so, what?

The documentation doesn't specify that a proper subset of the
backslash commands go through, and doesn't enumerate either the ones
that do or the ones that don't.

The way I see it, the fact that backslash commands aren't treated
consistently here would be a bug even if the inconsistency were
documented, which it is only vaguely by implication.

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

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4David Fetter
david@fetter.org
In reply to: Kevin Grittner (#2)
Re: Should \o mean "everything?"

On Mon, Aug 31, 2015 at 07:18:02PM +0000, Kevin Grittner wrote:

David Fetter <david@fetter.org> wrote:

In a failed attempt to send the output of \pset to a pipe, I
noticed that for reasons I find difficult to explain, not every
output gets redirected with \o.

At first blush, I'd consider this inconsistency as a bug.

What have I missed?

The documentation says:

| Arranges to save future query results to the file filename or
| pipe future results to the shell command command. If no argument
| is specified, the query output is reset to the standard output.
|
| "Query results" includes all tables, command responses, and
| notices obtained from the database server, as well as output of
| various backslash commands that query the database (such as \d),
| but not error messages.

Are you seeing anything inconsistent with the documentation? If
so, what?

Perhaps an example would help clarify...

postgres=# \o | perl -pE 's/^/PREFIXED!/'
postgres=# \dt
postgres=# PREFIXED!No relations found.

postgres=# \set
AUTOCOMMIT = 'on'
ON_ERROR_STOP = ''
PROMPT1 = '%/%R%# '
PROMPT2 = '%/%R%# '
PROMPT3 = '>> '
VERBOSITY = 'default'
VERSION = 'PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit'
DBNAME = 'postgres'
USER = 'postgres'
HOST = '/var/run/postgresql'
PORT = '5432'
ENCODING = 'UTF8'
PSQL_EDITOR = '"/usr/local/bin/vim"'

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

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Anastasia Lubennikova
a.lubennikova@postgrespro.ru
In reply to: David Fetter (#4)
Re: Should \o mean "everything?"

31.08.2015 23:25, David Fetter пишет:

On Mon, Aug 31, 2015 at 07:18:02PM +0000, Kevin Grittner wrote:

David Fetter <david@fetter.org> wrote:

In a failed attempt to send the output of \pset to a pipe, I
noticed that for reasons I find difficult to explain, not every
output gets redirected with \o.

At first blush, I'd consider this inconsistency as a bug.

What have I missed?

The documentation says:

| Arranges to save future query results to the file filename or
| pipe future results to the shell command command. If no argument
| is specified, the query output is reset to the standard output.
|
| "Query results" includes all tables, command responses, and
| notices obtained from the database server, as well as output of
| various backslash commands that query the database (such as \d),
| but not error messages.

Are you seeing anything inconsistent with the documentation? If
so, what?

Perhaps an example would help clarify...

postgres=# \o | perl -pE 's/^/PREFIXED!/'
postgres=# \dt
postgres=# PREFIXED!No relations found.

postgres=# \set
AUTOCOMMIT = 'on'
ON_ERROR_STOP = ''
PROMPT1 = '%/%R%# '
PROMPT2 = '%/%R%# '
PROMPT3 = '>> '
VERBOSITY = 'default'
VERSION = 'PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit'
DBNAME = 'postgres'
USER = 'postgres'
HOST = '/var/run/postgresql'
PORT = '5432'
ENCODING = 'UTF8'
PSQL_EDITOR = '"/usr/local/bin/vim"'

Cheers,
David.

Thanks for your test case. It made the question clear.
That's definitely not a bug. Just not use case of "\o" command.
Maybe documentation is a bit vague here.

| "Query results" includes <...> output of various backslash commands
that query the database (such as \d),
| but not error messages.

As I understand, this phrase means ONLY those commands which starts with
'\d' (such as \dt, \di, \des etc.)

--
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers