Thread: PSQL Help

PSQL Help

From
Andre Lucas
Date:

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)”

Re: PSQL Help

From
"David G. Johnston"
Date:
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.

Re: PSQL Help

From
Tom Lane
Date:
"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



Re: PSQL Help

From
Michael Paquier
Date:
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

Attachment