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
620f4f8a
Commit
620f4f8a
authored
Jun 20, 2019
by
Anel Husakovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17429 mysqldump uses 10.3 options with pre-10.3 servers and breaks
parent
68c15eee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
2 deletions
+198
-2
client/mysqldump.c
client/mysqldump.c
+4
-2
mysql-test/main/mysqldump-compat-102.opt
mysql-test/main/mysqldump-compat-102.opt
+1
-0
mysql-test/main/mysqldump-compat-102.result
mysql-test/main/mysqldump-compat-102.result
+110
-0
mysql-test/main/mysqldump-compat-102.test
mysql-test/main/mysqldump-compat-102.test
+83
-0
No files found.
client/mysqldump.c
View file @
620f4f8a
...
...
@@ -2524,7 +2524,9 @@ static uint dump_routines_for_db(char *db)
char
db_cl_name
[
MY_CS_NAME_SIZE
];
int
db_cl_altered
=
FALSE
;
// before 10.3 packages are not supported
uint
upper_bound
=
mysql_get_server_version
(
mysql
)
>=
100300
?
array_elements
(
routine_type
)
:
2
;
DBUG_ENTER
(
"dump_routines_for_db"
);
DBUG_PRINT
(
"enter"
,
(
"db: '%s'"
,
db
));
...
...
@@ -2554,7 +2556,7 @@ static uint dump_routines_for_db(char *db)
fputs
(
"
\t
<routines>
\n
"
,
sql_file
);
/* 0, retrieve and dump functions, 1, procedures, etc. */
for
(
i
=
0
;
i
<
array_elements
(
routine_type
)
;
i
++
)
for
(
i
=
0
;
i
<
upper_bound
;
i
++
)
{
my_snprintf
(
query_buff
,
sizeof
(
query_buff
),
"SHOW %s STATUS WHERE Db = '%s'"
,
...
...
mysql-test/main/mysqldump-compat-102.opt
0 → 100644
View file @
620f4f8a
-V10.2.1-MariaDB
mysql-test/main/mysqldump-compat-102.result
0 → 100644
View file @
620f4f8a
#
# MDEV-17429 mysqldump uses 10.3 options with pre-10.3 servers and breaks
#
SELECT @@version;
@@version
10.2.1-MariaDB
SET sql_mode=ORACLE;
CREATE DATABASE db1_mdev17429;
USE db1_mdev17429;
CREATE PROCEDURE p1(a INT)
AS BEGIN
NULL;
END;
$$
CREATE OR REPLACE PACKAGE employee_tools AS
FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);
PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));
PROCEDURE raiseSalaryStd(eid INT);
PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));
END;
$$
CREATE PACKAGE BODY employee_tools AS
-- package body variables
stdRaiseAmount DECIMAL(10,2):=500;
-- private routines
PROCEDURE log (eid INT, ecmnt TEXT) AS
BEGIN
INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);
END;
-- public routines
PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS
eid INT;
BEGIN
INSERT INTO employee (name, salary) VALUES (ename, esalary);
eid:= last_insert_id();
log(eid, 'hire ' || ename);
END;
FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS
nSalary DECIMAL(10,2);
BEGIN
SELECT salary INTO nSalary FROM employee WHERE id=eid;
log(eid, 'getSalary id=' || eid || ' salary=' || nSalary);
RETURN nSalary;
END;
PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS
BEGIN
UPDATE employee SET salary=salary+amount WHERE id=eid;
log(eid, 'raiseSalary id=' || eid || ' amount=' || amount);
END;
PROCEDURE raiseSalaryStd(eid INT) AS
BEGIN
raiseSalary(eid, stdRaiseAmount);
log(eid, 'raiseSalaryStd id=' || eid);
END;
BEGIN
-- This code is executed when the current session
-- accesses any of the package routines for the first time
log(0, 'Session ' || connection_id() || ' ' || current_user || ' started');
END;
$$
-- MySQL dump DUMPVERSION Distrib DISTVERSION, for OS
--
-- Host: localhost Database: db1_mdev17429
-- ------------------------------------------------------
-- Server version 10.2.1-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping routines for database 'db1_mdev17429'
--
/*!50003 DROP PROCEDURE IF EXISTS `p1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PROCEDURE "p1"(a INT)
AS BEGIN
NULL;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on TIMESTAMP
DROP DATABASE db1_mdev17429;
SET sql_mode=DEFAULT;
mysql-test/main/mysqldump-compat-102.test
0 → 100644
View file @
620f4f8a
# Embedded server doesn't support external clients
--
source
include
/
not_embedded
.
inc
--
echo
#
--
echo
# MDEV-17429 mysqldump uses 10.3 options with pre-10.3 servers and breaks
--
echo
#
# Make sure the server reports itself as 10.2.1-MariaDB
SELECT
@@
version
;
SET
sql_mode
=
ORACLE
;
CREATE
DATABASE
db1_mdev17429
;
USE
db1_mdev17429
;
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
a
INT
)
AS
BEGIN
NULL
;
END
;
$$
CREATE
OR
REPLACE
PACKAGE
employee_tools
AS
FUNCTION
getSalary
(
eid
INT
)
RETURN
DECIMAL
(
10
,
2
);
PROCEDURE
raiseSalary
(
eid
INT
,
amount
DECIMAL
(
10
,
2
));
PROCEDURE
raiseSalaryStd
(
eid
INT
);
PROCEDURE
hire
(
ename
TEXT
,
esalary
DECIMAL
(
10
,
2
));
END
;
$$
CREATE
PACKAGE
BODY
employee_tools
AS
--
package
body
variables
stdRaiseAmount
DECIMAL
(
10
,
2
)
:=
500
;
--
private
routines
PROCEDURE
log
(
eid
INT
,
ecmnt
TEXT
)
AS
BEGIN
INSERT
INTO
employee_log
(
id
,
cmnt
)
VALUES
(
eid
,
ecmnt
);
END
;
--
public
routines
PROCEDURE
hire
(
ename
TEXT
,
esalary
DECIMAL
(
10
,
2
))
AS
eid
INT
;
BEGIN
INSERT
INTO
employee
(
name
,
salary
)
VALUES
(
ename
,
esalary
);
eid
:=
last_insert_id
();
log
(
eid
,
'hire '
||
ename
);
END
;
FUNCTION
getSalary
(
eid
INT
)
RETURN
DECIMAL
(
10
,
2
)
AS
nSalary
DECIMAL
(
10
,
2
);
BEGIN
SELECT
salary
INTO
nSalary
FROM
employee
WHERE
id
=
eid
;
log
(
eid
,
'getSalary id='
||
eid
||
' salary='
||
nSalary
);
RETURN
nSalary
;
END
;
PROCEDURE
raiseSalary
(
eid
INT
,
amount
DECIMAL
(
10
,
2
))
AS
BEGIN
UPDATE
employee
SET
salary
=
salary
+
amount
WHERE
id
=
eid
;
log
(
eid
,
'raiseSalary id='
||
eid
||
' amount='
||
amount
);
END
;
PROCEDURE
raiseSalaryStd
(
eid
INT
)
AS
BEGIN
raiseSalary
(
eid
,
stdRaiseAmount
);
log
(
eid
,
'raiseSalaryStd id='
||
eid
);
END
;
BEGIN
--
This
code
is
executed
when
the
current
session
--
accesses
any
of
the
package
routines
for
the
first
time
log
(
0
,
'Session '
||
connection_id
()
||
' '
||
current_user
||
' started'
);
END
;
$$
DELIMITER
;
$$
# mysqldump output is expected to have standalone PROCEDURE/FUNCTION, but not PACKAGE/PACKAGE BODY.
--
replace_regex
/--
MySQL
dump
.*
[
^
\n
]
/--
MySQL
dump
DUMPVERSION
Distrib
DISTVERSION
,
for
OS
/
/
on
[
0
-
9
:-
]
+/
on
TIMESTAMP
/
--
exec
$MYSQL_DUMP
--
quick
--
routines
--
triggers
--
no
-
create
-
info
--
skip
-
lock
-
tables
--
no
-
data
--
compress
-
uroot
db1_mdev17429
DROP
DATABASE
db1_mdev17429
;
SET
sql_mode
=
DEFAULT
;
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