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
Re: \prompt for psql |
Список | pgsql-patches |
On 2/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
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.
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 по дате отправления: