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