From: Albert REINER <areiner@tph.tuwien.ac.at>
To: PostgreSQL-SQL <pgsql-sql@postgreSQL.org>
Subject: Suggestion for psql: --file -
Date: Tue, 30 Jan 2001 23:20:28 +0100
Message-ID: <20010130232028.A1380@frithjof> (raw)
Saluton,
wouldn't it be a good idea (and if it is, I am not sure what list to
post it to) to have psql's option -f / --file take "-" for stdin, as
many programs do?
In shell scripts this would facilitate using here-documents:
cat <<ASDF | psql --set ON_ERROR_STOP= -f -
insert into a (b,c) valyooz ('Caesar's victory'::tekst, 'Backslash \');
ASDF
This way you could have the benefits of -f (e.g. line information in
error messages) without the need of external files; if you simply omit
"-f -" in the above example, you do not get the information that the
error occurred on line 1.
Albert.
P.S: BTW, the man page (7.0.2) of psql is not very clear: it took me
some experimentation to find out that you have to do "\set VARIABLE"
interactively or give "--set VARIABLE=" to set a variable that does
not take a value.
--
--------------------------------------------------------------------------
Albert Reiner <areiner@tph.tuwien.ac.at>
Deutsch * English * Esperanto * Latine
--------------------------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: areiner@tph.tuwien.ac.at
Subject: Re: Suggestion for psql: --file -
In-Reply-To: <20010130232028.A1380@frithjof>
References: <20010130232028.A1380@frithjof>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox