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 1tdqog-00A1bM-CZ for pgsql-general@arkaria.postgresql.org; Fri, 31 Jan 2025 13:12:15 +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 1tdqoe-000Na5-Tu for pgsql-general@arkaria.postgresql.org; Fri, 31 Jan 2025 13:12:12 +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 1tdqoe-000NZw-Il for pgsql-general@lists.postgresql.org; Fri, 31 Jan 2025 13:12:12 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tdqob-002SrP-2b for pgsql-general@postgresql.org; Fri, 31 Jan 2025 13:12:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description; bh=ffx+g6Hv9ZXkxX1ukhxWriFMXNV4WmlfK15NaMjNEWw=; b=s5VIAcou0rr1kF1gdTtX1+5IQG G90ShCzeEcOtBiGJiMkKjssTiGgykbC7yd7AP8yME6AJuAl1K99CIZGj6/UPw7B7e5cgbxiMhZZdR yBsOGzbDN06NqIK8FBcAtvA+6m185N56MnMWIcszxEXFaUv3VlHnY7bELmdjrp0R2uR4=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1tdqoZ-004c0L-1A; Fri, 31 Jan 2025 14:12:07 +0100 Date: Fri, 31 Jan 2025 14:12:07 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Rich Shepard Cc: pgsql-general@postgresql.org Subject: Re: Using psql's \prompt command Message-ID: Reply-To: depesz@depesz.com References: <1dbc1ace-c119-6ed2-d579-561525f3bf0@appl-ecosys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1dbc1ace-c119-6ed2-d579-561525f3bf0@appl-ecosys.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 30, 2025 at 01:47:59PM -0800, Rich Shepard wrote: > # \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? prompt is ok. but you can't just throw variable name in the query and assume it will get substituted. the proper syntax is :store, or (better) :'store' and again: not in the *\prompt* line - in the place where you use it. You might want to read https://www.depesz.com/2023/05/28/variables-in-psql-how-to-use-them/ Best regards, depesz