mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
psql: Add tests for repeated calls of \bind[_named]
The implementation assumes that on multiple calls of these meta-commands the last one wins. Multiple \g calls in-between mean multiple executions. There were no tests to check these properties, hence let's add something. Author: Jelte Fennema-Nio, Michael Paquier Discussion: https://postgr.es/m/CAGECzQSTE7CoM=Gst56Xj8pOvjaPr09+7jjtWqTC40pGETyAuA@mail.gmail.com
This commit is contained in:
@@ -63,6 +63,10 @@ SELECT $1, $2 \parse stmt3
|
||||
\bind_named stmt4
|
||||
\bind_named
|
||||
\g
|
||||
-- Last \bind_named wins
|
||||
\bind_named stmt2 'foo' \bind_named stmt3 'foo2' 'bar2' \g
|
||||
-- Multiple \g calls mean multiple executions
|
||||
\bind_named stmt2 'foo3' \g \bind_named stmt3 'foo4' 'bar4' \g
|
||||
|
||||
-- \close (extended query protocol)
|
||||
\close
|
||||
@@ -76,6 +80,11 @@ SELECT 1 \bind \g
|
||||
SELECT $1 \bind 'foo' \g
|
||||
SELECT $1, $2 \bind 'foo' 'bar' \g
|
||||
|
||||
-- last \bind wins
|
||||
select $1::int as col \bind 'foo' \bind 2 \g
|
||||
-- Multiple \g calls mean multiple executions
|
||||
select $1::int as col \bind 1 \g \bind 2 \g
|
||||
|
||||
-- errors
|
||||
-- parse error
|
||||
SELECT foo \bind \g
|
||||
|
||||
Reference in New Issue
Block a user