Re: \prompt for psql

Поиск
Список
Период
Сортировка
От Chad Wagner
Тема Re: \prompt for psql
Дата
Msg-id 81961ff50702170905he2dfcf2j95a38df0f09ffd59@mail.gmail.com
обсуждение исходный текст
Ответ на Re: \prompt for psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: \prompt for psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: \prompt for psql  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-patches
On 2/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Bruce Momjian <bruce@momjian.us> writes:
> stdin makes it impossible to read a script from stdin and still prompt
> the user, but I think that is of limited usefulness.

You can always get around that by reading the script with -f instead.
On balance I can see a lot more uses for read-from-stdin than the other;
however, we do need to define what happens if the command appears when
commands are coming from stdin.

Would it make sense to say:

1. if pset.notty is set and '-f' switch is not set then use simple_prompt
      -- deals with SQL script redirection case and '-f' is not used, and not interactive
2. else then use gets_fromFile(stdin) <or some other alternative?> (read from stdin)
      -- deals with "prompt value" redirection case and '-f' is used, or interactive

It appears that pset.notty will get set to 1 when stdin is not a tty device, which should be the case for redirection.

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: \prompt for psql
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: patch adding new regexp functions