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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
839e0947
Commit
839e0947
authored
Feb 27, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12143 sql_mode=ORACLE: make the CONCAT function ignore NULL arguments
parent
915c5df8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
1 deletion
+42
-1
mysql-test/suite/compat/oracle/r/func_concat.result
mysql-test/suite/compat/oracle/r/func_concat.result
+34
-0
mysql-test/suite/compat/oracle/t/func_concat.test
mysql-test/suite/compat/oracle/t/func_concat.test
+2
-0
sql/item_create.cc
sql/item_create.cc
+3
-1
sql/item_strfunc.h
sql/item_strfunc.h
+3
-0
No files found.
mysql-test/suite/compat/oracle/r/func_concat.result
View file @
839e0947
...
...
@@ -4,6 +4,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select 'a' || 'b' || 'c' AS "'a'||'b'||'c'"
EXPLAIN EXTENDED SELECT CONCAT('a'||'b'||'c');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select 'a' || 'b' || 'c' AS "CONCAT('a'||'b'||'c')"
SELECT '' || '';
'' || ''
...
...
@@ -169,4 +174,33 @@ NULL NULL
2 ab
2 ab
3 abc
SELECT LENGTH(CONCAT(a||b||c)), CONCAT(a||b||c) FROM t1 ORDER BY a,b,c;
LENGTH(CONCAT(a||b||c)) CONCAT(a||b||c)
NULL NULL
0
1 c
0
0
1 c
1 b
1 b
2 bc
0
0
1 c
0
0
1 c
1 b
1 b
2 bc
1 a
1 a
2 ac
1 a
1 a
2 ac
2 ab
2 ab
3 abc
DROP TABLE t1;
mysql-test/suite/compat/oracle/t/func_concat.test
View file @
839e0947
...
...
@@ -5,6 +5,7 @@
SET
sql_mode
=
ORACLE
;
EXPLAIN
EXTENDED
SELECT
'a'
||
'b'
||
'c'
;
EXPLAIN
EXTENDED
SELECT
CONCAT
(
'a'
||
'b'
||
'c'
);
SELECT
''
||
''
;
SELECT
''
||
'b'
;
...
...
@@ -79,5 +80,6 @@ INSERT INTO t1 VALUES (NULL, NULL, 'c');
INSERT
INTO
t1
VALUES
(
NULL
,
NULL
,
NULL
);
SELECT
LENGTH
(
a
||
b
||
c
),
a
||
b
||
c
FROM
t1
ORDER
BY
a
,
b
,
c
;
SELECT
LENGTH
(
CONCAT
(
a
||
b
||
c
)),
CONCAT
(
a
||
b
||
c
)
FROM
t1
ORDER
BY
a
,
b
,
c
;
DROP
TABLE
t1
;
sql/item_create.cc
View file @
839e0947
...
...
@@ -3857,7 +3857,9 @@ Create_func_concat::create_native(THD *thd, LEX_STRING name,
return
NULL
;
}
return
new
(
thd
->
mem_root
)
Item_func_concat
(
thd
,
*
item_list
);
return
thd
->
variables
.
sql_mode
&
MODE_ORACLE
?
new
(
thd
->
mem_root
)
Item_func_concat_operator_oracle
(
thd
,
*
item_list
)
:
new
(
thd
->
mem_root
)
Item_func_concat
(
thd
,
*
item_list
);
}
Create_func_decode_histogram
Create_func_decode_histogram
::
s_singleton
;
...
...
sql/item_strfunc.h
View file @
839e0947
...
...
@@ -297,6 +297,9 @@ class Item_func_concat :public Item_str_func
class
Item_func_concat_operator_oracle
:
public
Item_func_concat
{
public:
Item_func_concat_operator_oracle
(
THD
*
thd
,
List
<
Item
>
&
list
)
:
Item_func_concat
(
thd
,
list
)
{
}
Item_func_concat_operator_oracle
(
THD
*
thd
,
Item
*
a
,
Item
*
b
)
:
Item_func_concat
(
thd
,
a
,
b
)
{
}
...
...
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