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
7fbb935c
Commit
7fbb935c
authored
Feb 23, 2010
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
92a519bf
d1d18f29
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
366 additions
and
53 deletions
+366
-53
include/atomic/x86-gcc.h
include/atomic/x86-gcc.h
+1
-1
include/my_atomic.h
include/my_atomic.h
+2
-2
mysql-test/r/errors.result
mysql-test/r/errors.result
+2
-2
mysql-test/r/grant.result
mysql-test/r/grant.result
+1
-1
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+25
-0
mysql-test/r/signal.result
mysql-test/r/signal.result
+1
-1
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+2
-2
mysql-test/r/sp-vars.result
mysql-test/r/sp-vars.result
+2
-2
mysql-test/r/sp.result
mysql-test/r/sp.result
+2
-2
mysql-test/r/sp_notembedded.result
mysql-test/r/sp_notembedded.result
+2
-2
mysql-test/r/strict.result
mysql-test/r/strict.result
+1
-1
mysql-test/r/udf.result
mysql-test/r/udf.result
+46
-0
mysql-test/r/view.result
mysql-test/r/view.result
+34
-1
mysql-test/r/warnings.result
mysql-test/r/warnings.result
+3
-3
mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result
...test/suite/sys_vars/r/max_prepared_stmt_count_func.result
+1
-1
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+39
-0
mysql-test/t/udf.test
mysql-test/t/udf.test
+69
-0
mysql-test/t/view.test
mysql-test/t/view.test
+79
-0
sql/sql_base.cc
sql/sql_base.cc
+12
-3
sql/sql_parse.cc
sql/sql_parse.cc
+42
-29
No files found.
include/atomic/x86-gcc.h
View file @
7fbb935c
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
*/
*/
#define make_atomic_add_body64 \
#define make_atomic_add_body64 \
int64 tmp=*a; \
int64 tmp=*a; \
while (!my_atomic_cas64(a, &tmp, tmp+v))
;
\
while (!my_atomic_cas64(a, &tmp, tmp+v))
;
\
v=tmp;
v=tmp;
/*
/*
...
...
include/my_atomic.h
View file @
7fbb935c
...
@@ -77,13 +77,13 @@
...
@@ -77,13 +77,13 @@
#ifndef make_atomic_add_body
#ifndef make_atomic_add_body
#define make_atomic_add_body(S) \
#define make_atomic_add_body(S) \
int ## S tmp=*a; \
int ## S tmp=*a; \
while (!my_atomic_cas ## S(a, &tmp, tmp+v))
;
\
while (!my_atomic_cas ## S(a, &tmp, tmp+v))
;
\
v=tmp;
v=tmp;
#endif
#endif
#ifndef make_atomic_fas_body
#ifndef make_atomic_fas_body
#define make_atomic_fas_body(S) \
#define make_atomic_fas_body(S) \
int ## S tmp=*a; \
int ## S tmp=*a; \
while (!my_atomic_cas ## S(a, &tmp, v))
;
\
while (!my_atomic_cas ## S(a, &tmp, v))
;
\
v=tmp;
v=tmp;
#endif
#endif
#ifndef make_atomic_load_body
#ifndef make_atomic_load_body
...
...
mysql-test/r/errors.result
View file @
7fbb935c
...
@@ -61,10 +61,10 @@ create table t1 (a int unique);
...
@@ -61,10 +61,10 @@ create table t1 (a int unique);
create table t2 (a int);
create table t2 (a int);
drop function if exists f1;
drop function if exists f1;
Warnings:
Warnings:
Note 1305 FUNCTION f1 does not exist
Note 1305 FUNCTION
test.
f1 does not exist
drop function if exists f2;
drop function if exists f2;
Warnings:
Warnings:
Note 1305 FUNCTION f2 does not exist
Note 1305 FUNCTION
test.
f2 does not exist
create function f1() returns int
create function f1() returns int
begin
begin
insert into t1 (a) values (1);
insert into t1 (a) values (1);
...
...
mysql-test/r/grant.result
View file @
7fbb935c
...
@@ -1231,7 +1231,7 @@ Warnings:
...
@@ -1231,7 +1231,7 @@ Warnings:
Note 1051 Unknown table 'test'
Note 1051 Unknown table 'test'
drop function if exists test_function;
drop function if exists test_function;
Warnings:
Warnings:
Note 1305 FUNCTION test_function does not exist
Note 1305 FUNCTION test
.test
_function does not exist
drop view if exists v1;
drop view if exists v1;
Warnings:
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v1'
...
...
mysql-test/r/innodb_mysql.result
View file @
7fbb935c
...
@@ -2297,3 +2297,28 @@ t2 CREATE TABLE `t2` (
...
@@ -2297,3 +2297,28 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`)
CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1;
drop table t2, t1;
#
# Bug#44613 SELECT statement inside FUNCTION takes a shared lock
#
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
CREATE TABLE t1(x INT PRIMARY KEY, y INT) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 0), (2, 0);
CREATE FUNCTION f1(z INT) RETURNS INT READS SQL DATA
RETURN (SELECT x FROM t1 WHERE x = z);
# Connection default
START TRANSACTION;
SELECT f1(1);
f1(1)
1
# Connection con2
START TRANSACTION;
SELECT f1(1);
f1(1)
1
UPDATE t1 SET y = 1 WHERE x = 1;
COMMIT;
# Connection default
COMMIT;
DROP TABLE t1;
DROP FUNCTION f1;
mysql-test/r/signal.result
View file @
7fbb935c
...
@@ -2181,7 +2181,7 @@ drop procedure peter_p1 $$
...
@@ -2181,7 +2181,7 @@ drop procedure peter_p1 $$
drop procedure peter_p2 $$
drop procedure peter_p2 $$
drop procedure if exists peter_p3 $$
drop procedure if exists peter_p3 $$
Warnings:
Warnings:
Note 1305 PROCEDURE peter_p3 does not exist
Note 1305 PROCEDURE
test.
peter_p3 does not exist
create procedure peter_p3()
create procedure peter_p3()
begin
begin
declare continue handler for sqlexception
declare continue handler for sqlexception
...
...
mysql-test/r/sp-error.result
View file @
7fbb935c
...
@@ -46,7 +46,7 @@ call foo()|
...
@@ -46,7 +46,7 @@ call foo()|
ERROR 42000: PROCEDURE test.foo does not exist
ERROR 42000: PROCEDURE test.foo does not exist
drop procedure if exists foo|
drop procedure if exists foo|
Warnings:
Warnings:
Note 1305 PROCEDURE foo does not exist
Note 1305 PROCEDURE
test.
foo does not exist
show create procedure foo|
show create procedure foo|
ERROR 42000: PROCEDURE foo does not exist
ERROR 42000: PROCEDURE foo does not exist
show create function foo|
show create function foo|
...
@@ -1028,7 +1028,7 @@ drop table t1|
...
@@ -1028,7 +1028,7 @@ drop table t1|
drop function bug_13627_f|
drop function bug_13627_f|
drop function if exists bug12329;
drop function if exists bug12329;
Warnings:
Warnings:
Note 1305 FUNCTION bug12329 does not exist
Note 1305 FUNCTION
test.
bug12329 does not exist
create table t1 as select 1 a;
create table t1 as select 1 a;
create table t2 as select 1 a;
create table t2 as select 1 a;
create function bug12329() returns int return (select a from t1);
create function bug12329() returns int return (select a from t1);
...
...
mysql-test/r/sp-vars.result
View file @
7fbb935c
...
@@ -394,10 +394,10 @@ CASE expression tests.
...
@@ -394,10 +394,10 @@ CASE expression tests.
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p1;
Warnings:
Warnings:
Note 1305 PROCEDURE p1 does not exist
Note 1305 PROCEDURE
test.
p1 does not exist
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p2;
Warnings:
Warnings:
Note 1305 PROCEDURE p2 does not exist
Note 1305 PROCEDURE
test.
p2 does not exist
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
Warnings:
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't1'
...
...
mysql-test/r/sp.result
View file @
7fbb935c
...
@@ -2695,10 +2695,10 @@ delete from t3|
...
@@ -2695,10 +2695,10 @@ delete from t3|
insert into t3 values(1)|
insert into t3 values(1)|
drop procedure if exists bug7992_1|
drop procedure if exists bug7992_1|
Warnings:
Warnings:
Note 1305 PROCEDURE bug7992_1 does not exist
Note 1305 PROCEDURE
test.
bug7992_1 does not exist
drop procedure if exists bug7992_2|
drop procedure if exists bug7992_2|
Warnings:
Warnings:
Note 1305 PROCEDURE bug7992_2 does not exist
Note 1305 PROCEDURE
test.
bug7992_2 does not exist
create procedure bug7992_1()
create procedure bug7992_1()
begin
begin
declare i int;
declare i int;
...
...
mysql-test/r/sp_notembedded.result
View file @
7fbb935c
...
@@ -21,11 +21,11 @@ end|
...
@@ -21,11 +21,11 @@ end|
call bug4902_2()|
call bug4902_2()|
show warnings|
show warnings|
Level Code Message
Level Code Message
Note 1305 PROCEDURE bug4902_2 does not exist
Note 1305 PROCEDURE
test.
bug4902_2 does not exist
call bug4902_2()|
call bug4902_2()|
show warnings|
show warnings|
Level Code Message
Level Code Message
Note 1305 PROCEDURE bug4902_2 does not exist
Note 1305 PROCEDURE
test.
bug4902_2 does not exist
drop procedure bug4902_2|
drop procedure bug4902_2|
drop table if exists t1|
drop table if exists t1|
create table t1 (
create table t1 (
...
...
mysql-test/r/strict.result
View file @
7fbb935c
...
@@ -1183,7 +1183,7 @@ drop table t1;
...
@@ -1183,7 +1183,7 @@ drop table t1;
create table t1 (col1 tinyint);
create table t1 (col1 tinyint);
drop procedure if exists t1;
drop procedure if exists t1;
Warnings:
Warnings:
Note 1305 PROCEDURE t1 does not exist
Note 1305 PROCEDURE t
est.t
1 does not exist
create procedure t1 () begin declare exit handler for sqlexception
create procedure t1 () begin declare exit handler for sqlexception
select'a'; insert into t1 values (200); end;|
select'a'; insert into t1 values (200); end;|
call t1();
call t1();
...
...
mysql-test/r/udf.result
View file @
7fbb935c
...
@@ -392,6 +392,52 @@ a
...
@@ -392,6 +392,52 @@ a
4
4
DROP FUNCTION sequence;
DROP FUNCTION sequence;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
drop function if exists test.metaphon;
drop function if exists metaphon;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
select metaphon("Hello");
metaphon("Hello")
HL
drop function if exists test.metaphon;
Warnings:
Note 1305 FUNCTION test.metaphon does not exist
select metaphon("Hello");
metaphon("Hello")
HL
drop function metaphon;
CREATE FUNCTION test.metaphon(a TEXT) RETURNS TEXT return "This is a SF";
create database db_31767;
use db_31767;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
use test;
select metaphon("Hello");
metaphon("Hello")
HL
select test.metaphon("Hello");
test.metaphon("Hello")
This is a SF
drop function metaphon;
select metaphon("Hello");
metaphon("Hello")
This is a SF
drop function metaphon;
use db_31767;
drop database db_31767;
drop function if exists no_such_func;
Warnings:
Note 1305 FUNCTION (UDF) no_such_func does not exist
drop function no_such_func;
ERROR 42000: FUNCTION (UDF) no_such_func does not exist
drop function if exists test.no_such_func;
Warnings:
Note 1305 FUNCTION test.no_such_func does not exist
drop function test.no_such_func;
ERROR 42000: FUNCTION test.no_such_func does not exist
drop procedure if exists no_such_proc;
ERROR 3D000: No database selected
drop procedure no_such_proc;
ERROR 3D000: No database selected
use test;
#
#
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
#
#
...
...
mysql-test/r/view.result
View file @
7fbb935c
...
@@ -2086,7 +2086,7 @@ CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL);
...
@@ -2086,7 +2086,7 @@ CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL);
CREATE OR REPLACE VIEW v1 AS SELECT * from t1;
CREATE OR REPLACE VIEW v1 AS SELECT * from t1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p1;
Warnings:
Warnings:
Note 1305 PROCEDURE p1 does not exist
Note 1305 PROCEDURE
test.
p1 does not exist
CREATE PROCEDURE p1 ( )
CREATE PROCEDURE p1 ( )
BEGIN
BEGIN
DO (SELECT @next := IFNULL(max(bug_table_seq),0) + 1 FROM v1);
DO (SELECT @next := IFNULL(max(bug_table_seq),0) + 1 FROM v1);
...
@@ -4004,3 +4004,36 @@ CREATE VIEW t2 AS SELECT * FROM t1;
...
@@ -4004,3 +4004,36 @@ CREATE VIEW t2 AS SELECT * FROM t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
UNLOCK TABLES;
DROP TABLE t1, t2;
DROP TABLE t1, t2;
#
# Bug#48315 Metadata lock is not taken for merged views that
# use an INFORMATION_SCHEMA table
#
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP PROCEDURE IF EXISTS p1;
# Connection default
CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata;
CREATE TABLE t1 (str VARCHAR(50));
CREATE PROCEDURE p1() INSERT INTO t1 SELECT * FROM v1;
# CALL p1() so the view is merged.
CALL p1();
# Connection 3
LOCK TABLE t1 READ;
# Connection default
# Try to CALL p1() again, this time it should block for t1.
# Sending:
CALL p1();
# Connection 2
# ... then try to drop the view. This should block.
# Sending:
DROP VIEW v1;
# Connection 3
# Now allow CALL p1() to complete
UNLOCK TABLES;
# Connection default
# Reaping: CALL p1()
# Connection 2
# Reaping: DROP VIEW v1
# Connection default
DROP PROCEDURE p1;
DROP TABLE t1;
mysql-test/r/warnings.result
View file @
7fbb935c
...
@@ -228,13 +228,13 @@ INSERT INTO t2 VALUES ( 'a`', 'a`' );
...
@@ -228,13 +228,13 @@ INSERT INTO t2 VALUES ( 'a`', 'a`' );
INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' );
INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' );
DROP PROCEDURE IF EXISTS sp1;
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Warnings:
Note 1305 PROCEDURE sp1 does not exist
Note 1305 PROCEDURE
test.
sp1 does not exist
DROP PROCEDURE IF EXISTS sp2;
DROP PROCEDURE IF EXISTS sp2;
Warnings:
Warnings:
Note 1305 PROCEDURE sp2 does not exist
Note 1305 PROCEDURE
test.
sp2 does not exist
DROP PROCEDURE IF EXISTS sp3;
DROP PROCEDURE IF EXISTS sp3;
Warnings:
Warnings:
Note 1305 PROCEDURE sp3 does not exist
Note 1305 PROCEDURE
test.
sp3 does not exist
CREATE PROCEDURE sp1()
CREATE PROCEDURE sp1()
BEGIN
BEGIN
DECLARE x NUMERIC ZEROFILL;
DECLARE x NUMERIC ZEROFILL;
...
...
mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result
View file @
7fbb935c
...
@@ -66,7 +66,7 @@ SET GLOBAL max_prepared_stmt_count=3;
...
@@ -66,7 +66,7 @@ SET GLOBAL max_prepared_stmt_count=3;
** Creating procedure **
** Creating procedure **
DROP PROCEDURE IF EXISTS sp_checkstmts;
DROP PROCEDURE IF EXISTS sp_checkstmts;
Warnings:
Warnings:
Note 1305 PROCEDURE sp_checkstmts does not exist
Note 1305 PROCEDURE
test.
sp_checkstmts does not exist
CREATE PROCEDURE sp_checkstmts ()
CREATE PROCEDURE sp_checkstmts ()
BEGIN
BEGIN
PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
...
...
mysql-test/t/innodb_mysql.test
View file @
7fbb935c
...
@@ -555,3 +555,42 @@ create table t2 (fk int, key x (fk),
...
@@ -555,3 +555,42 @@ create table t2 (fk int, key x (fk),
constraint
x
foreign
key
(
FK
)
references
t1
(
PK
))
engine
=
InnoDB
;
constraint
x
foreign
key
(
FK
)
references
t1
(
PK
))
engine
=
InnoDB
;
show
create
table
t2
;
show
create
table
t2
;
drop
table
t2
,
t1
;
drop
table
t2
,
t1
;
--
echo
#
--
echo
# Bug#44613 SELECT statement inside FUNCTION takes a shared lock
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
FUNCTION
IF
EXISTS
f1
;
--
enable_warnings
CREATE
TABLE
t1
(
x
INT
PRIMARY
KEY
,
y
INT
)
ENGINE
=
innodb
;
INSERT
INTO
t1
VALUES
(
1
,
0
),
(
2
,
0
);
CREATE
FUNCTION
f1
(
z
INT
)
RETURNS
INT
READS
SQL
DATA
RETURN
(
SELECT
x
FROM
t1
WHERE
x
=
z
);
--
echo
# Connection default
START
TRANSACTION
;
SELECT
f1
(
1
);
--
echo
# Connection con2
--
disable_query_log
connect
(
con2
,
localhost
,
root
);
--
enable_query_log
START
TRANSACTION
;
SELECT
f1
(
1
);
# This next statement used to block.
UPDATE
t1
SET
y
=
1
WHERE
x
=
1
;
COMMIT
;
disconnect
con2
;
--
source
include
/
wait_until_disconnected
.
inc
--
echo
# Connection default
connection
default
;
COMMIT
;
DROP
TABLE
t1
;
DROP
FUNCTION
f1
;
mysql-test/t/udf.test
View file @
7fbb935c
...
@@ -436,6 +436,75 @@ SELECT * FROM t2 WHERE a = sequence();
...
@@ -436,6 +436,75 @@ SELECT * FROM t2 WHERE a = sequence();
DROP
FUNCTION
sequence
;
DROP
FUNCTION
sequence
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug#31767 (DROP FUNCTION name resolution)
#
--
disable_warnings
drop
function
if
exists
test
.
metaphon
;
drop
function
if
exists
metaphon
;
--
enable_warnings
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
metaphon
RETURNS
STRING
SONAME
"
$UDF_EXAMPLE_LIB
"
;
select
metaphon
(
"Hello"
);
# The UDF should not be dropped
drop
function
if
exists
test
.
metaphon
;
select
metaphon
(
"Hello"
);
drop
function
metaphon
;
CREATE
FUNCTION
test
.
metaphon
(
a
TEXT
)
RETURNS
TEXT
return
"This is a SF"
;
create
database
db_31767
;
use
db_31767
;
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
metaphon
RETURNS
STRING
SONAME
"
$UDF_EXAMPLE_LIB
"
;
use
test
;
# Uses the UDF
select
metaphon
(
"Hello"
);
# Uses the SF
select
test
.
metaphon
(
"Hello"
);
# Should drop the UDF, resolving the name the same way select does.
drop
function
metaphon
;
# Should call the SF
select
metaphon
(
"Hello"
);
# Drop the SF
drop
function
metaphon
;
# Change the current database to none.
use
db_31767
;
drop
database
db_31767
;
drop
function
if
exists
no_such_func
;
--
error
ER_SP_DOES_NOT_EXIST
drop
function
no_such_func
;
drop
function
if
exists
test
.
no_such_func
;
--
error
ER_SP_DOES_NOT_EXIST
drop
function
test
.
no_such_func
;
--
error
ER_NO_DB_ERROR
drop
procedure
if
exists
no_such_proc
;
--
error
ER_NO_DB_ERROR
drop
procedure
no_such_proc
;
use
test
;
--
echo
#
--
echo
#
--
echo
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
--
echo
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
--
echo
#
--
echo
#
...
...
mysql-test/t/view.test
View file @
7fbb935c
...
@@ -6,6 +6,9 @@ drop database if exists mysqltest;
...
@@ -6,6 +6,9 @@ drop database if exists mysqltest;
--
enable_warnings
--
enable_warnings
use
test
;
use
test
;
# Save the initial number of concurrent sessions.
--
source
include
/
count_sessions
.
inc
#
#
# some basic test of views and its functionality
# some basic test of views and its functionality
#
#
...
@@ -3975,3 +3978,79 @@ CREATE VIEW t2 AS SELECT * FROM t1;
...
@@ -3975,3 +3978,79 @@ CREATE VIEW t2 AS SELECT * FROM t1;
UNLOCK
TABLES
;
UNLOCK
TABLES
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug#48315 Metadata lock is not taken for merged views that
--
echo
# use an INFORMATION_SCHEMA table
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
VIEW
IF
EXISTS
v1
;
DROP
PROCEDURE
IF
EXISTS
p1
;
--
enable_warnings
connect
(
con2
,
localhost
,
root
);
connect
(
con3
,
localhost
,
root
);
--
echo
# Connection default
connection
default
;
CREATE
VIEW
v1
AS
SELECT
schema_name
FROM
information_schema
.
schemata
;
CREATE
TABLE
t1
(
str
VARCHAR
(
50
));
CREATE
PROCEDURE
p1
()
INSERT
INTO
t1
SELECT
*
FROM
v1
;
--
echo
# CALL p1() so the view is merged.
CALL
p1
();
--
echo
# Connection 3
connection
con3
;
LOCK
TABLE
t1
READ
;
--
echo
# Connection default
connection
default
;
--
echo
# Try to CALL p1() again, this time it should block for t1.
--
echo
# Sending:
--
send
CALL
p1
()
--
echo
# Connection 2
connection
con2
;
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
from
information_schema
.
processlist
WHERE
state
=
"Table lock"
AND
info
=
"INSERT INTO t1 SELECT * FROM v1"
;
--
source
include
/
wait_condition
.
inc
--
echo
# ... then try to drop the view. This should block.
--
echo
# Sending:
--
send
DROP
VIEW
v1
--
echo
# Connection 3
connection
con3
;
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
from
information_schema
.
processlist
WHERE
state
=
"Waiting for table"
AND
info
=
"DROP VIEW v1"
;
--
source
include
/
wait_condition
.
inc
--
echo
# Now allow CALL p1() to complete
UNLOCK
TABLES
;
--
echo
# Connection default
connection
default
;
--
echo
# Reaping: CALL p1()
--
reap
--
echo
# Connection 2
connection
con2
;
--
echo
# Reaping: DROP VIEW v1
--
reap
--
echo
# Connection default
connection
default
;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
;
disconnect
con2
;
disconnect
con3
;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--
source
include
/
wait_until_count_sessions
.
inc
sql/sql_base.cc
View file @
7fbb935c
...
@@ -4168,9 +4168,18 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
...
@@ -4168,9 +4168,18 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
TABLE_LIST is processed. This code works only during re-execution.
TABLE_LIST is processed. This code works only during re-execution.
*/
*/
if
(
tables
->
view
)
if
(
tables
->
view
)
goto
process_view_routines
;
{
if
(
!
mysql_schema_table
(
thd
,
lex
,
tables
)
&&
/*
!
check_and_update_table_version
(
thd
,
tables
,
tables
->
table
->
s
))
We still need to take a MDL lock on the merged view to protect
it from concurrent changes.
*/
if
(
!
open_table_get_mdl_lock
(
thd
,
tables
,
&
tables
->
mdl_request
,
ot_ctx
,
flags
))
goto
process_view_routines
;
/* Fall-through to return error. */
}
else
if
(
!
mysql_schema_table
(
thd
,
lex
,
tables
)
&&
!
check_and_update_table_version
(
thd
,
tables
,
tables
->
table
->
s
))
{
{
goto
end
;
goto
end
;
}
}
...
...
sql/sql_parse.cc
View file @
7fbb935c
...
@@ -4132,6 +4132,47 @@ case SQLCOM_PREPARE:
...
@@ -4132,6 +4132,47 @@ case SQLCOM_PREPARE:
case
SQLCOM_DROP_PROCEDURE
:
case
SQLCOM_DROP_PROCEDURE
:
case
SQLCOM_DROP_FUNCTION
:
case
SQLCOM_DROP_FUNCTION
:
{
{
#ifdef HAVE_DLOPEN
if
(
lex
->
sql_command
==
SQLCOM_DROP_FUNCTION
&&
!
lex
->
spname
->
m_explicit_name
)
{
/* DROP FUNCTION <non qualified name> */
udf_func
*
udf
=
find_udf
(
lex
->
spname
->
m_name
.
str
,
lex
->
spname
->
m_name
.
length
);
if
(
udf
)
{
if
(
check_access
(
thd
,
DELETE_ACL
,
"mysql"
,
NULL
,
NULL
,
1
,
0
))
goto
error
;
if
(
!
(
res
=
mysql_drop_function
(
thd
,
&
lex
->
spname
->
m_name
)))
{
my_ok
(
thd
);
break
;
}
my_error
(
ER_SP_DROP_FAILED
,
MYF
(
0
),
"FUNCTION (UDF)"
,
lex
->
spname
->
m_name
.
str
);
goto
error
;
}
if
(
lex
->
spname
->
m_db
.
str
==
NULL
)
{
if
(
lex
->
drop_if_exists
)
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_SP_DOES_NOT_EXIST
,
ER
(
ER_SP_DOES_NOT_EXIST
),
"FUNCTION (UDF)"
,
lex
->
spname
->
m_name
.
str
);
res
=
FALSE
;
my_ok
(
thd
);
break
;
}
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
"FUNCTION (UDF)"
,
lex
->
spname
->
m_name
.
str
);
goto
error
;
}
/* Fall thought to test for a stored function */
}
#endif
int
sp_result
;
int
sp_result
;
int
type
=
(
lex
->
sql_command
==
SQLCOM_DROP_PROCEDURE
?
int
type
=
(
lex
->
sql_command
==
SQLCOM_DROP_PROCEDURE
?
TYPE_ENUM_PROCEDURE
:
TYPE_ENUM_FUNCTION
);
TYPE_ENUM_PROCEDURE
:
TYPE_ENUM_FUNCTION
);
...
@@ -4178,34 +4219,6 @@ case SQLCOM_PREPARE:
...
@@ -4178,34 +4219,6 @@ case SQLCOM_PREPARE:
}
}
#endif
#endif
}
}
else
{
#ifdef HAVE_DLOPEN
if
(
lex
->
sql_command
==
SQLCOM_DROP_FUNCTION
)
{
udf_func
*
udf
=
find_udf
(
lex
->
spname
->
m_name
.
str
,
lex
->
spname
->
m_name
.
length
);
if
(
udf
)
{
if
(
check_access
(
thd
,
DELETE_ACL
,
"mysql"
,
NULL
,
NULL
,
1
,
0
))
goto
error
;
if
(
!
(
res
=
mysql_drop_function
(
thd
,
&
lex
->
spname
->
m_name
)))
{
my_ok
(
thd
);
break
;
}
}
}
#endif
if
(
lex
->
spname
->
m_db
.
str
)
sp_result
=
SP_KEY_NOT_FOUND
;
else
{
my_message
(
ER_NO_DB_ERROR
,
ER
(
ER_NO_DB_ERROR
),
MYF
(
0
));
goto
error
;
}
}
res
=
sp_result
;
res
=
sp_result
;
switch
(
sp_result
)
{
switch
(
sp_result
)
{
case
SP_OK
:
case
SP_OK
:
...
@@ -4217,7 +4230,7 @@ case SQLCOM_PREPARE:
...
@@ -4217,7 +4230,7 @@ case SQLCOM_PREPARE:
res
=
write_bin_log
(
thd
,
TRUE
,
thd
->
query
(),
thd
->
query_length
());
res
=
write_bin_log
(
thd
,
TRUE
,
thd
->
query
(),
thd
->
query_length
());
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_SP_DOES_NOT_EXIST
,
ER
(
ER_SP_DOES_NOT_EXIST
),
ER_SP_DOES_NOT_EXIST
,
ER
(
ER_SP_DOES_NOT_EXIST
),
SP_COM_STRING
(
lex
),
lex
->
spname
->
m_
name
.
str
);
SP_COM_STRING
(
lex
),
lex
->
spname
->
m_q
name
.
str
);
if
(
!
res
)
if
(
!
res
)
my_ok
(
thd
);
my_ok
(
thd
);
break
;
break
;
...
...
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