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 1tdcOJ-008WIX-JP for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 21:48:04 +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 1tdcOI-00DNFb-P7 for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 21:48:02 +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 1tdcOI-00DNFT-EU for pgsql-general@lists.postgresql.org; Thu, 30 Jan 2025 21:48:02 +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 1tdcOG-002M9E-0k for pgsql-general@postgresql.org; Thu, 30 Jan 2025 21:48:01 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 345B72A43CF for ; Thu, 30 Jan 2025 13:47:59 -0800 (PST) Date: Thu, 30 Jan 2025 13:47:59 -0800 (PST) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@postgresql.org Subject: Using psql's \prompt command Message-ID: <1dbc1ace-c119-6ed2-d579-561525f3bf0@appl-ecosys.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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