Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4278d6d4
Commit
4278d6d4
authored
Sep 10, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF
parent
416b811a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
7 deletions
+50
-7
mysql-test/r/explain_json.result
mysql-test/r/explain_json.result
+20
-0
mysql-test/t/explain_json.test
mysql-test/t/explain_json.test
+7
-0
sql/item.cc
sql/item.cc
+3
-3
sql/item_subselect.cc
sql/item_subselect.cc
+1
-1
sql/mysqld.h
sql/mysqld.h
+18
-2
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
No files found.
mysql-test/r/explain_json.result
View file @
4278d6d4
...
...
@@ -1070,3 +1070,23 @@ EXPLAIN
}
}
drop table t1;
#
# MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('b');
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "(t1.a = _latin1'\xDF')"
}
}
}
DROP TABLE t1;
mysql-test/t/explain_json.test
View file @
4278d6d4
...
...
@@ -279,3 +279,10 @@ explain format=json select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') a
drop
table
t1
;
--
echo
#
--
echo
# MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
'a'
),(
'b'
);
EXPLAIN
FORMAT
=
JSON
SELECT
*
FROM
t1
WHERE
a
=
_latin1
0xDF
;
DROP
TABLE
t1
;
sql/item.cc
View file @
4278d6d4
...
...
@@ -2495,8 +2495,8 @@ void Item_ident::print(String *str, enum_query_type query_type)
When printing EXPLAIN, don't print database name when it's the same as
current database.
*/
bool
skip_db
=
(
query_type
&
QT_
EXPLAIN
)
&&
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db_name
);
bool
skip_db
=
(
query_type
&
QT_
ITEM_IDENT_SKIP_CURRENT_DATABASE
)
&&
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db_name
);
if
(
!
skip_db
&&
!
(
cached_table
&&
cached_table
->
belong_to_view
&&
cached_table
->
belong_to_view
->
compact_view_format
))
...
...
@@ -7601,7 +7601,7 @@ void Item_cache_wrapper::init_on_demand()
void
Item_cache_wrapper
::
print
(
String
*
str
,
enum_query_type
query_type
)
{
if
(
query_type
==
QT_EXPLAIN
)
if
(
query_type
&
QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS
)
{
/* Don't print the cache in EXPLAIN EXTENDED */
orig_item
->
print
(
str
,
query_type
);
...
...
sql/item_subselect.cc
View file @
4278d6d4
...
...
@@ -899,7 +899,7 @@ void Item_subselect::update_used_tables()
void
Item_subselect
::
print
(
String
*
str
,
enum_query_type
query_type
)
{
if
(
query_type
==
QT_EXPLAIN
)
if
(
query_type
&
QT_ITEM_SUBSELECT_ID_ONLY
)
{
str
->
append
(
"(subquery#"
);
if
(
unit
&&
unit
->
first_select
())
...
...
sql/mysqld.h
View file @
4278d6d4
...
...
@@ -647,12 +647,28 @@ enum enum_query_type
QT_WITHOUT_INTRODUCERS
=
(
1
<<
1
),
/// view internal representation (like QT_ORDINARY except ORDER BY clause)
QT_VIEW_INTERNAL
=
(
1
<<
2
),
/// If identifiers should not include database names for the current database
QT_ITEM_IDENT_SKIP_CURRENT_DATABASE
=
(
1
<<
3
),
/// If Item_cache_wrapper should not print <expr_cache>
QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS
=
(
1
<<
4
),
/// If Item_subselect should print as just "(subquery#1)"
/// rather than display the subquery body
QT_ITEM_SUBSELECT_ID_ONLY
=
(
1
<<
5
),
/// This value means focus on readability, not on ability to parse back, etc.
QT_EXPLAIN
=
(
1
<<
4
)
QT_EXPLAIN
=
QT_TO_SYSTEM_CHARSET
|
QT_ITEM_IDENT_SKIP_CURRENT_DATABASE
|
QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS
|
QT_ITEM_SUBSELECT_ID_ONLY
,
/// This is used for EXPLAIN EXTENDED extra warnings
/// Be more detailed than QT_EXPLAIN.
/// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE
/// here, as it would give better readable results
QT_EXPLAIN_EXTENDED
=
QT_TO_SYSTEM_CHARSET
};
/* query_id */
typedef
int64
query_id_t
;
extern
query_id_t
global_query_id
;
...
...
sql/sql_parse.cc
View file @
4278d6d4
...
...
@@ -5812,7 +5812,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
The warnings system requires input in utf8, @see
mysqld_show_warnings().
*/
lex
->
unit
.
print
(
&
str
,
QT_
TO_SYSTEM_CHARSET
);
lex
->
unit
.
print
(
&
str
,
QT_
EXPLAIN_EXTENDED
);
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_NOTE
,
ER_YES
,
str
.
c_ptr_safe
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment