On 8/24/23 11:16 AM, jian he wrote:
> hi. Can you check my first email about "a" versus "the" and "pg_stat_activity".
I did when you first sent it, and did not make any changes.
> also:
> "including the `\bind` command, which allows
> users to execute parameterized queries (e.g `SELECT $1 + $2`) then use `\bind`
> to substitute the variables."
>
> The example actually is very hard to reproduce. (it's not that super intuitive).
> fail case:
> test16-# SELECT $1 + $2 \bind 1 2
> test16-# ;
>
> a better example would be (e.g `SELECT $1 , $2`).
> The semicolon still needed to be in the next line.
I agree with updating the example, I'd propose:
SELECT $1::int + $2::int \bind 1 2 \g
which mirrors what's in the docs[1]
Thanks,
Jonathan
[1]
https://www.postgresql.org/docs/16/app-psql.html#APP-PSQL-META-COMMAND-BIND