From: | Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Using psql's \prompt command |
Date: | 2025-01-30 21:47:59 |
Message-ID: | 1dbc1ace-c119-6ed2-d579-561525f3bf0@appl-ecosys.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I want to use the \prompt command to get user input for a query. My script
fails:
-- Display person_nbr, lname, fname, direct_phone, email from people, contact history from contacts.
-- prompt for person_nbr before selecting rows:
\prompt 'Enter person_nbr: ' store
select p.person_nbr, p.lname, p.fname, p.direct_phone, p.email, c.contact_date, c.contact_time, c.contact_type, c.notes
from people as p natural inner join contacts as c
where person_nbr = store
order by c.contact_date, c.contact_time;
# \i person_view.sql
Enter person_nbr: 468
psql:person_view.sql:9: ERROR: column "store" does not exist
LINE 3: where person_nbr = store
^
What's the correct syntax for the \prompt?
TIA,
Rich
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-01-30 21:50:06 | Re: Using psql's \prompt command |
Previous Message | Pavel Borisov | 2025-01-30 20:32:03 | Re: Using Expanded Objects other than Arrays from plpgsql |