Suggestion for psql: --file -

Поиск
Список
Период
Сортировка
От Albert REINER
Тема Suggestion for psql: --file -
Дата
Msg-id 20010130232028.A1380@frithjof
обсуждение исходный текст
Ответы Re: Suggestion for psql: --file -
Список 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 по дате отправления:

Предыдущее
От: "Albert REINER"
Дата:
Сообщение: 7.0.2-docs: textpos -> strpos
Следующее
От: Mark Volpe
Дата:
Сообщение: Re: Index scan