https://github.com/jackc/pgx/pull/2481
(t *testing.T)
| 1399 | |
| 1400 | // https://github.com/jackc/pgx/pull/2481 |
| 1401 | func TestOpenTransactionsDiscarded(t *testing.T) { |
| 1402 | db := openDB(t) |
| 1403 | defer closeDB(t, db) |
| 1404 | |
| 1405 | skipCockroachDB(t, db, "CockroachDB auto commits DDL by default") |
| 1406 | |
| 1407 | db.SetMaxOpenConns(1) |
| 1408 | ctx := context.Background() |
| 1409 | |
| 1410 | for range 3 { |
| 1411 | func() { |
| 1412 | conn, err := db.Conn(ctx) |
| 1413 | require.NoError(t, err) |
| 1414 | defer conn.Close() |
| 1415 | |
| 1416 | _, err = conn.ExecContext(ctx, "begin;") |
| 1417 | require.NoError(t, err) |
| 1418 | |
| 1419 | // If the open transaction is not discarded, the second time this is run it will fail. |
| 1420 | _, err = conn.ExecContext(ctx, "create temporary table in_tx_discard_test(id int);") |
| 1421 | require.NoError(t, err) |
| 1422 | }() |
| 1423 | } |
| 1424 | |
| 1425 | ensureDBValid(t, db) |
| 1426 | } |
| 1427 | |
| 1428 | func TestRowsColumnTypeLength(t *testing.T) { |
| 1429 | testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) { |
nothing calls this directly
no test coverage detected