PSQL Help

Started by Andre Lucasabout 6 years ago4 messagesbugs
Jump to latest
#1Andre Lucas
andre@amazoniasistemas.com.br

I am having the following problem when trying to restore a backup of a following file.

the version of postGre on my machine is 9.3

However, the backup was made in version 9.2.15

I get the following message when I try to run psql:

psql -h localhost -U postgres NovoBD -f Backup17.sql

“psql: warning: extra command-line argument "-f" ignored
psql: warning: extra command-line argument "Backup17.sql" ignored
psql (9.3.21)”

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Andre Lucas (#1)
Re: PSQL Help

On Monday, February 17, 2020, Andre Lucas <andre@amazoniasistemas.com.br>
wrote:

psql -h localhost -U postgres NovoBD -f Backup17.sql

“psql: warning: extra command-line argument "-f" ignored

psql: warning: extra command-line argument "Backup17.sql" ignored

You command doesn’t match the documented syntax:

psql [option...] [dbname [username]]

Hint: NovoBD is the “dbname”

David J.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: PSQL Help

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Monday, February 17, 2020, Andre Lucas <andre@amazoniasistemas.com.br>
wrote:

psql -h localhost -U postgres NovoBD -f Backup17.sql
“psql: warning: extra command-line argument "-f" ignored
psql: warning: extra command-line argument "Backup17.sql" ignored

You command doesn’t match the documented syntax:
psql [option...] [dbname [username]]
Hint: NovoBD is the “dbname”

FWIW, Andres' example *will* work on some platforms, because glibc's
getopt_long() takes it upon itself to rearrange the arguments.
But it doesn't work everywhere, which is why we only document/recommend
the stricter argument order.

regards, tom lane

#4Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#3)
Re: PSQL Help

On Mon, Feb 17, 2020 at 10:39:16PM -0500, Tom Lane wrote:

FWIW, Andres' example *will* work on some platforms, because glibc's
getopt_long() takes it upon itself to rearrange the arguments.
But it doesn't work everywhere, which is why we only document/recommend
the stricter argument order.

This is actually the case of our fallback implementation used for
example on Windows with MSVC builds. This led to fixes in our
regression tests like c67a86f, so we avoid this style as much as
possible on portability's ground.
--
Michael