jeroenrinzema / psql-wire

PostgreSQL server wire protocol. Build your own server and start serving connections.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include the ability to catch sync messages in order to

github-actions opened this issue · comments

close the current transaction.

At completion of each series of extended-query messages, the frontend
should issue a Sync message. This parameterless message causes the
backend to close the current transaction if it's not inside a
BEGIN/COMMIT transaction block (“close” meaning to commit if no
error, or roll back if error). Then a ReadyForQuery response is
issued. The purpose of Sync is to provide a resynchronization point
for error recovery. When an error is detected while processing any
extended-query message, the backend issues ErrorResponse, then reads
and discards messages until a Sync is reached, then issues
ReadyForQuery and returns to normal message processing. (But note
that no skipping occurs if an error is detected while processing Sync
— this ensures that there is one and only one ReadyForQuery sent for
each Sync.)
https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY

Line: 117

psql-wire//command.go

Lines 114 to 124 in 3dbc832

switch t {
case types.ClientSync:
// TODO: Include the ability to catch sync messages in order to
// close the current transaction.
//
// At completion of each series of extended-query messages, the frontend
// should issue a Sync message. This parameterless message causes the
// backend to close the current transaction if it's not inside a
// BEGIN/COMMIT transaction block (“close” meaning to commit if no
// error, or roll back if error). Then a ReadyForQuery response is