Re: Using psql's \prompt command [RESOLVED]

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using psql's \prompt command [RESOLVED]
Date: 2025-01-30 23:35:04
Message-ID: 7cfccedc-42a-1098-70f2-2e3e735786a@appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 30 Jan 2025, Rich Shepard wrote:

> Thanks again, David. I didn't know that's the section I need.

David/Ron, et al.:
Got it (example on page 2126 of the doc):
-- 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: ' who

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 p.person_nbr = (:'who')
order by c.contact_date, c.contact_time;

This works.

Thank you,

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-01-31 01:53:41 Re: Using Expanded Objects other than Arrays from plpgsql
Previous Message Rich Shepard 2025-01-30 23:00:44 Re: Using psql's \prompt command