Skip to content

SQL parser error trying to run a prepared statement #14162

Closed
@peterchaula

Description

@peterchaula

Steps to reproduce

Ran this query in the inline query box


 USE test;
 CREATE TABLE t1 (a INT NOT NULL);
 INSERT INTO t1 VALUES (4), (8), (11), (32), (80);

 SET @table = 't1';
 SET @s = CONCAT('SELECT * FROM ', @table);

PREPARE stmt3 FROM @s;
 EXECUTE stmt3;

DEALLOCATE PREPARE stmt3;

Expected behaviour

Must run query

Actual behaviour

Throws error:

Fatal error: Uncaught Error: Call to a member function getClauses() on null in /var/www/pma/libraries/sql-parser/src/Utils/Query.php:548 Stack trace: #0 /var/www/pma/libraries/sql-parser/src/Utils/Query.php(665): SqlParser\Utils\Query::getClause(NULL, NULL, 'ORDER BY', -1, false) #1 /var/www/pma/libraries/DisplayResults.php(1386): SqlParser\Utils\Query::replaceClause(NULL, NULL, 'ORDER BY', '') #2 /var/www/pma/libraries/DisplayResults.php(4369): PMA\libraries\DisplayResults->_getUnsortedSqlAndSortByKeyDropDown(Array, '') #3 /var/www/pma/libraries/sql.lib.php(1689): PMA\libraries\DisplayResults->getTable(Object(mysqli_result), Array, Array, false) #4 /var/www/pma/libraries/sql.lib.php(1980): PMA_getHtmlForSqlQueryResultsTable(Object(PMA\libraries\DisplayResults), './themes/pmahom...', NULL, Array, false, 5, 5, NULL, Object(mysqli_result), Array) #5 /var/www/pma/libraries/sql.lib.php(2199): PMA_getQueryResponseForResultsReturned(Object(mysqli_result), Array, 'test', '', NULL, NULL, Object(PMA\libraries\DisplayResults), './t in /var/www/pma/libraries/sql-parser/src/Utils/Query.php on line 548

image

Server configuration

Operating system: Debian Jessie

Web server: Apache 2.3

Database: Mariadb

PHP version: 7.2

phpMyAdmin version: 4.6.5.1

Client configuration

Browser: Firefox

Operating system: Ubuntu 16.04

Metadata

Metadata

Assignees

Labels

BugA problem or regression with an existing featureduplicateparser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions