(t *testing.T)
| 1300 | } |
| 1301 | |
| 1302 | func TestConnExecParamsTooManyParams(t *testing.T) { |
| 1303 | t.Parallel() |
| 1304 | |
| 1305 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 1306 | defer cancel() |
| 1307 | |
| 1308 | pgConn, err := pgconn.Connect(ctx, os.Getenv("PGX_TEST_DATABASE")) |
| 1309 | require.NoError(t, err) |
| 1310 | defer closeConn(t, pgConn) |
| 1311 | |
| 1312 | paramCount := math.MaxUint16 + 1 |
| 1313 | params := make([]string, 0, paramCount) |
| 1314 | args := make([][]byte, 0, paramCount) |
| 1315 | for i := range paramCount { |
| 1316 | params = append(params, fmt.Sprintf("($%d::text)", i+1)) |
| 1317 | args = append(args, []byte(strconv.Itoa(i))) |
| 1318 | } |
| 1319 | sql := "values" + strings.Join(params, ", ") |
| 1320 | |
| 1321 | result := pgConn.ExecParams(ctx, sql, args, nil, nil, nil).Read() |
| 1322 | require.Error(t, result.Err) |
| 1323 | require.Equal(t, "extended protocol limited to 65535 parameters", result.Err.Error()) |
| 1324 | |
| 1325 | ensureConnValid(t, pgConn) |
| 1326 | } |
| 1327 | |
| 1328 | func TestConnExecParamsCanceled(t *testing.T) { |
| 1329 | t.Parallel() |
nothing calls this directly
no test coverage detected