Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction Priority Support #1643

Closed
HeCorr opened this issue Jun 14, 2023 · 3 comments
Closed

Transaction Priority Support #1643

HeCorr opened this issue Jun 14, 2023 · 3 comments

Comments

@HeCorr
Copy link

HeCorr commented Jun 14, 2023

Is your feature request related to a problem? Please describe.
CockroachDB supports Transaction Priorities which allow a transaction to be executed before the others, but pgx doesn't seem to support it.

Describe the solution you'd like
I would like for pgx to support setting the transaction priority via pgx.TxOptions.

Describe alternatives you've considered
It should be possible to manually set the transaction priority after it has been created (BeginTx) with the SET TRANSACTION query but I haven't tried that.

Additional context
From what I can tell, Postgres does not support transaction priorities so it might be necessary to check which database pgx is connected to before applying the option (is that even possible though?).

@jackc
Copy link
Owner

jackc commented Jun 16, 2023

I'm reluctant to add direct support to non-PostgreSQL features. In most cases it isn't an issue because those features are accessed via the query string passed to Query or Exec. I suppose that a BeginQuery string field added to pgx.TxOptions might be a solution. If that string is not empty then it is used to start the transaction instead.

@HeCorr
Copy link
Author

HeCorr commented Jun 18, 2023

I'm reluctant to add direct support to non-PostgreSQL features.

Understandable.

I suppose that a BeginQuery string field added to pgx.TxOptions might be a solution.

Yeah that sounds good enough :)

@jackc
Copy link
Owner

jackc commented Jun 18, 2023

Done in 9a5ead9.

@jackc jackc closed this as completed Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants