Re: psql -1 -f - busted - Mailing list pgsql-bugs

From Robert Haas
Subject Re: psql -1 -f - busted
Date
Msg-id 603c8f070911261959k2eda96c0q49dea351af3cf80@mail.gmail.com
Whole thread Raw
In response to psql -1 -f - busted  (Stephen Frost <sfrost@snowman.net>)
Responses Re: psql -1 -f - busted
List pgsql-bugs
On Thu, Oct 22, 2009 at 2:42 PM, Stephen Frost <sfrost@snowman.net> wrote:
> =A0-1 appears to be ignored when '-f -' is set.

I've been bitten by this, too.  It appears that "-f -" is in general
equivalent to not specifying "-f" at all.  In startup.c we have a test
for:

options.action =3D=3D ACT_FILE && strcmp(options.action_string, "-") !=3D 0

I suppose we could change it to:

options.action =3D=3D ACT_FILE && (strcmp(options.action_string, "-") !=3D 0
|| pset.notty)

But I sort of think it should just be:

options.action =3D=3D ACT_FILE

ISTM that if you run psql with "-f -", you shouldn't expect to get an
interactive shell.  Rather, you should expect psql to do whatever it
normally does when given -f somefilename, except using stdin rather
than the file.  After all, you could have left out -f altogether if
you'd wanted the interactive behavior.  But then IJWH.

...Robert

pgsql-bugs by date:

Previous
From: "Henrik Pestano"
Date:
Subject: BUG #5216: pgFouine 1.1 not working correctly, when LC_MESSAGES is "es_ES.UTF-8"
Next
From: Peter Eisentraut
Date:
Subject: Re: psql -1 -f - busted