mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-04-18 21:44:02 +03:00
Fixes MCOL-5700, Oracle mode test results
This changeset contains fixes in Oracle mode tests and for the implementation of the CONCAT_ORACLE. Also, we harmonise our translation process with the recent changes in the server. Due to changed behavior of the server, some CREATE VIEW/EXPLAIN statements' results begun to output unexpected results and need to be fixed. Also, concatenation operation's name also changed. This lead to disabled func_concat_oracle test to be enabled to test it and it turned out that our implementation of this function was broken and need to be fixed too.
This commit is contained in:
parent
80ef84d4fd
commit
3b7e69135d
@ -3892,15 +3892,23 @@ ReturnedColumn* buildFunctionColumn(Item_func* ifp, gp_walk_info& gwi, bool& non
|
||||
cal_connection_info* ci = static_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
string funcName = ifp->func_name();
|
||||
const Schema* funcSchema = ifp->schema();
|
||||
if (funcSchema)
|
||||
if ( nullptr != dynamic_cast<Item_func_concat_operator_oracle*>(ifp))
|
||||
{
|
||||
idbassert(funcSchema->name().str);
|
||||
string funcSchemaName(funcSchema->name().str, funcSchema->name().length);
|
||||
if (funcSchemaName == "oracle_schema")
|
||||
// the condition above is the only way to recognize this particular case.
|
||||
funcName = "concat_operator_oracle";
|
||||
}
|
||||
else
|
||||
{
|
||||
const Schema* funcSchema = ifp->schema();
|
||||
if (funcSchema)
|
||||
{
|
||||
// XXX: this is a shortcut.
|
||||
funcName = funcName + "_oracle";
|
||||
idbassert(funcSchema->name().str);
|
||||
string funcSchemaName(funcSchema->name().str, funcSchema->name().length);
|
||||
if (funcSchemaName == "oracle_schema")
|
||||
{
|
||||
// XXX: this is a shortcut.
|
||||
funcName = funcName + "_oracle";
|
||||
}
|
||||
}
|
||||
}
|
||||
FuncExp* funcExp = FuncExp::instance();
|
||||
|
@ -1 +0,0 @@
|
||||
func_concat_oracle : Different table settings on different architectures
|
@ -4,12 +4,12 @@ EXPLAIN EXTENDED SELECT '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 concat_operator_oracle(concat_operator_oracle('a','b'),'c') AS "'a'||'b'||'c'"
|
||||
Note 1003 select concat(concat('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 concat_operator_oracle(concat_operator_oracle(concat_operator_oracle('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
|
||||
Note 1003 select concat(concat(concat('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
|
||||
SELECT '' || '';
|
||||
'' || ''
|
||||
|
||||
@ -148,58 +148,58 @@ 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;
|
||||
LENGTH(a||b||c) a||b||c
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
NULL NULL
|
||||
0
|
||||
1 c
|
||||
0
|
||||
0
|
||||
1 c
|
||||
1 c
|
||||
1 c
|
||||
1 b
|
||||
1 b
|
||||
1 b
|
||||
1 b
|
||||
2 bc
|
||||
0
|
||||
0
|
||||
1 c
|
||||
0
|
||||
0
|
||||
1 c
|
||||
1 b
|
||||
1 b
|
||||
2 bc
|
||||
1 a
|
||||
1 a
|
||||
1 a
|
||||
1 a
|
||||
2 ac
|
||||
1 a
|
||||
1 a
|
||||
2 ac
|
||||
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)
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
0 NULL
|
||||
NULL NULL
|
||||
0
|
||||
1 c
|
||||
0
|
||||
0
|
||||
1 c
|
||||
1 c
|
||||
1 c
|
||||
1 b
|
||||
1 b
|
||||
1 b
|
||||
1 b
|
||||
2 bc
|
||||
0
|
||||
0
|
||||
1 c
|
||||
0
|
||||
0
|
||||
1 c
|
||||
1 b
|
||||
1 b
|
||||
2 bc
|
||||
1 a
|
||||
1 a
|
||||
1 a
|
||||
1 a
|
||||
2 ac
|
||||
1 a
|
||||
1 a
|
||||
2 ac
|
||||
2 ab
|
||||
2 ab
|
||||
@ -212,14 +212,14 @@ SET sql_mode=ORACLE;
|
||||
CREATE VIEW v1 AS SELECT 'foo'||NULL||'bar' AS test;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
|
||||
v1 CREATE VIEW "v1" AS select concat(concat('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
foobar
|
||||
SET sql_mode=DEFAULT;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select oracle_schema.concat(oracle_schema.concat('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
foobar
|
||||
@ -235,7 +235,7 @@ NULL
|
||||
SET sql_mode=ORACLE;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
|
||||
v1 CREATE VIEW "v1" AS select mariadb_schema.concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
NULL
|
||||
@ -269,12 +269,12 @@ EXPLAIN EXTENDED SELECT -1<<1||1 AS a FROM DUAL;
|
||||
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 -1 << concat_operator_oracle(1,1) AS "a"
|
||||
Note 1003 select -1 << concat(1,1) AS "a"
|
||||
EXPLAIN EXTENDED SELECT -1||0<<1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(-1,0) << 1 AS "a"
|
||||
Note 1003 select concat(-1,0) << 1 AS "a"
|
||||
SELECT -1+1||1 AS a FROM DUAL;
|
||||
a
|
||||
01
|
||||
@ -285,12 +285,12 @@ EXPLAIN EXTENDED SELECT -1+1||1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(-1 + 1,1) AS "a"
|
||||
Note 1003 select concat(-1 + 1,1) AS "a"
|
||||
EXPLAIN EXTENDED SELECT -1||0+1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(-1,0) + 1 AS "a"
|
||||
Note 1003 select concat(-1,0) + 1 AS "a"
|
||||
SELECT 1*1||-1 AS a FROM DUAL;
|
||||
a
|
||||
1-1
|
||||
@ -301,12 +301,12 @@ EXPLAIN EXTENDED SELECT 1*1||-1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(1 * 1,-1) AS "a"
|
||||
Note 1003 select concat(1 * 1,-1) AS "a"
|
||||
EXPLAIN EXTENDED SELECT 1||1*-1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(1,1 * -1) AS "a"
|
||||
Note 1003 select concat(1,1 * -1) AS "a"
|
||||
SELECT -1^1||1 AS a FROM DUAL;
|
||||
a
|
||||
184467440737095516141
|
||||
@ -317,12 +317,12 @@ EXPLAIN EXTENDED SELECT -1^1||1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(-1 ^ 1,1) AS "a"
|
||||
Note 1003 select concat(-1 ^ 1,1) AS "a"
|
||||
EXPLAIN EXTENDED SELECT -1||0^1 AS a FROM DUAL;
|
||||
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 concat_operator_oracle(-1,0 ^ 1) AS "a"
|
||||
Note 1003 select concat(-1,0 ^ 1) AS "a"
|
||||
#
|
||||
# MDEV-17359 Concatenation operator || in like expression failed in sql_mode=ORACLE
|
||||
#
|
||||
@ -333,7 +333,7 @@ EXPLAIN EXTENDED SELECT 'abc' LIKE 'a'||'%';
|
||||
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 'abc' like concat_operator_oracle('a','%') AS "'abc' LIKE 'a'||'%'"
|
||||
Note 1003 select 'abc' like concat('a','%') AS "'abc' LIKE 'a'||'%'"
|
||||
SELECT 'x' FROM DUAL WHERE 11 LIKE 1||1;
|
||||
x
|
||||
x
|
||||
@ -354,7 +354,7 @@ EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat_operator_oracle('%','b') order by "test"."t1"."ord"
|
||||
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like convert(concat('%','b') using utf8mb3) order by "test"."t1"."ord"
|
||||
SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
|
||||
c1
|
||||
abc
|
||||
@ -362,7 +362,7 @@ EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat_operator_oracle(concat_operator_oracle("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
|
||||
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat(concat("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
|
||||
SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
|
||||
x
|
||||
x
|
||||
@ -370,7 +370,7 @@ EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like 'aa%'
|
||||
Note 1003 select 'x' AS "x" from "test"."t1" where concat("test"."t1"."c1","test"."t1"."c2") like 'aa%'
|
||||
SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
|
||||
x
|
||||
x
|
||||
@ -378,12 +378,12 @@ EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like concat_operator_oracle("test"."t1"."c2","test"."t1"."c1")
|
||||
Note 1003 select 'x' AS "x" from "test"."t1" where concat("test"."t1"."c1","test"."t1"."c2") like concat("test"."t1"."c2","test"."t1"."c1")
|
||||
CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord;
|
||||
EXPLAIN EXTENDED SELECT * FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat_operator_oracle("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from ("test"."t1") order by "test"."t1"."ord"
|
||||
Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from ("test"."t1") order by "test"."t1"."ord"
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -186,4 +186,4 @@ CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord;
|
||||
EXPLAIN EXTENDED SELECT * FROM v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -29,7 +29,7 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
|
||||
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 decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
|
||||
Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
|
||||
CREATE TABLE decode (decode int);
|
||||
DROP TABLE decode;
|
||||
#
|
||||
@ -47,22 +47,22 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11');
|
||||
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 decode_oracle(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
|
||||
Note 1003 select decode(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
|
||||
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
|
||||
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 decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
|
||||
Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
|
||||
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11');
|
||||
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 decode_oracle(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
|
||||
Note 1003 select decode(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
|
||||
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11','def');
|
||||
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 decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
|
||||
Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE VIEW v1 AS
|
||||
SELECT
|
||||
@ -73,7 +73,7 @@ DECODE_ORACLE(a,1,'x1',NULL,'xNULL','xELSE') AS d4
|
||||
FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
|
||||
v1 CREATE VIEW "v1" AS select decode("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
SELECT DECODE(TIME'10:20:31','10:20:31','then1','10:20:32','then2','def');
|
||||
|
@ -22,11 +22,11 @@ EXPLAIN EXTENDED SELECT REPLACE('ab','a',null) ;
|
||||
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 replace_oracle('ab','a',NULL) AS "REPLACE('ab','a',null)"
|
||||
Note 1003 select replace('ab','a',NULL) AS "REPLACE('ab','a',null)"
|
||||
CREATE VIEW v1 AS SELECT REPLACE('ab','a',null) ;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select replace_oracle('ab','a',NULL) AS "REPLACE('ab','a',null)" latin1 latin1_swedish_ci
|
||||
v1 CREATE VIEW "v1" AS select replace('ab','a',NULL) AS "REPLACE('ab','a',null)" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
REPLACE('ab','a',null)
|
||||
b
|
||||
|
@ -117,13 +117,13 @@ TRIM(TRAILING 'a' FROM 'abc') ;
|
||||
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 trim_oracle('abc') AS "TRIM('abc')",trim_oracle(both 'a' from 'abc') AS "TRIM(BOTH 'a' FROM 'abc')",trim_oracle(leading 'a' from 'abc') AS "TRIM(LEADING 'a' FROM 'abc')",trim_oracle(trailing 'a' from 'abc') AS "TRIM(TRAILING 'a' FROM 'abc')"
|
||||
Note 1003 select trim('abc') AS "TRIM('abc')",trim(both 'a' from 'abc') AS "TRIM(BOTH 'a' FROM 'abc')",trim(leading 'a' from 'abc') AS "TRIM(LEADING 'a' FROM 'abc')",trim(trailing 'a' from 'abc') AS "TRIM(TRAILING 'a' FROM 'abc')"
|
||||
EXPLAIN EXTENDED SELECT RTRIM('abc'),
|
||||
LTRIM('abc');
|
||||
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 rtrim_oracle('abc') AS "RTRIM('abc')",ltrim_oracle('abc') AS "LTRIM('abc')"
|
||||
Note 1003 select rtrim('abc') AS "RTRIM('abc')",ltrim('abc') AS "LTRIM('abc')"
|
||||
CREATE VIEW v1 AS SELECT ord,TRIM('abc'),RTRIM('abc'),LTRIM('abc'),
|
||||
'['||c1||']',
|
||||
TRIM(LEADING 'a' FROM c1),
|
||||
@ -134,7 +134,7 @@ RTRIM(c1)
|
||||
FROM t1 ORDER BY ord ;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select "t1"."ord" AS "ord",trim_oracle('abc') AS "TRIM('abc')",rtrim_oracle('abc') AS "RTRIM('abc')",ltrim_oracle('abc') AS "LTRIM('abc')",concat_operator_oracle(concat_operator_oracle('[',"t1"."c1"),']') AS "'['||c1||']'",trim_oracle(leading 'a' from "t1"."c1") AS "TRIM(LEADING 'a' FROM c1)",trim_oracle(trailing 'a' from "t1"."c1") AS "TRIM(TRAILING 'a' FROM c1)",trim_oracle(both 'a' from "t1"."c1") AS "TRIM(BOTH 'a' FROM c1)",ltrim_oracle("t1"."c1") AS "LTRIM(c1)",rtrim_oracle("t1"."c1") AS "RTRIM(c1)" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
|
||||
v1 CREATE VIEW "v1" AS select "t1"."ord" AS "ord",trim('abc') AS "TRIM('abc')",rtrim('abc') AS "RTRIM('abc')",ltrim('abc') AS "LTRIM('abc')",concat(concat('[',"t1"."c1"),']') AS "'['||c1||']'",trim(leading 'a' from "t1"."c1") AS "TRIM(LEADING 'a' FROM c1)",trim(trailing 'a' from "t1"."c1") AS "TRIM(TRAILING 'a' FROM c1)",trim(both 'a' from "t1"."c1") AS "TRIM(BOTH 'a' FROM c1)",ltrim("t1"."c1") AS "LTRIM(c1)",rtrim("t1"."c1") AS "RTRIM(c1)" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
ord TRIM('abc') RTRIM('abc') LTRIM('abc') '['||c1||']' TRIM(LEADING 'a' FROM c1) TRIM(TRAILING 'a' FROM c1) TRIM(BOTH 'a' FROM c1) LTRIM(c1) RTRIM(c1)
|
||||
1 abc abc abc [abc] bc abc bc abc abc
|
||||
|
@ -46,25 +46,21 @@ string Func_concat_oracle::getStrVal(Row& row, FunctionParm& parm, bool& isNull,
|
||||
{
|
||||
string ret;
|
||||
string tmp;
|
||||
stringValue(parm[0], row, isNull, ret);
|
||||
// Oracle Mode should replace NULL with "" unless all values are NULL
|
||||
if (isNull)
|
||||
{
|
||||
ret = "";
|
||||
isNull = false;
|
||||
}
|
||||
// we default to true as any non-NULL operand will reset it to false
|
||||
// and all NULL operands will leave it as true, which is intended.
|
||||
isNull = true;
|
||||
// TODO: do a better job of cutting down the number re-allocations.
|
||||
// look at Item_func_concat::realloc_result for ideas and use
|
||||
// std::string:resize() appropriatly.
|
||||
for (unsigned int id = 1; id < parm.size(); id++)
|
||||
for (unsigned int id = 0; id < parm.size(); id++)
|
||||
{
|
||||
stringValue(parm[id], row, isNull, tmp);
|
||||
if (isNull)
|
||||
bool tempIsNull = false;
|
||||
stringValue(parm[id], row, tempIsNull, tmp);
|
||||
if (!tempIsNull)
|
||||
{
|
||||
tmp = "";
|
||||
isNull = false;
|
||||
ret.append(tmp);
|
||||
}
|
||||
ret.append(tmp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user