Skip to content

Commit

Permalink
[-] Deallocate all internal prepared statements before DISCARD
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub committed Nov 15, 2023
1 parent 33b93ba commit 3c4d54a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/pgengine/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ func (pge *PgEngine) getPgxConnConfig() *pgxpool.Config {
// some objects and/or setting changes will still exist in the session
connConfig.AfterRelease = func(pgconn *pgx.Conn) bool {
var err error
if _, err = pgconn.Exec(context.Background(), "DISCARD ALL"); err == nil {
if pgconn.DeallocateAll(context.Background()) != nil {
return false // destroy the connection in case of error
}
_, err = pgconn.Exec(context.Background(), "DISCARD ALL")
_, err = pgconn.Exec(context.Background(), "LISTEN "+quoteIdent(pge.ClientName))
}
return err == nil
Expand Down

0 comments on commit 3c4d54a

Please sign in to comment.