diff --git a/src/db/db.go b/src/db/db.go index eb0b6c7..15b075f 100644 --- a/src/db/db.go +++ b/src/db/db.go @@ -45,6 +45,11 @@ type ConnOrTx interface { var pgTypeMap = pgtype.NewMap() +func init() { + // NOTE(asaf): Need to initialize it here to avoid potential race conditions later + pgTypeMap.TypeForValue(nil) +} + // Creates a new connection to the HMN database. // This connection is not safe for concurrent use. func NewConn() *pgx.Conn { diff --git a/src/hmndata/project_helper.go b/src/hmndata/project_helper.go index 0a4faa9..36a3e5b 100644 --- a/src/hmndata/project_helper.go +++ b/src/hmndata/project_helper.go @@ -152,7 +152,7 @@ func FetchProjects( } // Do the query - projectRows, err := db.Query[projectRow](ctx, dbConn, qb.String(), qb.Args()...) + projectRows, err := db.Query[projectRow](ctx, tx, qb.String(), qb.Args()...) if err != nil { return nil, oops.New(err, "failed to fetch projects") }