Suggestion for psql: --file -

From: "Albert REINER" <areiner(at)tph(dot)tuwien(dot)ac(dot)at>
To: PostgreSQL-SQL <pgsql-sql(at)postgreSQL(dot)org>
Subject: Suggestion for psql: --file -
Date: 2001-01-30 22:20:28
Message-ID: 20010130232028.A1380@frithjof
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)tph(dot)tuwien(dot)ac(dot)at>
Deutsch * English * Esperanto * Latine
--------------------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Sawtell 2001-01-30 23:03:00 Is this feature a bug?
Previous Message Keith Gray 2001-01-30 21:55:23 DROP Column