Re: \prompt for psql

From: "Chad Wagner" <chad(dot)wagner(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, "Magnus Hagander" <magnus(at)hagander(dot)net>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: \prompt for psql
Date: 2007-02-17 17:05:49
Message-ID: 81961ff50702170905he2dfcf2j95a38df0f09ffd59@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On 2/17/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Bruce Momjian <bruce(at)momjian(dot)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.

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2007-02-17 17:12:54 Re: patch adding new regexp functions
Previous Message Tom Lane 2007-02-17 16:42:20 Re: \prompt for psql