Skip to content

Calling a sproc with an identifier that needs qualifying fails #1206

Open
@soshtolsus

Description

@soshtolsus

Describe the bug
When calling a stored procedure via Cursor.callproc, if the identifier for that sproc requires qualification (e.g. backticks), the call fails, often returning an "access denied" error because the user doesn't have EXECUTE access to the non-existent sproc.

Additionally, when calling callproc with args, the call fails worse because of the server variable identifier composition.

To Reproduce
Complete steps to reproduce the behavior:

Schema:

CREATE DATABASE xxx;
CREATE TABLE xxx.yyy (
    id int not null auto_increment primary key
);
DELIMITER //
CREATE PROCEDURE xxx.`yyy.blah` (
  arg1
)
BEGIN
  select 1;
END//
DELIMITER ;

Code:

import pymysql

with pymysql.connect(...) as conn:
  with conn.cursor() as cursor:
    cursor.callproc('yyy.blah', args=(18,))

Expected behavior

  • xxx.\yyy.blah`` should be called
  • @_yyy.blah_0 should exist and be set to 18

Environment

  • OS: Linux (confirmed on Centos 7)
  • Server and version: MariaDB 10.1
  • PyMySQL version: 0.8.1 (but confirmed that the code in question is unchanged in master)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions