Suggestion for psql: --file - - Mailing list pgsql-sql

From Albert REINER
Subject Suggestion for psql: --file -
Date
Msg-id 20010130232028.A1380@frithjof
Whole thread Raw
Responses Re: Suggestion for psql: --file -
List pgsql-sql
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
--------------------------------------------------------------------------


pgsql-sql by date:

Previous
From: "Albert REINER"
Date:
Subject: 7.0.2-docs: textpos -> strpos
Next
From: Mark Volpe
Date:
Subject: Re: Index scan