Replies: 1 comment 1 reply
-
Yes.
It's fine. Only thing is you have to make sure the Rows returned from Query is closed either by Next() until false or by calling Close() explicitly. All that said, while functionally you can use Query() for queries that do not return a result set, it's more idiomatic to use Exec(). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For the
database/sqlpackage,Queryis often used for read operations andExecis used for operations that don't return a data. Does this hold forpgxpool.Execvspgxpool.Query?It seems like
pgxpool.Queryworks for most of the operations (SELECT / UPDATE / CREATE / DROP etc.). Is there a risk for usingpgxpool.Queryfor all operations?Beta Was this translation helpful? Give feedback.
All reactions