Opened 3 years ago

Last modified 2 years ago

#342 new enhancement

Need access to underlying PGconn* from pqxx::connection

Reported by:… Owned by: jtv
Priority: normal Component: other
Severity: Other Keywords:



I need to do some bulk copying and I need access to PGconn* to do this. I tried to use pgxx::tablewriter but could not get it to work - probably for lack of examples. pgxx::tablewriter also appears to write one record at a time, when I want to submit an entire buffer of records in one go. However, I have not found a way to get the underlying PGconn* pointer that pqxx::connection uses. I think it would make sense to add a member that returns the underlying PGconn* when trying to use functionality unsupported by pqxx.

Many thanks, Best Regards, Peter Ritter

Change History (1)

comment:1 Changed 3 years ago by jtv

The PGconn is completely hidden by design — that's not something I'd like to change.

But there are probably things you can do: if you're just copying data within the database, the absolute fastest way is to write the SQL to do that directly without ever even pulling the data to your client program.

I was going to retire tablereader and tablewriter, but maybe they are what you need after all: you can pipe a tablereader straight into a tablewriter. Another option would be to compose a large INSERT statement for multiple rows. And finally, you could create a pipeline to create and execute multiple INSERT commands without always waiting for the previous one to complete.

Note: See TracTickets for help on using tickets.