@@ -18,6 +18,8 @@ import (
1818 "strconv"
1919 "testing"
2020
21+ "github.com/jackc/pgx/v5/pgtype"
22+
2123 "github.com/stretchr/testify/require"
2224)
2325
@@ -46,3 +48,25 @@ func TestBindingWithOidZero(t *testing.T) {
4648 result := resultReader .Read ()
4749 require .NoError (t , result .Err )
4850}
51+
52+ func TestBindingWithTextArray (t * testing.T ) {
53+ ctx , connection , controller := CreateServer (t , "postgres" )
54+ defer controller .Stop ()
55+ conn := connection .Default
56+
57+ m := pgtype .NewMap ()
58+ textArray := []string {"foo" , "bar" }
59+
60+ plan := m .PlanEncode (pgtype .TextArrayOID , pgtype .BinaryFormatCode , textArray )
61+ encodedArr , err := plan .Encode (textArray , nil )
62+ require .NoError (t , err )
63+
64+ args := [][]byte {encodedArr }
65+ paramOIDs := []uint32 {1009 }
66+ paramFormats := []int16 {1 }
67+ sql := "SELECT $1::text[]"
68+
69+ resultReader := conn .PgConn ().ExecParams (ctx , sql , args , paramOIDs , paramFormats , nil )
70+ result := resultReader .Read ()
71+ require .NoError (t , result .Err )
72+ }
0 commit comments