sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.42k stars 436 forks source link

Consider adding a `simple_query` method to `GenericClient` #1069

Open and-reas-se opened 11 months ago

and-reas-se commented 11 months ago

It seems like an oversight that the trait GenericClient doesn't have a simple_query method, when both types that implement it have that method. If you have a GenericClient you can call simple_query indirectly by starting a transaction and then calling it on the Transaction you get, but you can't just call it directly.

I ran into it when writing a function to do migrations. I wanted to start the transaction in the caller and have my function take a GenericClient,, but instead had to start the transaction inside the function to get access to the method in question.

Not a big deal, but I thought I'd point out the discrepancy.

sfackler commented 11 months ago

Huh, yeah it looks like it's missing from tokio-postgres's for some reason - strange! Happy to take a PR adding it, or I can do it when I have a chance.