Open firstone opened 7 months ago
I don't know of any way to get a reference to a pgx object directly from a *sql.Tx
. You could probably call Raw
and BeginTx
on the same *sql.Conn
to start a transaction and be able to get the underlying *pgx.Conn
-- but obviously that's a bit messy and error prone.
FYI, I confirmed this does work by calling BeginTx, creating a temp table in the tx, and then doing CopyFrom into that temp table via Raw on the same conn (not referencing the tx directly).
pgx.Tx supports CopyFrom but there seems to be no way to use it from sql driver. Raw call will only produce pgx.Conn object but I don't see a way to call CopyFrom via sql.Tx