FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix issue with client-server out-of-sync in case of permission error … by olesz · Pull Request #580 · vertica/vertica-python · GitHub

Fix issue with client-server out-of-sync in case of permission error … - #580

Open
olesz wants to merge 1 commit into
vertica:masterfrom
olesz:out_of_sync_issue
Open

olesz wants to merge 1 commit into
vertica:masterfrom
olesz:out_of_sync_issue

Conversation

olesz commented Feb 13, 2026

Copy link
Copy Markdown

Fixes bug (#579)

It seems that the vertica client had an issue consuming ReadyForQuery messages when prepared statements are used and several consecutive queries are rejected with permission error.

Faulty sequence of messages:

2026-02-14 00:26:48.116 [cursor] 2563516822224/13328:0x6a80 <INFO> Bind parameters: ()
2026-02-14 00:26:48.117 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Bind
2026-02-14 00:26:48.117 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Execute
2026-02-14 00:26:48.118 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Sync
2026-02-14 00:26:48.118 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Flush
2026-02-14 00:26:48.119 [connection] 2563516822224/13328:0x6a80 <DEBUG> <= ErrorResponse: Severity: ERROR, Message: Permission denied for relation preparedstmt_test, Sqlstate: 42501, Routine: report_no_priv, File: /data/jenkins/workspace/RE-ReleaseBuilds/RE-Miner/server/vertica/Commands/GrantRevoke.cpp, Line: 532, Error Code: 4367
2026-02-14 00:26:48.119 [connection] 2563516822224/13328:0x6a80 <DEBUG> <= ReadyForQuery: status = in_transaction
2026-02-14 00:26:48.119 [cursor] 2563516822224/13328:0x6a80 <INFO> Bind parameters: ()
2026-02-14 00:26:48.119 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Bind
2026-02-14 00:26:48.120 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Execute
2026-02-14 00:26:48.120 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Sync
2026-02-14 00:26:48.120 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Flush
2026-02-14 00:26:48.121 [connection] 2563516822224/13328:0x6a80 <DEBUG> <= ErrorResponse: Severity: ERROR, Message: Permission denied for relation preparedstmt_test, Sqlstate: 42501, Routine: report_no_priv, File: /data/jenkins/workspace/RE-ReleaseBuilds/RE-Miner/server/vertica/Commands/GrantRevoke.cpp, Line: 532, Error Code: 4367
2026-02-14 00:26:48.122 [cursor] 2563516822224/13328:0x6a80 <INFO> Bind parameters: ()
2026-02-14 00:26:48.122 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Bind
2026-02-14 00:26:48.122 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Execute
2026-02-14 00:26:48.122 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Sync
2026-02-14 00:26:48.123 [connection] 2563516822224/13328:0x6a80 <DEBUG> => Flush
2026-02-14 00:26:48.123 [connection] 2563516822224/13328:0x6a80 <DEBUG> <= ReadyForQuery: status = in_transaction

It seems that when a permission denied error is happening then the server replies with ErrorResponse and ReadyForQuery.

First attempt:

  • self._message in cursor.py is None
  • trying to read BindComplete in _execute_prepared_statement() but ErrorResponse is found -> self._message in cursor.py is sill None
  • ReadyForQuery after ErrorResponse is not consumed

Second attempt:

  • self._message in cursor.py is None
  • ReadyForQuery in buffer is consumed in execute() and stored to self._message
  • trying to read BindComplete in _execute_prepared_statement() but ErrorResponse is found -> self._message in cursor.py is now ReadyForQuery
  • ReadyForQuery after ErrorResponse is not consumed

Third attempt:

  • self._message in cursor.py is ReadyForQuery
  • ReadyForQuery is not consumed in execute() because self._message is ReadyForQuery
  • trying to read BindComplete in _execute_prepared_statement() but ReadyForQuery is found -> raising this anomaly as an exception

This fix introduces an error handler for the prepared statement execution to always set the ErrorResponse as self._message to make it possible for the flush_to_query_ready() in execute() to consume and store ReadyForQuery
Also integration test is added.

CLAassistant commented Feb 13, 2026 •
edited
Loading

Copy link
Copy Markdown


All committers have signed the CLA.

olesz force-pushed the out_of_sync_issue branch 3 times, most recently from ff1527d to 579c679 Compare February 16, 2026 08:06
olesz force-pushed the out_of_sync_issue branch from 579c679 to 355cd0c Compare February 16, 2026 08:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL