Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tde3w-008ftn-R4 for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 23:35:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tde3v-00E8hk-F7 for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 23:35:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tde3v-00E8hc-4m for pgsql-general@lists.postgresql.org; Thu, 30 Jan 2025 23:35:07 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tde3s-002N2p-3D for pgsql-general@postgresql.org; Thu, 30 Jan 2025 23:35:06 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 0EBBE2A43CF for ; Thu, 30 Jan 2025 15:35:04 -0800 (PST) Date: Thu, 30 Jan 2025 15:35:04 -0800 (PST) From: Rich Shepard Reply-To: Rich Shepard To: "pgsql-general@postgresql.org" Subject: Re: Using psql's \prompt command [RESOLVED] In-Reply-To: <6617ae2-214c-28d6-7b67-5071ec2bae57@appl-ecosys.com> Message-ID: <7cfccedc-42a-1098-70f2-2e3e735786a@appl-ecosys.com> References: <1dbc1ace-c119-6ed2-d579-561525f3bf0@appl-ecosys.com> <28334f3d-5942-4849-374f-32f2f6a4e9c@appl-ecosys.com> <69ead979-7c20-d246-b52f-3e7af585da3d@appl-ecosys.com> <6617ae2-214c-28d6-7b67-5071ec2bae57@appl-ecosys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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