[MDEV-10657] incorrect result returned with binary protocol (prepared statements) Created: 2016-08-24  Updated: 2017-12-27  Resolved: 2017-12-27

Status: Closed
Project: MariaDB Server
Component/s: Prepared Statements
Affects Version/s: 5.5, 10.0, 10.1, 10.2
Fix Version/s: 5.5.59, 10.0.34, 10.2.12, 10.3.4, 10.1.31

Type: Bug Priority: Major
Reporter: Oleksandr Byelkin Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to CONJ-338 Inconsistent/wrong resultset when usi... Closed
Sprint: 10.2.11, 10.2.12

 Description   

runnig following test suite with and without --ps-protocol produce different results.

create table  DUPPP (code varchar(10) primary key);
INSERT INTO DUPPP(code) VALUES ('LINE1'), ('LINE2'), ('LINE3');
SELECT X.* FROM (SELECT CODE, RN FROM (SELECT A.CODE, @cnt := @cnt + 1 AS RN FROM  DUPPP A, (SELECT @cnt := 0) C) T) X;
drop table DUPP;

normal execution:

CODE	RN
LINE1	1
LINE2	2
LINE3	3

with --ps-protocol:

CODE	RN
LINE3	3
LINE3	3
LINE3	3



 Comments   
Comment by Diego Dupin [ 2016-08-24 ]

to reproduced it easily on heidi with a query a little simpler:

prepare test from "SELECT * FROM (SELECT * FROM (SELECT seq FROM seq_1_to_3, (SELECT @cnt := 0) C) T) X";
execute test ;

will be :

3
3
3

Comment by Oleksandr Byelkin [ 2017-11-13 ]

OK, sequences appeared later than 5.5, but the bug present in 5.5 so the first test suite sill in use

Comment by Oleksandr Byelkin [ 2017-11-14 ]

there is no diferences in Item_func_set_user_var::update calls.

Comment by Oleksandr Byelkin [ 2017-12-18 ]

The difference is that in binary protocol fields of table T instaed of X somehow used.

Comment by Oleksandr Byelkin [ 2017-12-19 ]

Prepare decide to merge X, then execution to materialize X.

Comment by Oleksandr Byelkin [ 2017-12-19 ]

During statement prepare unit->prepared is set for X and so translation table created.

Comment by Oleksandr Byelkin [ 2017-12-20 ]

Github tree: bb-5.5-MDEV-10657

revision-id: 24b4585ad0648f21519f47a04762e1b208918749 (mariadb-5.5.58-18-g24b4585ad06)
parent(s): 924db8b4ed3f268cbe91a1734611f4dc2311c7be
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2017-12-20 13:52:27 +0100
message:

MDEV-10657: incorrect result returned with binary protocol (prepared statements)

If translation table present when we materialize the derived table then
change it to point on the materialized table.

Added debug info to see really what happens with what derived.

Comment by Igor Babaev [ 2017-12-24 ]

Sanja, see your email with my review.

Generated at Thu Feb 08 07:43:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.