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
158247d3
Commit
158247d3
authored
May 02, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.2 into 10.3
parents
0d6fb43e
2370eeb0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
149 additions
and
35 deletions
+149
-35
mysql-test/main/constraints.result
mysql-test/main/constraints.result
+19
-1
mysql-test/main/constraints.test
mysql-test/main/constraints.test
+18
-5
mysql-test/main/trigger.result
mysql-test/main/trigger.result
+26
-6
mysql-test/main/trigger.test
mysql-test/main/trigger.test
+28
-6
sql/signal_handler.cc
sql/signal_handler.cc
+42
-4
sql/sql_analyze_stmt.cc
sql/sql_analyze_stmt.cc
+5
-5
sql/sql_show.cc
sql/sql_show.cc
+10
-7
sql/sql_trigger.h
sql/sql_trigger.h
+1
-1
No files found.
mysql-test/main/constraints.result
View file @
158247d3
drop table if exists t1;
create table t1 (a int check (a>0));
show create table t1;
Table Create Table
...
...
@@ -111,6 +110,25 @@ long_enough_name CREATE TABLE `long_enough_name` (
CONSTRAINT `constr` CHECK (`f6` >= 0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE long_enough_name;
CREATE TABLE test.t(t int COMMENT 't_comment' CHECK(t>0));
SHOW CREATE TABLE test.t;
Table Create Table
t CREATE TABLE `t` (
`t` int(11) DEFAULT NULL COMMENT 't_comment' CHECK (`t` > 0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP table test.t;
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
CREATE TABLE test.t (f int foo=bar check(f>0));
Warnings:
Warning 1911 Unknown option 'foo'
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`f` int(11) DEFAULT NULL `foo`=bar CHECK (`f` > 0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP table test.t;
SET @@SQL_MODE=@OLD_SQL_MODE;
create table t1 (a int check (a>10)) select 100 as 'a';
show create table t1;
Table Create Table
...
...
mysql-test/main/constraints.test
View file @
158247d3
#
# Testing of constraints
#
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
create
table
t1
(
a
int
check
(
a
>
0
));
show
create
table
t1
;
insert
into
t1
values
(
1
);
...
...
@@ -104,7 +100,24 @@ SHOW CREATE TABLE long_enough_name;
DROP
TABLE
long_enough_name
;
#
# Check that we don't loose constraints as part of CREATE ... SELECT
# MDEV-17654 Incorrect syntax returned for column with CHECK constraint
# in the "SHOW CREATE TABLE ..." result
#
CREATE
TABLE
test
.
t
(
t
int
COMMENT
't_comment'
CHECK
(
t
>
0
));
SHOW
CREATE
TABLE
test
.
t
;
DROP
table
test
.
t
;
SET
@
OLD_SQL_MODE
=@@
SQL_MODE
;
SET
SQL_MODE
=
'IGNORE_BAD_TABLE_OPTIONS'
;
CREATE
TABLE
test
.
t
(
f
int
foo
=
bar
check
(
f
>
0
));
SHOW
CREATE
TABLE
t
;
DROP
table
test
.
t
;
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
#
# Check that we don't lose constraints as part of CREATE ... SELECT
#
create
table
t1
(
a
int
check
(
a
>
10
))
select
100
as
'a'
;
...
...
mysql-test/main/trigger.result
View file @
158247d3
...
...
@@ -1962,7 +1962,7 @@ ERROR HY000: Can't update table 't2' in stored function/trigger because it is al
DROP TABLE t1;
DROP TRIGGER t_insert;
DROP TABLE t2;
End of 5.0 tests
#
End of 5.0 tests
drop table if exists table_25411_a;
drop table if exists table_25411_b;
create table table_25411_a(a int);
...
...
@@ -2131,7 +2131,7 @@ b
# Work around Bug#45235
DROP DATABASE db1;
USE test;
End of 5.1 tests.
#
End of 5.1 tests.
create table t1 (i int);
create table t2 (i int);
flush tables;
...
...
@@ -2150,7 +2150,7 @@ select * from t2;
i
2
drop table t1,t2;
End of 5.2 tests.
#
End of 5.2 tests.
#
# Bug#34453 Can't change size of file (Errcode: 1224)
#
...
...
@@ -2253,7 +2253,7 @@ c
aaa
DROP TABLE t1;
End of 5.5 tests.
#
End of 5.5 tests.
#
# BUG #910083: materialized subquery in a trigger
#
...
...
@@ -2300,7 +2300,7 @@ b
SET optimizer_switch=@save_optimizer_switch;
DROP TRIGGER tr;
DROP TABLE t1, t2;
End of 5.3 tests.
#
End of 5.3 tests.
set time_zone="+00:00";
SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
...
...
@@ -2407,7 +2407,24 @@ AFTER UPDATE ON t1 FOR EACH ROW SELECT (SELECT b FROM t2) INTO @x;
# Running 20000 queries
DROP TABLE t1,t2;
#
# Start of 10.3 tests
# MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
#
CREATE TABLE t1 (
virt1 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt2 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt3 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt4 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt5 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt6 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt7 INT GENERATED ALWAYS AS (0) VIRTUAL,
virt8 INT GENERATED ALWAYS AS (0) VIRTUAL
);
INSERT INTO t1 () VALUES ();
CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
INSERT INTO t1 () VALUES ();
DROP TABLE t1;
#
# End of 10.2 tests
#
#
# MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
...
...
@@ -2426,3 +2443,6 @@ SELECT * FROM t1;
a b total
10 20 30
DROP TABLE t1;
#
# End of 10.3 tests
#
mysql-test/main/trigger.test
View file @
158247d3
...
...
@@ -2184,7 +2184,7 @@ DROP TABLE t1;
DROP
TRIGGER
t_insert
;
DROP
TABLE
t2
;
--
echo
End
of
5.0
tests
--
echo
#
End of 5.0 tests
#
# Bug#25411 (trigger code truncated)
...
...
@@ -2406,7 +2406,7 @@ let $MYSQLD_DATADIR = `select @@datadir`;
DROP
DATABASE
db1
;
USE
test
;
--
echo
End
of
5.1
tests
.
--
echo
#
End of 5.1 tests.
#
# Test that using a trigger will not open mysql.proc
...
...
@@ -2430,7 +2430,7 @@ select * from t1;
select
*
from
t2
;
drop
table
t1
,
t2
;
--
echo
End
of
5.2
tests
.
--
echo
#
End of 5.2 tests.
--
echo
#
--
echo
# Bug#34453 Can't change size of file (Errcode: 1224)
...
...
@@ -2574,7 +2574,7 @@ SELECT c FROM t1;
DROP
TABLE
t1
;
--
echo
--
echo
End
of
5.5
tests
.
--
echo
#
End of 5.5 tests.
--
echo
#
--
echo
# BUG #910083: materialized subquery in a trigger
...
...
@@ -2613,7 +2613,7 @@ SET optimizer_switch=@save_optimizer_switch;
DROP
TRIGGER
tr
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.3
tests
.
--
echo
#
End of 5.3 tests.
#
# MDEV-4829 BEFORE INSERT triggers dont issue 1406 error
...
...
@@ -2737,9 +2737,27 @@ while ($n)
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
--
echo
#
CREATE
TABLE
t1
(
virt1
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt2
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt3
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt4
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt5
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt6
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt7
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
virt8
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
);
INSERT
INTO
t1
()
VALUES
();
CREATE
TRIGGER
t1_trigger
BEFORE
INSERT
ON
t1
FOR
EACH
ROW
BEGIN
END
;
INSERT
INTO
t1
()
VALUES
();
DROP
TABLE
t1
;
--
echo
#
--
echo
#
Start of 10.3
tests
--
echo
#
End of 10.2
tests
--
echo
#
--
echo
#
...
...
@@ -2760,3 +2778,7 @@ DELIMITER ;$$
INSERT
INTO
t1
(
a
,
b
)
VALUES
(
10
,
20
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
sql/signal_handler.cc
View file @
158247d3
...
...
@@ -30,6 +30,10 @@
#define SIGNAL_FMT "signal %d"
#endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
/*
We are handling signals/exceptions in this file.
Any global variables we read should be 'volatile sig_atomic_t'
...
...
@@ -44,6 +48,43 @@ extern volatile sig_atomic_t ld_assume_kernel_is_set;
extern
const
char
*
optimizer_switch_names
[];
static
inline
void
output_core_info
()
{
/* proc is optional on some BSDs so it can't hurt to look */
#ifdef HAVE_READLINK
char
buff
[
PATH_MAX
];
ssize_t
len
;
int
fd
;
if
((
len
=
readlink
(
"/proc/self/cwd"
,
buff
,
sizeof
(
buff
)))
>=
0
)
{
my_safe_printf_stderr
(
"Writing a core file...
\n
Working directory at %.*s
\n
"
,
(
int
)
len
,
buff
);
}
if
((
fd
=
my_open
(
"/proc/self/limits"
,
O_RDONLY
,
MYF
(
0
)))
>=
0
)
{
my_safe_printf_stderr
(
"Resource Limits:
\n
"
);
while
((
len
=
my_read
(
fd
,
(
uchar
*
)
buff
,
sizeof
(
buff
),
MYF
(
0
)))
>
0
)
{
my_write_stderr
(
buff
,
len
);
}
my_close
(
fd
,
MYF
(
0
));
}
#ifdef __linux__
if
((
fd
=
my_open
(
"/proc/sys/kernel/core_pattern"
,
O_RDONLY
,
MYF
(
0
)))
>=
0
)
{
len
=
my_read
(
fd
,
(
uchar
*
)
buff
,
sizeof
(
buff
),
MYF
(
0
));
my_safe_printf_stderr
(
"Core pattern: %.*s
\n
"
,
(
int
)
len
,
buff
);
my_close
(
fd
,
MYF
(
0
));
}
#endif
#else
char
buff
[
80
];
my_getwd
(
buff
,
sizeof
(
buff
),
0
);
my_safe_printf_stderr
(
"Writing a core file at %s
\n
"
,
buff
);
fflush
(
stderr
);
#endif
}
/**
* Handler for fatal signals on POSIX, exception handler on Windows.
*
...
...
@@ -295,13 +336,10 @@ extern "C" sig_handler handle_fatal_signal(int sig)
}
#endif
output_core_info
();
#ifdef HAVE_WRITE_CORE
if
(
test_flags
&
TEST_CORE_ON_SIGNAL
)
{
char
buff
[
80
];
my_getwd
(
buff
,
sizeof
(
buff
),
0
);
my_safe_printf_stderr
(
"Writing a core file at %s
\n
"
,
buff
);
fflush
(
stderr
);
my_write_core
(
sig
);
}
#endif
...
...
sql/sql_analyze_stmt.cc
View file @
158247d3
...
...
@@ -45,7 +45,7 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
else
if
(
r_limit
==
0
)
writer
->
add_str
(
varied_str
);
else
writer
->
add_ll
(
(
longlong
)
rint
(
r_limit
)
);
writer
->
add_ll
(
r_limit
);
}
writer
->
add_member
(
"r_used_priority_queue"
);
...
...
@@ -61,13 +61,13 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
if
(
!
get_r_loops
())
writer
->
add_member
(
"r_output_rows"
).
add_null
();
else
writer
->
add_member
(
"r_output_rows"
).
add_ll
(
(
longlong
)
rint
(
r_output_rows
/
get_r_loops
()));
writer
->
add_member
(
"r_output_rows"
).
add_ll
(
(
longlong
)
rint
((
double
)
r_output_rows
/
get_r_loops
()));
if
(
sort_passes
)
{
writer
->
add_member
(
"r_sort_passes"
).
add_ll
(
(
longlong
)
rint
(
sort_passes
/
get_r_loops
()));
writer
->
add_member
(
"r_sort_passes"
).
add_ll
(
(
longlong
)
rint
((
double
)
sort_passes
/
get_r_loops
()));
}
if
(
sort_buffer_size
!=
0
)
...
...
sql/sql_show.cc
View file @
158247d3
...
...
@@ -2305,6 +2305,16 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
!
(
sql_mode
&
MODE_NO_FIELD_OPTIONS
))
packet
->
append
(
STRING_WITH_LEN
(
" AUTO_INCREMENT"
));
}
if
(
field
->
comment
.
length
)
{
packet
->
append
(
STRING_WITH_LEN
(
" COMMENT "
));
append_unescaped
(
packet
,
field
->
comment
.
str
,
field
->
comment
.
length
);
}
append_create_options
(
thd
,
packet
,
field
->
option_list
,
check_options
,
hton
->
field_options
);
if
(
field
->
check_constraint
)
{
StringBuffer
<
MAX_FIELD_WIDTH
>
str
(
&
my_charset_utf8mb4_general_ci
);
...
...
@@ -2314,13 +2324,6 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
packet
->
append
(
STRING_WITH_LEN
(
")"
));
}
if
(
field
->
comment
.
length
)
{
packet
->
append
(
STRING_WITH_LEN
(
" COMMENT "
));
append_unescaped
(
packet
,
field
->
comment
.
str
,
field
->
comment
.
length
);
}
append_create_options
(
thd
,
packet
,
field
->
option_list
,
check_options
,
hton
->
field_options
);
}
key_info
=
table
->
key_info
;
...
...
sql/sql_trigger.h
View file @
158247d3
...
...
@@ -278,7 +278,7 @@ class Table_triggers_list: public Sql_alloc
Field
**
nullable_fields
()
{
return
record0_field
;
}
void
reset_extra_null_bitmap
()
{
size_t
null_bytes
=
(
trigger_table
->
s
->
stored_
fields
-
size_t
null_bytes
=
(
trigger_table
->
s
->
fields
-
trigger_table
->
s
->
null_fields
+
7
)
/
8
;
bzero
(
extra_null_bitmap
,
null_bytes
);
}
...
...
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