Federated table returns error 1430 from storage engine

Bug #1739734 reported by Wolfgang Walther on 2017-12-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Fix Released
High
Zsolt Parragi
5.6
Fix Released
High
Zsolt Parragi
5.7
Fix Released
High
Zsolt Parragi

Bug Description

This is a bug introduced in 5.6.38-83.0. It was not there in 5.6.37-82.2. It seems to be percona specific (not mysql) and probably related to this commit:
https://github.com/percona/percona-server/commit/59eff2e4e870f3a87ade9d4b55dea5d47a2ba62b
which changes
storage/federated/ha_federated.cc

The cases in this switch were probably designed as conditionally fall-through on purpose - this change breaks this behaviour and leads to a wrong SQL query built to access the remote server.

Test case:

-- use this server as remote and local server for test-case
-- bug behaviour is the same with 'real' remote server
DROP SERVER IF EXISTS local_server;
CREATE SERVER local_server
FOREIGN DATA WRAPPER mysql
OPTIONS (
  HOST '127.0.0.1',
  PORT 3306,
  USER 'USER',
  PASSWORD 'PASS',
  DATABASE 'test'
);

-- create sample table
DROP TABLE IF EXISTS test.remote_table;
CREATE TABLE test.remote_table (
  a INT,
  b INT,
  KEY ab (a,b),
  KEY ba (b,a)
);

-- create federated table pointing to table above
DROP TABLE IF EXISTS test.local_table;
CREATE TABLE test.local_table (
  a INT,
  b INT,
  KEY ab (a,b),
  KEY ba (b,a)
) ENGINE=federated CONNECTION='local_server/remote_table';

-- ok
SELECT * FROM test.local_table;

-- ok
SELECT * FROM test.local_table USE INDEX (ab)
WHERE a<1 AND b=0;

-- returns: Error Code: 1030. Got error 1430 from storage engine
SELECT * FROM test.local_table USE INDEX (ba)
WHERE a<1 AND b=0;

This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers