[MDEV-27455] SHOW GRANTS causes commands out of sync errors in cursor protocol Created: 2022-01-09  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Protocol, Server
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: None


 Description   

SHOW GRANTS (and probably many more statements) fail with CR_COMMANDS_OUT_OF_SYNC upon execute with CURSOR_TYPE_READ_ONLY. For example, with MTR

Run with --cursor-protocol

show grants;

10.2 5d57e04b

mysqltest: At line 1: query 'show grants' failed: 2014: Commands out of sync; you can't run this command now

I'm getting the same error with something like

  const char* query="show grants";
 
  mysql_stmt_prepare(stmt,query,strlen(query));
  unsigned long cursor = CURSOR_TYPE_READ_ONLY;
  mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor);
 
  if (mysql_stmt_execute(stmt))
    fprintf(stderr,"Got error on execute of query: %s\n", mysql_stmt_error(stmt));
  else
    fprintf(stderr,"Didn't get an error on execute of query\n");
 
  mysql_stmt_fetch(stmt);

So chances are, it's not mysqltest problem.

Reproducible with libmariadb but not with libmysqlclient from 10.1 or from MySQL 8.0.


Generated at Thu Feb 08 09:53:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.