@@ -53,6 +53,42 @@ func TestBindingWithOidZero(t *testing.T) {
5353 require .NoError (t , result .Err )
5454}
5555
56+ func TestIssue2386 (t * testing.T ) {
57+ // https://github.com/dolthub/doltgresql/issues/2386
58+ ctx , connection , controller := CreateServer (t , "postgres" )
59+ defer controller .Stop ()
60+ conn := connection .Default
61+ _ , err := connection .Exec (ctx , "CREATE TABLE users (id INT PRIMARY KEY, name TEXT NOT NULL);" )
62+ require .NoError (t , err )
63+ _ , err = connection .Exec (ctx , "INSERT INTO users VALUES (1, 'alice'), (2, 'bob'), (3, 'carol'), (4, 'dave');" )
64+ require .NoError (t , err )
65+ targetIDs := []int32 {1 , 3 }
66+ rows , err := conn .Query (ctx ,
67+ `SELECT id, name FROM users WHERE id = ANY($1)` ,
68+ targetIDs ,
69+ )
70+ require .NoError (t , err )
71+ defer rows .Close ()
72+ i := 0
73+ for rows .Next () {
74+ var id int32
75+ var name string
76+ err = rows .Scan (& id , & name )
77+ require .NoError (t , err )
78+ switch i {
79+ case 0 :
80+ require .Equal (t , int32 (1 ), id )
81+ require .Equal (t , "alice" , name )
82+ case 1 :
83+ require .Equal (t , int32 (3 ), id )
84+ require .Equal (t , "carol" , name )
85+ default :
86+ t .FailNow ()
87+ }
88+ i ++
89+ }
90+ }
91+
5692func TestBindingWithTextArray (t * testing.T ) {
5793 ctx , connection , controller := CreateServer (t , "postgres" )
5894 defer func () {
0 commit comments