Re: [PATCHES] \prompt for psql

2007-02-23 Thread Bruce Momjian
I have applied a modified version of your patch. I moved the prompt 'text' field as optional before name, and removed the default prompt string, which seemed un-Unix-like. I also simplified when stdin/stdout is used. If stdin is the terminal, it seems it makes no difference if we use the

Re: [PATCHES] \prompt for psql

2007-02-18 Thread Peter Eisentraut
Chad Wagner wrote: 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) That seems a bit too

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Peter Eisentraut
Bruce Momjian wrote: Seems the consensus was this was a good idea, and not feature-creep. I wonder whether we want this to read from the console, like the password prompts, or from stdin. Not sure which is more useful. -- Peter Eisentraut http://developer.postgresql.org/~petere/

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Chad Wagner
On 2/17/07, Peter Eisentraut [EMAIL PROTECTED] wrote: Bruce Momjian wrote: Seems the consensus was this was a good idea, and not feature-creep. I wonder whether we want this to read from the console, like the password prompts, or from stdin. Not sure which is more useful. Good point, I

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Magnus Hagander
Peter Eisentraut wrote: Bruce Momjian wrote: Seems the consensus was this was a good idea, and not feature-creep. I wonder whether we want this to read from the console, like the password prompts, or from stdin. Not sure which is more useful. I think from stdin. Otherwise it won't be

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Bruce Momjian
Magnus Hagander wrote: Peter Eisentraut wrote: Bruce Momjian wrote: Seems the consensus was this was a good idea, and not feature-creep. I wonder whether we want this to read from the console, like the password prompts, or from stdin. Not sure which is more useful. I think from

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Chad Wagner
On 2/17/07, Tom Lane [EMAIL PROTECTED] wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Tom Lane
Chad Wagner [EMAIL PROTECTED] writes: Would it make sense to say: 1. if pset.notty is set and '-f' switch is not set then use simple_prompt 2. else then use gets_fromFile(stdin) or some other alternative? Actually, there's another issue, which is where to send the prompt. If we're using

Re: [PATCHES] \prompt for psql

2007-02-17 Thread Chad Wagner
On 2/17/07, Tom Lane [EMAIL PROTECTED] wrote: Chad Wagner [EMAIL PROTECTED] writes: Would it make sense to say: 1. if pset.notty is set and '-f' switch is not set then use simple_prompt 2. else then use gets_fromFile(stdin) or some other alternative? Actually, there's another issue, which

Re: [PATCHES] \prompt for psql

2007-02-16 Thread Bruce Momjian
Seems the consensus was this was a good idea, and not feature-creep. It needs SGML documentation, which I will add. Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the

Re: [PATCHES] \prompt for psql

2007-02-09 Thread Joshua D. Drake
Joshua D. Drake wrote: Alvaro Herrera wrote: Joshua D. Drake wrote: Peter Eisentraut wrote: Magnus Hagander wrote: That also requires a reasonable shell, which all platforms don't have... I think doing any sort of reasonable scripting around psql requires a reasonable shell. Or next

Re: [PATCHES] \prompt for psql

2007-02-09 Thread Gurjeet Singh
On 2/9/07, Alvaro Herrera [EMAIL PROTECTED] wrote: At least it'd help those poor people trying to do conditional COMMIT or ROLLBACK based on the transaction status. The user doesn't need to check the status of the transaction if he just needs to end it. Just fire the END command and it'll

Re: [PATCHES] \prompt for psql

2007-02-09 Thread Alvaro Herrera
Gurjeet Singh wrote: On 2/9/07, Alvaro Herrera [EMAIL PROTECTED] wrote: At least it'd help those poor people trying to do conditional COMMIT or ROLLBACK based on the transaction status. The user doesn't need to check the status of the transaction if he just needs to end it. Just fire

Re: [PATCHES] \prompt for psql

2007-02-09 Thread Merlin Moncure
On 2/9/07, Alvaro Herrera [EMAIL PROTECTED] wrote: Gurjeet Singh wrote: On 2/9/07, Alvaro Herrera [EMAIL PROTECTED] wrote: At least it'd help those poor people trying to do conditional COMMIT or ROLLBACK based on the transaction status. The user doesn't need to check the status of the

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Peter Eisentraut
Chad Wagner wrote: This adds the ability to prompt for internal variable input, below are examples: test=# \prompt x Enter value for x: 3 You can do this already approximately so: \echo -n 'Enter value: ' \set x `read echo $REPLY` Maybe one command is better, though. -- Peter Eisentraut

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Gurjeet Singh
On 2/8/07, Chad Wagner [EMAIL PROTECTED] wrote: This adds the ability to prompt for internal variable input, below are examples: In help.c:slashUsage(), the comment says: /* if you add/remove a line here, change the row count above */ So I guess, the patch should also include a change

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Magnus Hagander
On Thu, Feb 08, 2007 at 10:17:19AM +0100, Peter Eisentraut wrote: Chad Wagner wrote: This adds the ability to prompt for internal variable input, below are examples: test=# \prompt x Enter value for x: 3 You can do this already approximately so: \echo -n 'Enter value: ' \set x

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Peter Eisentraut
Magnus Hagander wrote: That also requires a reasonable shell, which all platforms don't have... I think doing any sort of reasonable scripting around psql requires a reasonable shell. Or next someone will suggest implementing loops and conditionals in psql. For that matter, I suspect in any

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Chad Wagner
On 2/8/07, Peter Eisentraut [EMAIL PROTECTED] wrote: You can do this already approximately so: \echo -n 'Enter value: ' \set x `read echo $REPLY` Maybe one command is better, though. Yep, in fact that is more or less something similar that I suggested on pgsql-sql yesterday. The only

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Chad Wagner
On 2/8/07, Gurjeet Singh [EMAIL PROTECTED] wrote: In help.c:slashUsage(), the comment says: /* if you add/remove a line here, change the row count above */ So I guess, the patch should also include a change to the line: output = PageOutput(67, pager); = output = PageOutput(68, pager);

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Chad Wagner
Anyways, here is the patch again with the pager output changed from 67 to 69. Feel free to use it or ignore it, I still think it is a useful patch and doesn't necessary imply that users will want looping next (although, I would like to do anonymous PL/pgSQL chunks ;). I just understand how

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Joshua D. Drake
Peter Eisentraut wrote: Magnus Hagander wrote: That also requires a reasonable shell, which all platforms don't have... I think doing any sort of reasonable scripting around psql requires a reasonable shell. Or next someone will suggest implementing loops and conditionals in psql. ...

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Alvaro Herrera
Joshua D. Drake wrote: Peter Eisentraut wrote: Magnus Hagander wrote: That also requires a reasonable shell, which all platforms don't have... I think doing any sort of reasonable scripting around psql requires a reasonable shell. Or next someone will suggest implementing loops and

Re: [PATCHES] \prompt for psql

2007-02-08 Thread Joshua D. Drake
Alvaro Herrera wrote: Joshua D. Drake wrote: Peter Eisentraut wrote: Magnus Hagander wrote: That also requires a reasonable shell, which all platforms don't have... I think doing any sort of reasonable scripting around psql requires a reasonable shell. Or next someone will suggest