Re: Using psql's \prompt command - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: Using psql's \prompt command
Date
Msg-id Z5zMJ7cFdv2LyEbl@depesz.com
Whole thread Raw
In response to Using psql's \prompt command  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
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




pgsql-general by date:

Previous
From: Koen De Groote
Date:
Subject: Postgres restore sometimes restores to a point 2 days in the past
Next
From: Laurenz Albe
Date:
Subject: Re: Postgres restore sometimes restores to a point 2 days in the past