Re: psql -1 -f - busted

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: psql -1 -f - busted
Date: 2009-11-27 03:59:17
Message-ID: 603c8f070911261959k2eda96c0q49dea351af3cf80@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 22, 2009 at 2:42 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>  -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 == ACT_FILE && strcmp(options.action_string, "-") != 0

I suppose we could change it to:

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

But I sort of think it should just be:

options.action == 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2009-11-27 06:42:32 Re: psql -1 -f - busted
Previous Message Henrik Pestano 2009-11-27 03:15:40 BUG #5216: pgFouine 1.1 not working correctly, when LC_MESSAGES is "es_ES.UTF-8"