From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Ashish Karalkar <ashish(dot)karalkar(at)info-spectrum(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: user input during runtime |
Date: | 2007-02-17 17:30:59 |
Message-ID: | 20070217173059.GA3610@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Feb 16, 2007 at 08:23:48PM -0500, Bruce Momjian wrote:
> Ashish Karalkar wrote:
> > Hello All,
> > I want to prompt user to input some value and do some action on that value in runtime of a sql script.
> > Is there any psql command to do this ??
> > I can use \echo do display massage
> > but to take input what is the command?
> > Thanks in advance
>
> You can do:
>
> \echo -n 'Enter value: '
> \set x `read && echo $REPLY`
Neat trick! Is there one that works on all our supported platforms?
I'm guessing Win32 will just get confused about backticks.
> in psql. I think we will have \prompt in 8.3.
Well, I guess it's not all that crucial with \prompt coming out. :)
Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter
Remember to vote!
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2007-02-17 17:48:39 | Re: user input during runtime |
Previous Message | David Legault | 2007-02-17 17:24:31 | Addons |