diff --git a/stdlib/sql_test.go b/stdlib/sql_test.go index aa8a613b..93265726 100644 --- a/stdlib/sql_test.go +++ b/stdlib/sql_test.go @@ -18,6 +18,7 @@ import ( "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgtype" + "github.com/jackc/pgx/v5/pgxpool" "github.com/jackc/pgx/v5/stdlib" "github.com/jackc/pgx/v5/tracelog" "github.com/stretchr/testify/assert" @@ -166,6 +167,17 @@ func TestSQLOpen(t *testing.T) { } } +func TestSQLOpenFromPool(t *testing.T) { + pool, err := pgxpool.New(context.Background(), os.Getenv("PGX_TEST_DATABASE")) + require.NoError(t, err) + t.Cleanup(pool.Close) + + db := stdlib.OpenDBFromPool(pool) + ensureDBValid(t, db) + + db.Close() +} + func TestNormalLifeCycle(t *testing.T) { db := openDB(t) defer closeDB(t, db)