public inbox for [email protected]
help / color / mirror / Atom feedFrom: hubert depesz lubaczewski <[email protected]>
To: Rich Shepard <[email protected]>
Cc: [email protected]
Subject: Re: Using psql's \prompt command
Date: Fri, 31 Jan 2025 14:12:07 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
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
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Using psql's \prompt command
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox