-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Protocol level transaction support #170
Comments
hello @LjPalle , while it's possible to completely customize My proposal is to add new member in our
An alternative idea for fetch is to add new member called I'd like to know your idea for this when you are writing a transaction-enable application based on this library. Also one more question, is it for |
Hey @sunng87, I tweaked pgwire for my purposes in the following way:
This was an expedient way for me to solve this issue, but I'm not sure whether it is the best. Yeah, I think this should include |
Thank you @LjPalle For tag inclusion, I think it's totally OK to put a name into For transaction state, the reasons why I'm not maintaining it with the client are:
But I think it's totally OK for your own application to track it that way since you have full control how the state is used. |
Yeah sure, I'll send a pull request when I find the time. Regard the state transition, won't the user need to somehow update or signal it anyway? |
My idea is we only allow user to update it via return value of |
Ah, ok, now I understand what you meant. But note that one still has to store the transaction state somewhere since the ReadyForQuery message is sent even after parse and describe requests (unless the plan is to change their interface too). |
Hi, Is it possible to handle transactions yet? Simple Query Handler:
Extended Query Handler:
It's unclear what the response to start transaction should be. Investigating for postgres_fdw the cursor response needs to be a non-error so in theory getting past the transaction it should be possible to respond to the fetches. Any pointers are much appreciated. |
@syedzayyan At the moment, we haven't cover transaction state in this library. You might be able to track it with a custom field in For users who has a scenario for this, contribution or just ideas are welcomed. |
Is there anything I can do to help? I'm implementing a POC of a DB engine that requires transactions. |
@jennykwan thank you! The transaction support is almost finished in #200. I just need more time to review, document and test it. But note that in this library, we only have wire protocol level transaction semantic support. If you are implementing a transactional database, you will need to build internals by yourself. |
Thanks, @sunng87 ! Out of curiosity, are the changes in the PR compatible with
|
I just added an example to #200 and it's able to control the psql prompts like:
This prompt is controlled by transaction state in postgres message readyForQuery. |
Perfect! Thank you! |
(Only slightly related to: #79)
So I encountered some problems regarding transactions on the network protocol level when communicating with certain clients. I found two places where transactions are relevant in the PostgreSQL protocol.
One is in the ReadyForQuery message which carries a status flag (see https://www.postgresql.org/docs/current/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-READYFORQUERY) - it seems that pgwire currently uses only the "idle" status and the library user cannot change this after e.g. a client sends a "BEGIN" query.
The other place is the tag of the CommandComplete message (see https://www.postgresql.org/docs/current/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-COMMANDCOMPLETE) - currently pgwire always uses the "SELECT" tag whenever rows are returned, but e.g. a fetch may also retrieve rows during a transaction and in this case a "FETCH" tag is expected, so the library user should be able to specify the tag in this case too.
The text was updated successfully, but these errors were encountered: