Re: User input to queries

2020-12-09 Thread Paul Förster
Hi Rich, > On 09. Dec, 2020, at 19:22, Rich Shepard wrote: > > Okay. I use mupdf to view the document and my search string were 'prompt', > and 'prompt command'. I didn't use '\prompt', \prompt is a psql special command, hence the backslash. Only psql knows that, the database does not, as with

Re: User input to queries

2020-12-09 Thread Rich Shepard
On Wed, 9 Dec 2020, Paul Förster wrote: but 12 has it: postgres=# \prompt 'input: ' input input: this is test input postgres=# select version(), :'input'; Paul, Okay. I use mupdf to view the document and my search string were 'prompt', and 'prompt command'. I didn't use '\prompt', Thanks ag

Re: User input to queries

2020-12-09 Thread Paul Förster
Hi Rich, > On 09. Dec, 2020, at 19:10, Rich Shepard wrote: > > Looking at the postgres-12 doc I cannot find a command 'PROMPT' anywhere in > it. but 12 has it: postgres=# \prompt 'input: ' input input: this is test input postgres=# select version(), :'input';

Re: User input to queries

2020-12-09 Thread Rob Sargent
On 12/9/20 11:10 AM, Rich Shepard wrote: On Wed, 9 Dec 2020, Paul Förster wrote: maybe you're looking for this? https://stackoverflow.com/a/7389606 Paul, That looks very useful and I'll try the provided answers. Looking at the postgres-12 doc I cannot find a command 'PROMPT' anywhere in

Re: User input to queries

2020-12-09 Thread Rich Shepard
On Wed, 9 Dec 2020, Paul Förster wrote: maybe you're looking for this? https://stackoverflow.com/a/7389606 Paul, That looks very useful and I'll try the provided answers. Looking at the postgres-12 doc I cannot find a command 'PROMPT' anywhere in it. Thanks, Rich

Re: User input to queries

2020-12-09 Thread Paul Förster
Hi Rich, > On 09. Dec, 2020, at 18:53, Rich Shepard wrote: > > My business tracking tool. Yes, the GUI will have text entry widgets for > user input but I want to apply these queries using psql on the command line > until I build the GUI. maybe you're looking for this? https://stackoverflow.co

Re: User input to queries

2020-12-09 Thread Rich Shepard
On Wed, 9 Dec 2020, Rob Sargent wrote: Put the query in a file, set the desired name, then from psql \i filename Edit pfname, repeat Thanks, Rob. Stay well, Rich

Re: User input to queries [RESOLVED]

2020-12-09 Thread Rich Shepard
On Wed, 9 Dec 2020, Laurenz Albe wrote: You probably need the \prompt psql command: \prompt 'What is "p.lname"' p_lname \prompt 'What is "p.fname"' p_fname SELECT ... WHERE p.lname = :p_lname AND p.fname = :p_fname; Laurenz, Ah! I have not before encountered that command. Yes, this will do th

Re: User input to queries

2020-12-09 Thread Rich Shepard
On Wed, 9 Dec 2020, Michael Lewis wrote: What application is taking the user input and needs to include the parameters in the query string? Michael, My business tracking tool. Yes, the GUI will have text entry widgets for user input but I want to apply these queries using psql on the command

Re: User input to queries

2020-12-09 Thread Laurenz Albe
On Wed, 2020-12-09 at 09:03 -0800, Rich Shepard wrote: > While I develop the application's GUI I use the database from the command > line (psql). While some queries are self-contained others need user input. > I've not found a search term that locates this information in the > postgres-12 user manu

Re: User input to queries

2020-12-09 Thread Rob Sargent
On 12/9/20 10:03 AM, Rich Shepard wrote: While I develop the application's GUI I use the database from the command line (psql). While some queries are self-contained others need user input. I've not found a search term that locates this information in the postgres-12 user manual and my web sea

Re: User input to queries

2020-12-09 Thread Michael Lewis
What application is taking the user input and needs to include the parameters in the query string?

Re: User input to queries

2020-12-09 Thread Rich Shepard
On Wed, 9 Dec 2020, Michael Lewis wrote: Are you looking for this perhaps? https://www.postgresql.org/docs/current/sql-prepare.html Michael, I don't think so. Reading the PREPARE doc page my understanding is that its use is for statement execution optimization, not asking for user data input

Re: User input to queries

2020-12-09 Thread Michael Lewis
On Wed, Dec 9, 2020 at 10:04 AM Rich Shepard wrote: > While I develop the application's GUI I use the database from the command > line (psql). While some queries are self-contained others need user input. > I've not found a search term that locates this information in the > postgres-12 user manua

User input to queries

2020-12-09 Thread Rich Shepard
While I develop the application's GUI I use the database from the command line (psql). While some queries are self-contained others need user input. I've not found a search term that locates this information in the postgres-12 user manual and my web searches suggest that using '&' should work. I