teardown

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package teardown drops the schema that a test or a benchmark worked in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropSchema

func DropSchema(ctx context.Context, pool *pgxpool.Pool, schema string) error

DropSchema drops schema, if it exists, on a connection of pool, once the statements that the pool's users gave up have ended.

A statement whose context ended can go on in the database. Its caller has returned, so a worker that was told to stop has stopped, and the pool closes the statement's connection in the background, until the server has ended the statement. Until then the statement may take locks, in another order than a drop of its schema does, and PostgreSQL ends one of the two as a deadlock. So DropSchema first waits until the pool has closed every such connection.

The wait cannot always tell that the statements have ended: not on a pool that others use meanwhile, not after closeLimit, and not through a proxy, which closes the connection at once while the server works on. Only then, DropSchema tries a drop again that PostgreSQL ended as a deadlock, a few times. Otherwise such a deadlock is a mistake in the order of the caller's clean-up, and DropSchema returns it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL