psql --csv and other parameters

Started by Erik Rijkersover 7 years ago3 messageshackers
Jump to latest
#1Erik Rijkers
er@xs4all.nl

I don't know if this really is a bug but it seems wrong to me:

psql -A --csv -Xc "select * from pg_namespace order by 1"

gives a difference result than

psql --csv -A -Xc "select * from pg_namespace order by 1"

I would say both should give the same result, and
that result should be the same as from:

psql --csv -Xc "select * from pg_namespace order by 1"

Thanks,

Erik Rijkers

#2Daniel Verite
daniel@manitou-mail.org
In reply to: Erik Rijkers (#1)
Re: psql --csv and other parameters

Erik Rijkers wrote:

I don't know if this really is a bug but it seems wrong to me:

psql -A --csv -Xc "select * from pg_namespace order by 1"

gives a difference result than

psql --csv -A -Xc "select * from pg_namespace order by 1"

-A and --csv each select an output format, and since
there can be only one output format active, they are
mutually exclusive.

When options conflict, the rightmost on the command line wins,
so -A --cvs is the same as --csv, and --csv -A is the same as -A

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

#3Michael Paquier
michael@paquier.xyz
In reply to: Daniel Verite (#2)
Re: psql --csv and other parameters

On Wed, Nov 28, 2018 at 02:38:04PM +0100, Daniel Verite wrote:

-A and --csv each select an output format, and since
there can be only one output format active, they are
mutually exclusive.

When options conflict, the rightmost on the command line wins,
so -A --cvs is the same as --csv, and --csv -A is the same as -A

And that's what I would expect. A lot of folks like using aliases and
relying on the last option being defined as a winner instead of bumping
into an error if multiple overlapping options are defined.
--
Michael