Skip to content

Commit

Permalink
Merge branch '10.4' into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadb-YuchenPei committed Jan 10, 2024
2 parents 0b61261 + bc3d416 commit c9902a2
Show file tree
Hide file tree
Showing 64 changed files with 520 additions and 144 deletions.
6 changes: 6 additions & 0 deletions mysql-test/lib/mtr_cases.pm
Expand Up @@ -892,6 +892,12 @@ sub collect_one_test_case {
}
my @no_combs = grep { $test_combs{$_} == 1 } keys %test_combs;
if (@no_combs) {
if ($::opt_skip_not_found) {
push @{$tinfo->{combinations}}, @no_combs;
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "combination not found";
return $tinfo;
}
mtr_error("Could not run $name with '".(
join(',', sort @no_combs))."' combination(s)");
}
Expand Down
3 changes: 0 additions & 3 deletions mysql-test/main/cast.test
Expand Up @@ -768,14 +768,11 @@ INSERT INTO t1 VALUES (-1.0);
SELECT * FROM t1;
DROP TABLE t1;

#enable after MDEV-32645 is fixed
--disable_view_protocol
SELECT CAST(-1e0 AS UNSIGNED);
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (-1e0);
SELECT * FROM t1;
DROP TABLE t1;
--enable_view_protocol

SELECT CAST(-1e308 AS UNSIGNED);
CREATE TABLE t1 (a BIGINT UNSIGNED);
Expand Down
45 changes: 45 additions & 0 deletions mysql-test/main/cte_nonrecursive.result
Expand Up @@ -2624,4 +2624,49 @@ a
1
1
DROP TABLE t1;
#
# MDEV-31657: CTE with the same name as base table used twice
# in another CTE
#
create table t (a int);
insert into t values (3), (7), (1);
with
t as (select * from t),
cte as (select t1.a as t1a, t2.a as t2a from t as t1, t as t2 where t1.a=t2.a)
select * from cte;
t1a t2a
3 3
7 7
1 1
create table s (a int);
insert into s values (1), (4), (7);
with
t as (select * from t),
s as (select a-1 as a from s),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a+1)
select * from cte;
ta sa
3 3
2 1
8 7
with
t as (select * from t),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a),
s as (select a+10 as a from s)
select * from cte;
ta sa
1 1
7 7
2 2
8 8
drop table t,s;
with
t as (select * from t),
cte as (select t1.a as t1a, t2.a as t2a from t as t1, t as t2 where t1.a=t2.a)
select * from cte;
ERROR 42S02: Table 'test.t' doesn't exist
# End of 10.4 tests
46 changes: 46 additions & 0 deletions mysql-test/main/cte_nonrecursive.test
Expand Up @@ -1979,4 +1979,50 @@ SELECT * FROM t1;

DROP TABLE t1;

--echo #
--echo # MDEV-31657: CTE with the same name as base table used twice
--echo # in another CTE
--echo #

create table t (a int);
insert into t values (3), (7), (1);

let $q1=
with
t as (select * from t),
cte as (select t1.a as t1a, t2.a as t2a from t as t1, t as t2 where t1.a=t2.a)
select * from cte;

eval $q1;

create table s (a int);
insert into s values (1), (4), (7);

let $q2=
with
t as (select * from t),
s as (select a-1 as a from s),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a+1)
select * from cte;

eval $q2;

let $q3=
with
t as (select * from t),
cte as (select t.a as ta, s.a as sa from t, s where t.a=s.a
union
select t.a+1, s.a+1 from t, s where t.a=s.a),
s as (select a+10 as a from s)
select * from cte;

eval $q3;

drop table t,s;

--ERROR ER_NO_SUCH_TABLE
eval $q1;

--echo # End of 10.4 tests
37 changes: 37 additions & 0 deletions mysql-test/main/type_float.result
Expand Up @@ -1167,5 +1167,42 @@ d 50
fdbl 123.456.789,12345678000000000000000000000000000000
fdec 123.456.789,12345678900000000000000000000000000000
#
# MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
#
SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
CAST(-1e0 AS UNSIGNED) CAST(--2e0 AS UNSIGNED) CAST(---3e0 AS UNSIGNED) CAST(----4e0 AS UNSIGNED)
0 2 0 4
Warnings:
Note 1916 Got overflow when converting '-1' to UNSIGNED BIGINT. Value truncated
Note 1916 Got overflow when converting '-3' to UNSIGNED BIGINT. Value truncated
EXPLAIN EXTENDED SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
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 cast(-1e0 as unsigned) AS `CAST(-1e0 AS UNSIGNED)`,cast(2e0 as unsigned) AS `CAST(--2e0 AS UNSIGNED)`,cast(-3e0 as unsigned) AS `CAST(---3e0 AS UNSIGNED)`,cast(4e0 as unsigned) AS `CAST(----4e0 AS UNSIGNED)`
CREATE VIEW v1 AS SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);
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 cast(-1e0 as unsigned) AS `CAST(-1e0 AS UNSIGNED)`,cast(2e0 as unsigned) AS `CAST(--2e0 AS UNSIGNED)`,cast(-3e0 as unsigned) AS `CAST(---3e0 AS UNSIGNED)`,cast(4e0 as unsigned) AS `CAST(----4e0 AS UNSIGNED)` latin1 latin1_swedish_ci
SELECT * FROM v1;
CAST(-1e0 AS UNSIGNED) CAST(--2e0 AS UNSIGNED) CAST(---3e0 AS UNSIGNED) CAST(----4e0 AS UNSIGNED)
0 2 0 4
Warnings:
Note 1916 Got overflow when converting '-1' to UNSIGNED BIGINT. Value truncated
Note 1916 Got overflow when converting '-3' to UNSIGNED BIGINT. Value truncated
DROP VIEW v1;
#
# End of 10.4 tests
#
26 changes: 26 additions & 0 deletions mysql-test/main/type_float.test
Expand Up @@ -716,6 +716,32 @@ $$
DELIMITER ;$$
--horizontal_results

--echo #
--echo # MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
--echo #

SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);

EXPLAIN EXTENDED SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);

CREATE VIEW v1 AS SELECT
CAST(-1e0 AS UNSIGNED),
CAST(--2e0 AS UNSIGNED),
CAST(---3e0 AS UNSIGNED),
CAST(----4e0 AS UNSIGNED);

SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;

--echo #
--echo # End of 10.4 tests
--echo #
49 changes: 49 additions & 0 deletions mysql-test/suite/sql_sequence/alter.result
Expand Up @@ -252,3 +252,52 @@ SELECT NEXTVAL(s);
NEXTVAL(s)
1
DROP SEQUENCE s;
#
# MDEV-33169 Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds
#
create sequence s;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
alter sequence s maxvalue 123;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
alter sequence s maxvalue 123;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
drop sequence s;
create sequence s;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
prepare stmt from 'alter sequence s maxvalue 123';
execute stmt;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
execute stmt;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
deallocate prepare stmt;
drop sequence s;
create sequence s;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create procedure p() alter sequence s maxvalue 123;
call p;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
call p;
show create sequence s;
Table Create Table
s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
drop procedure p;
drop sequence s;
#
# End of 10.4 tests
#
35 changes: 35 additions & 0 deletions mysql-test/suite/sql_sequence/alter.test
Expand Up @@ -167,3 +167,38 @@ ALTER TABLE s ORDER BY cache_size;
SELECT NEXTVAL(s);
DROP SEQUENCE s;
--enable_ps2_protocol

--echo #
--echo # MDEV-33169 Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds
--echo #
create sequence s;
show create sequence s;
alter sequence s maxvalue 123;
show create sequence s;
alter sequence s maxvalue 123;
show create sequence s;
drop sequence s;

create sequence s;
show create sequence s;
prepare stmt from 'alter sequence s maxvalue 123';
execute stmt;
show create sequence s;
execute stmt;
show create sequence s;
deallocate prepare stmt;
drop sequence s;

create sequence s;
show create sequence s;
create procedure p() alter sequence s maxvalue 123;
call p;
show create sequence s;
call p;
show create sequence s;
drop procedure p;
drop sequence s;

--echo #
--echo # End of 10.4 tests
--echo #
2 changes: 1 addition & 1 deletion plugin/auth_pam/testing/pam_mariadb_mtr.c
Expand Up @@ -10,8 +10,8 @@

#include <stdlib.h>
#include <string.h>
#include <security/pam_modules.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>

#define N 3

Expand Down
4 changes: 4 additions & 0 deletions plugin/disks/information_schema_disks.cc
Expand Up @@ -19,10 +19,14 @@
#include <sys/types.h>
#if defined(HAVE_GETMNTENT)
#include <mntent.h>
#elif defined(HAVE_SYS_MNTENT)
#include <sys/mntent.h>
#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs)
/* getmntinfo (the not NetBSD variants) */
#include <sys/param.h>
#if defined(HAVE_SYS_UCRED)
#include <sys/ucred.h>
#endif
#include <sys/mount.h>
#endif
#if defined(HAVE_GETMNTENT_IN_SYS_MNTAB)
Expand Down
20 changes: 19 additions & 1 deletion sql/item.cc
Expand Up @@ -6969,7 +6969,25 @@ Item *Item_float::neg(THD *thd)
else if (value < 0 && max_length)
max_length--;
value= -value;
presentation= 0;
if (presentation)
{
if (*presentation == '-')
{
// Strip double minus: -(-1) -> '1' instead of '--1'
presentation++;
}
else
{
size_t presentation_length= strlen(presentation);
if (char *tmp= (char*) thd->alloc(presentation_length + 2))
{
tmp[0]= '-';
// Copy with the trailing '\0'
memcpy(tmp + 1, presentation, presentation_length + 1);
presentation= tmp;
}
}
}
name= null_clex_str;
return this;
}
Expand Down

0 comments on commit c9902a2

Please sign in to comment.