Re: psql ignores failure to open -o target file

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql ignores failure to open -o target file
Date: 2015-12-02 18:04:51
Message-ID: CA+TgmoZRuAc0p8sP4q7aETXZdYd56pD=1LPhDw-+_azch_pkug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 2, 2015 at 11:07 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I just noticed that parse_psql_options() ignores the result of setQFout(),
> meaning that if the argument of a -o command line option is bogus, we'll
> ignore the switch entirely after printing an error report. For example
>
> $ psql -o /dev/foo -c 'select 1'
> /dev/foo: Permission denied
> ?column?
> ----------
> 1
> (1 row)
>
> $
>
> This seems surprising to me: any other program in the world would do
> exit(1) after discovering that it couldn't write where it had been
> told to. Should we change this?

I assume this is a rhetorical question.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-12-02 18:10:18 Re: psql: add \pset true/false
Previous Message Robert Haas 2015-12-02 18:03:01 Re: Using quicksort for every external sort run