2
0

added DeallocateAll to pgx.Conn to clear prepared statement cache

This commit is contained in:
Bodo Kaiser
2022-11-10 13:46:53 +01:00
committed by Jack Christensen
parent 8678ed560f
commit c94c47f584
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -326,6 +326,13 @@ func (c *Conn) Deallocate(ctx context.Context, name string) error {
return err
}
// Deallocate all released prepared statements
func (c *Conn) DeallocateAll(ctx context.Context, name string) error {
c.preparedStatements = map[string]*pgconn.StatementDescription{}
_, err := c.pgConn.Exec(ctx, "deallocate all").ReadAll()
return err
}
func (c *Conn) bufferNotifications(_ *pgconn.PgConn, n *pgconn.Notification) {
c.notifications = append(c.notifications, n)
}