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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b49b24d9
Commit
b49b24d9
authored
Mar 19, 2004
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test to show bug in current union implementation
After merge fixes Portability fixes
parent
933278a5
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
204 additions
and
83 deletions
+204
-83
client/mysqltest.c
client/mysqltest.c
+56
-19
include/errmsg.h
include/errmsg.h
+23
-23
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+1
-1
mysql-test/r/system_mysql_db.result
mysql-test/r/system_mysql_db.result
+14
-10
mysql-test/r/union.result
mysql-test/r/union.result
+15
-0
mysql-test/t/derived.test
mysql-test/t/derived.test
+2
-1
mysql-test/t/system_mysql_db_refs.test
mysql-test/t/system_mysql_db_refs.test
+12
-0
mysql-test/t/union.test
mysql-test/t/union.test
+13
-0
scripts/mysql_create_system_tables.sh
scripts/mysql_create_system_tables.sh
+1
-1
scripts/mysql_fix_privilege_tables.sh
scripts/mysql_fix_privilege_tables.sh
+9
-16
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_fix_privilege_tables.sql
+55
-10
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+3
-2
No files found.
client/mysqltest.c
View file @
b49b24d9
...
...
@@ -109,6 +109,7 @@ MYSQL_MANAGER* manager=0;
static
char
**
default_argv
;
static
const
char
*
load_default_groups
[]
=
{
"mysqltest"
,
"client"
,
0
};
static
char
line_buffer
[
MAX_DELIMITER
],
*
line_buffer_pos
=
line_buffer
;;
static
FILE
*
file_stack
[
MAX_INCLUDE_DEPTH
];
static
FILE
**
cur_file
;
...
...
@@ -885,7 +886,10 @@ int do_exec(struct st_query* q)
if
(
disable_result_log
)
{
while
(
fgets
(
buf
,
sizeof
(
buf
),
res_file
))
{}
{
buf
[
strlen
(
buf
)
-
1
]
=
0
;
DBUG_PRINT
(
"exec_result"
,(
"%s"
,
buf
));
}
}
else
{
...
...
@@ -1648,24 +1652,48 @@ int do_while(struct st_query* q)
}
my_bool
end_of_query
(
int
c
,
char
*
p
)
/*
Read characters from line buffer or file. This is needed to allow
my_ungetc() to buffer MAX_DELIMITER characters for a file
NOTE:
This works as long as one doesn't change files (with 'source file_name')
when there is things pushed into the buffer. This should however not
happen for any tests in the test suite.
*/
char
my_getc
(
FILE
*
file
)
{
uint
i
,
j
;
int
tmp
[
MAX_DELIMITER
]
=
{
0
};
if
(
line_buffer_pos
==
line_buffer
)
return
fgetc
(
file
);
return
line_buffer
[
--
line_buffer_pos
];
}
for
(
i
=
0
;
c
==
*
(
delimiter
+
i
)
&&
i
<
delimiter_length
;
i
++
,
c
=
fgetc
(
*
cur_file
))
tmp
[
i
]
=
c
;
void
my_ungetc
(
int
c
)
{
line_buffer
[
line_buffer_pos
++
]
=
c
;
}
my_bool
end_of_query
(
int
c
)
{
uint
i
,
j
;
char
tmp
[
MAX_DELIMITER
];
if
(
c
!=
*
delimiter
)
return
0
;
for
(
i
=
1
;
i
<
delimiter_length
&&
(
c
=
my_getc
(
*
cur_file
))
==
*
(
delimiter
+
i
);
i
++
)
tmp
[
i
]
=
c
;
for
(
j
=
i
;
j
>
0
&&
i
!=
delimiter_length
;
j
--
)
ungetc
(
tmp
[
j
],
*
cur_file
);
if
(
i
==
delimiter_length
)
{
ungetc
(
tmp
[
i
],
*
cur_file
);
*
p
=
0
;
return
1
;
}
return
1
;
/* Found delimiter */
/* didn't find delimiter, push back things that we read */
for
(
j
=
1
;
j
<=
i
;
j
++
)
my_ungetc
(
tmp
[
j
]);
return
0
;
}
...
...
@@ -1683,7 +1711,7 @@ int read_line(char* buf, int size)
for
(;
p
<
buf_end
;)
{
no_save
=
0
;
c
=
f
getc
(
*
cur_file
);
c
=
my_
getc
(
*
cur_file
);
if
(
feof
(
*
cur_file
))
{
if
((
*
cur_file
)
!=
stdin
)
...
...
@@ -1698,8 +1726,11 @@ int read_line(char* buf, int size)
switch
(
state
)
{
case
R_NORMAL
:
/* Only accept '{' in the beginning of a line */
if
(
end_of_query
(
c
,
p
))
if
(
end_of_query
(
c
))
{
*
p
=
0
;
return
0
;
}
else
if
(
c
==
'\''
)
state
=
R_Q1
;
else
if
(
c
==
'"'
)
...
...
@@ -1735,7 +1766,7 @@ int read_line(char* buf, int size)
*
buf
=
0
;
return
0
;
}
else
if
(
end_of_query
(
c
,
p
)
||
c
==
'{'
)
else
if
(
end_of_query
(
c
)
||
c
==
'{'
)
{
*
p
=
0
;
return
0
;
...
...
@@ -1755,8 +1786,11 @@ int read_line(char* buf, int size)
state
=
R_ESC_SLASH_Q1
;
break
;
case
R_ESC_Q_Q1
:
if
(
end_of_query
(
c
,
p
))
if
(
end_of_query
(
c
))
{
*
p
=
0
;
return
0
;
}
if
(
c
!=
'\''
)
state
=
R_NORMAL
;
else
...
...
@@ -1773,8 +1807,11 @@ int read_line(char* buf, int size)
state
=
R_ESC_SLASH_Q2
;
break
;
case
R_ESC_Q_Q2
:
if
(
end_of_query
(
c
,
p
))
if
(
end_of_query
(
c
))
{
*
p
=
0
;
return
0
;
}
if
(
c
!=
'"'
)
state
=
R_NORMAL
;
else
...
...
include/errmsg.h
View file @
b49b24d9
...
...
@@ -66,27 +66,27 @@ extern const char *client_errors[]; /* Error messages */
#define CR_WRONG_LICENSE 2028
/* new 4.1 error codes */
#define CR_NULL_POINTER 202
8
#define CR_NO_PREPARE_STMT 20
29
#define CR_PARAMS_NOT_BOUND 203
0
#define CR_DATA_TRUNCATED 203
1
#define CR_NO_PARAMETERS_EXISTS 203
2
#define CR_INVALID_PARAMETER_NO 203
3
#define CR_INVALID_BUFFER_USE 203
4
#define CR_UNSUPPORTED_PARAM_TYPE 203
5
#define CR_NULL_POINTER 202
9
#define CR_NO_PREPARE_STMT 20
30
#define CR_PARAMS_NOT_BOUND 203
1
#define CR_DATA_TRUNCATED 203
2
#define CR_NO_PARAMETERS_EXISTS 203
3
#define CR_INVALID_PARAMETER_NO 203
4
#define CR_INVALID_BUFFER_USE 203
5
#define CR_UNSUPPORTED_PARAM_TYPE 203
6
#define CR_SHARED_MEMORY_CONNECTION 203
6
#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 203
7
#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 203
8
#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 20
39
#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 204
0
#define CR_SHARED_MEMORY_FILE_MAP_ERROR 204
1
#define CR_SHARED_MEMORY_MAP_ERROR 204
2
#define CR_SHARED_MEMORY_EVENT_ERROR 204
3
#define CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR 204
4
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 204
5
#define CR_CONN_UNKNOW_PROTOCOL 204
6
#define CR_INVALID_CONN_HANDLE 204
7
#define CR_SECURE_AUTH 204
8
#define CR_FETCH_CANCELLED 20
49
#define CR_NO_DATA 205
0
#define CR_SHARED_MEMORY_CONNECTION 203
7
#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 203
8
#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 203
9
#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 20
40
#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 204
1
#define CR_SHARED_MEMORY_FILE_MAP_ERROR 204
2
#define CR_SHARED_MEMORY_MAP_ERROR 204
3
#define CR_SHARED_MEMORY_EVENT_ERROR 204
4
#define CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR 204
5
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 204
6
#define CR_CONN_UNKNOW_PROTOCOL 204
7
#define CR_INVALID_CONN_HANDLE 204
8
#define CR_SECURE_AUTH 204
9
#define CR_FETCH_CANCELLED 20
50
#define CR_NO_DATA 205
1
mysql-test/mysql-test-run.sh
View file @
b49b24d9
...
...
@@ -511,7 +511,7 @@ fi
MYSQL_DUMP
=
"
$MYSQL_DUMP
--no-defaults -uroot --socket=
$MASTER_MYSOCK
--password=
$DBPASSWD
$EXTRA_MYSQLDUMP_OPT
"
MYSQL_BINLOG
=
"
$MYSQL_BINLOG
--no-defaults --local-load=
$MYSQL_TMP_DIR
$EXTRA_MYSQLBINLOG_OPT
"
MYSQL_FIX_SYSTEM_TABLES
=
"
$MYSQL_FIX_SYSTEM_TABLES
--host=localhost --port=
$MASTER_MYPORT
--socket=
$MASTER_MYSOCK
--user=root --password=
$DBPASSWD
--b
indir=
$CLIENT_BINDIR
"
MYSQL_FIX_SYSTEM_TABLES
=
"
$MYSQL_FIX_SYSTEM_TABLES
--host=localhost --port=
$MASTER_MYPORT
--socket=
$MASTER_MYSOCK
--user=root --password=
$DBPASSWD
--b
asedir=
$BASEDIR
--bindir=
$CLIENT_BINDIR
--verbose=1
"
MYSQL
=
"
$MYSQL
--host=localhost --port=
$MASTER_MYPORT
--socket=
$MASTER_MYSOCK
--user=root --password=
$DBPASSWD
"
export
MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
...
...
mysql-test/r/system_mysql_db.result
View file @
b49b24d9
...
...
@@ -3,6 +3,10 @@ Tables_in_db
columns_priv
db
func
help_category
help_keyword
help_relation
help_topic
host
tables_priv
user
...
...
@@ -26,7 +30,7 @@ db CREATE TABLE `db` (
`Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
)
TYPE=MyISAM
COMMENT='Database privileges'
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
COMMENT='Database privileges'
show create table host;
Table Create Table
host CREATE TABLE `host` (
...
...
@@ -45,13 +49,13 @@ host CREATE TABLE `host` (
`Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N',
`Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`)
)
TYPE=MyISAM
COMMENT='Host privileges; Merged with database privileges'
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
COMMENT='Host privileges; Merged with database privileges'
show create table user;
Table Create Table
user CREATE TABLE `user` (
`Host` varchar(60) binary NOT NULL default '',
`User` varchar(16) binary NOT NULL default '',
`Password` varchar(
16
) binary NOT NULL default '',
`Password` varchar(
41
) binary NOT NULL default '',
`Select_priv` enum('N','Y') NOT NULL default 'N',
`Insert_priv` enum('N','Y') NOT NULL default 'N',
`Update_priv` enum('N','Y') NOT NULL default 'N',
...
...
@@ -81,16 +85,16 @@ user CREATE TABLE `user` (
`max_updates` int(11) unsigned NOT NULL default '0',
`max_connections` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`Host`,`User`)
)
TYPE=MyISAM
COMMENT='Users and global privileges'
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) NOT NULL default '',
`name` char(64)
binary
NOT NULL default '',
`ret` tinyint(1) NOT NULL default '0',
`dl` char(128) NOT NULL default '',
`type` enum('function','aggregate') NOT NULL default 'function',
PRIMARY KEY (`name`)
)
TYPE=MyISAM
COMMENT='User defined functions'
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
COMMENT='User defined functions'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
...
...
@@ -99,12 +103,12 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(16) binary NOT NULL default '',
`Table_name` char(64) binary NOT NULL default '',
`Grantor` char(77) NOT NULL default '',
`Timestamp` timestamp
(14)
NOT NULL,
`Timestamp` timestamp NOT NULL,
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') NOT NULL default '',
`Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
)
TYPE=MyISAM
COMMENT='Table privileges'
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
COMMENT='Table privileges'
show create table columns_priv;
Table Create Table
columns_priv CREATE TABLE `columns_priv` (
...
...
@@ -113,7 +117,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(16) binary NOT NULL default '',
`Table_name` char(64) binary NOT NULL default '',
`Column_name` char(64) binary NOT NULL default '',
`Timestamp` timestamp
(14)
NOT NULL,
`Timestamp` timestamp NOT NULL,
`Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
)
TYPE=MyISAM
COMMENT='Column privileges'
)
ENGINE=MyISAM DEFAULT CHARSET=latin1
COMMENT='Column privileges'
mysql-test/r/union.result
View file @
b49b24d9
...
...
@@ -907,3 +907,18 @@ n
9
10
drop table t1;
create table t1 (i int);
insert into t1 values (1);
select * from t1 UNION select * from t1;
i
1
select * from t1 UNION ALL select * from t1;
i
1
1
select * from t1 UNION select * from t1 UNION ALL select * from t1;
i
1
1
1
drop table t1;
mysql-test/t/derived.test
View file @
b49b24d9
...
...
@@ -157,7 +157,8 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1)
UPDATE
`t1`
AS
P1
INNER
JOIN
(
SELECT
aaaa
FROM
`t1`
GROUP
BY
N
HAVING
Count
(
M
)
>
1
)
AS
P2
ON
P1
.
N
=
P2
.
N
SET
P1
.
M
=
2
;
delete
P1
.*
from
`t1`
AS
P1
INNER
JOIN
(
SELECT
N
FROM
`t1`
GROUP
BY
N
HAVING
Count
(
M
)
>
1
)
AS
P2
ON
P1
.
N
=
P2
.
N
;
select
*
from
t1
;
--
error
1288
--
error
1288
--
replace_result
P2
p2
delete
P1
.*
,
P2
.*
from
`t1`
AS
P1
INNER
JOIN
(
SELECT
N
FROM
`t1`
GROUP
BY
N
HAVING
Count
(
M
)
>
1
)
AS
P2
ON
P1
.
N
=
P2
.
N
;
--
error
1054
delete
P1
.*
from
`t1`
AS
P1
INNER
JOIN
(
SELECT
aaa
FROM
`t1`
GROUP
BY
N
HAVING
Count
(
M
)
>
1
)
AS
P2
ON
P1
.
N
=
P2
.
N
;
...
...
mysql-test/t/system_mysql_db_refs.test
View file @
b49b24d9
...
...
@@ -10,27 +10,39 @@ set @name="This is a very long string, that mustn't find room in a system field
create
table
test_db
select
*
from
mysql
.
db
;
delete
from
test_db
;
--
disable_warnings
insert
into
test_db
(
Host
,
Db
,
User
)
values
(
@
name
,
@
name
,
@
name
);
--
enable_warnings
create
table
test_host
select
*
from
mysql
.
host
;
delete
from
test_host
;
--
disable_warnings
insert
into
test_host
(
Host
,
Db
)
values
(
@
name
,
@
name
);
--
enable_warnings
create
table
test_user
select
*
from
mysql
.
user
;
delete
from
test_user
;
--
disable_warnings
insert
into
test_user
(
Host
,
User
)
values
(
@
name
,
@
name
);
--
enable_warnings
create
table
test_func
select
*
from
mysql
.
func
;
delete
from
test_func
;
--
disable_warnings
insert
into
test_func
(
name
)
values
(
@
name
);
--
enable_warnings
create
table
test_tables_priv
select
*
from
mysql
.
tables_priv
;
delete
from
test_tables_priv
;
--
disable_warnings
insert
into
test_tables_priv
(
Host
,
Db
,
User
,
Table_name
)
values
(
@
name
,
@
name
,
@
name
,
@
name
);
--
enable_warnings
create
table
test_columns_priv
select
*
from
mysql
.
columns_priv
;
delete
from
test_columns_priv
;
--
disable_warnings
insert
into
test_columns_priv
(
Host
,
Db
,
User
,
Table_name
,
Column_name
)
values
(
@
name
,
@
name
,
@
name
,
@
name
,
@
name
);
--
enable_warnings
# 'Host' field must be the same for all the tables:
...
...
mysql-test/t/union.test
View file @
b49b24d9
...
...
@@ -483,3 +483,16 @@ select col1 n from t1 union select col2 n from t1 order by n;
alter
table
t1
add
index
myindex
(
col2
);
select
col1
n
from
t1
union
select
col2
n
from
t1
order
by
n
;
drop
table
t1
;
#
# Bug #1428, incorrect handling of UNION ALL
# NOTE: The current result is wrong, needs to be fixed!
#
create
table
t1
(
i
int
);
insert
into
t1
values
(
1
);
select
*
from
t1
UNION
select
*
from
t1
;
select
*
from
t1
UNION
ALL
select
*
from
t1
;
# The following should return 2 lines
select
*
from
t1
UNION
select
*
from
t1
UNION
ALL
select
*
from
t1
;
drop
table
t1
;
scripts/mysql_create_system_tables.sh
View file @
b49b24d9
...
...
@@ -188,7 +188,7 @@ then
c_t
=
"
$c_t
Host char(60) binary DEFAULT '' NOT NULL,"
c_t
=
"
$c_t
Db char(64) binary DEFAULT '' NOT NULL,"
c_t
=
"
$c_t
User char(16) binary DEFAULT '' NOT NULL,"
c_t
=
"
$c_t
Table_name char(6
0
) binary DEFAULT '' NOT NULL,"
c_t
=
"
$c_t
Table_name char(6
4
) binary DEFAULT '' NOT NULL,"
c_t
=
"
$c_t
Grantor char(77) DEFAULT '' NOT NULL,"
c_t
=
"
$c_t
Timestamp timestamp(14),"
c_t
=
"
$c_t
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
...
...
scripts/mysql_fix_privilege_tables.sh
View file @
b49b24d9
...
...
@@ -56,21 +56,15 @@ parse_arguments() {
# Get first arguments from the my.cfg file, groups [mysqld] and
# [mysql_install_db], and then merge with the command line arguments
if
test
-x
./bin/my_print_defaults
then
print_defaults
=
"./bin/my_print_defaults"
elif
test
-x
@bindr@/my_print_defaults
then
print_defaults
=
"@bindir@/my_print_defaults"
elif
test
-x
@bindir@/mysql_print_defaults
then
print_defaults
=
"@bindir@/mysql_print_defaults"
elif
test
-x
extra/my_print_defaults
then
print_defaults
=
"extra/my_print_defaults"
else
print_defaults
=
"my_print_defaults"
fi
for
dir
in
./bin @bindir@ @bindir@ extra
$bindir
/../bin
$bindir
/../extra
do
if
test
-x
$dir
/my_print_defaults
then
print_defaults
=
"
$dir
/my_print_defaults"
break
fi
done
parse_arguments
`
$print_defaults
$defaults
mysql_install_db mysql_fix_privilege_tables
`
parse_arguments PICK-ARGS-FROM-ARGV
"
$@
"
...
...
@@ -109,7 +103,6 @@ fi
cmd
=
"
$bindir
/mysql -f --user=
$user
--host=
$host
"
if
test
-z
"
$password
"
;
then
else
cmd
=
"
$cmd
--password=
$password
"
fi
if
test
!
-z
"
$port
"
;
then
...
...
scripts/mysql_fix_privilege_tables.sql
View file @
b49b24d9
...
...
@@ -7,19 +7,18 @@
-- On unix, you should use the mysql_fix_privilege_tables script to execute
-- this sql script.
-- On windows you should do 'mysql --force < mysql_fix_privilege_tables.sql'
-- On windows you should do 'mysql --force
mysql
< mysql_fix_privilege_tables.sql'
USE
mysql
;
ALTER
TABLE
user
type
=
MyISAM
;
ALTER
TABLE
db
type
=
MyISAM
;
ALTER
TABLE
host
type
=
MyISAM
;
ALTER
TABLE
func
type
=
MyISAM
;
ALTER
TABLE
columns_priv
type
=
MyISAM
;
ALTER
TABLE
tables_priv
type
=
MyISAM
;
ALTER
TABLE
user
change
Password
Password
char
(
41
)
not
null
;
ALTER
TABLE
user
change
Password
Password
char
(
41
)
binary
not
null
;
ALTER
TABLE
user
add
File_priv
enum
(
'N'
,
'Y'
)
NOT
NULL
;
CREATE
TABLE
IF
NOT
EXISTS
func
(
name
char
(
64
)
DEFAULT
''
NOT
NULL
,
name
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
ret
tinyint
(
1
)
DEFAULT
'0'
NOT
NULL
,
dl
char
(
128
)
DEFAULT
''
NOT
NULL
,
type
enum
(
'function'
,
'aggregate'
)
NOT
NULL
,
...
...
@@ -39,6 +38,10 @@ UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Crea
UPDATE
db
SET
References_priv
=
Create_priv
,
Index_priv
=
Create_priv
,
Alter_priv
=
Create_priv
WHERE
@
hadGrantPriv
=
0
;
UPDATE
host
SET
References_priv
=
Create_priv
,
Index_priv
=
Create_priv
,
Alter_priv
=
Create_priv
WHERE
@
hadGrantPriv
=
0
;
--
-- The second alter changes ssl_type to new 4.0.2 format
-- Adding columns needed by GRANT .. REQUIRE (openssl)"
ALTER
TABLE
user
ADD
ssl_type
enum
(
''
,
'ANY'
,
'X509'
,
'SPECIFIED'
)
NOT
NULL
,
ADD
ssl_cipher
BLOB
NOT
NULL
,
...
...
@@ -46,11 +49,15 @@ ADD x509_issuer BLOB NOT NULL,
ADD
x509_subject
BLOB
NOT
NULL
;
ALTER
TABLE
user
MODIFY
ssl_type
enum
(
''
,
'ANY'
,
'X509'
,
'SPECIFIED'
)
NOT
NULL
;
--
-- Create tables_priv and columns_priv if they don't exists
--
CREATE
TABLE
IF
NOT
EXISTS
tables_priv
(
Host
char
(
60
)
DEFAULT
''
NOT
NULL
,
Db
char
(
6
0
)
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
DEFAULT
''
NOT
NULL
,
Table_name
char
(
6
0
)
DEFAULT
''
NOT
NULL
,
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
Db
char
(
6
4
)
binary
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
Table_name
char
(
6
4
)
binary
DEFAULT
''
NOT
NULL
,
Grantor
char
(
77
)
DEFAULT
''
NOT
NULL
,
Timestamp
timestamp
(
14
),
Table_priv
set
(
'Select'
,
'Insert'
,
'Update'
,
'Delete'
,
'Create'
,
'Drop'
,
'Grant'
,
'References'
,
'Index'
,
'Alter'
)
DEFAULT
''
NOT
NULL
,
...
...
@@ -69,16 +76,29 @@ CREATE TABLE IF NOT EXISTS columns_priv (
PRIMARY
KEY
(
Host
,
Db
,
User
,
Table_name
,
Column_name
)
);
--
-- Name change of Type -> Column_priv from MySQL 3.22.12
--
ALTER
TABLE
columns_priv
change
Type
Column_priv
set
(
'Select'
,
'Insert'
,
'Update'
,
'References'
)
DEFAULT
''
NOT
NULL
;
--
-- Add the new 'type' column to the func table.
--
ALTER
TABLE
func
add
type
enum
(
'function'
,
'aggregate'
)
NOT
NULL
;
--
-- Change the user,db and host tables to MySQL 4.0 format
--
#
Detect
whether
we
had
Show_db_priv
SET
@
hadShowDbPriv
:
=
0
;
SELECT
@
hadShowDbPriv
:
=
1
FROM
user
WHERE
Show_db_priv
LIKE
'%'
;
ALTER
TABLE
user
ADD
Show_db_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
a
lter_priv
,
ADD
Show_db_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
A
lter_priv
,
ADD
Super_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
Show_db_priv
,
ADD
Create_tmp_table_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
Super_priv
,
ADD
Lock_tables_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
Create_tmp_table_priv
,
...
...
@@ -86,13 +106,24 @@ ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
ADD
Repl_slave_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
Execute_priv
,
ADD
Repl_client_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
AFTER
Repl_slave_priv
;
UPDATE
user
SET
show_db_priv
=
select_priv
,
super_priv
=
process_priv
,
execute_priv
=
process_priv
,
create_tmp_table_priv
=
'Y'
,
Lock_tables_priv
=
'Y'
,
Repl_slave_priv
=
file_priv
,
Repl_client_priv
=
file_priv
where
user
<>
""
AND
@
hadShowDbPriv
=
0
;
-- Convert privileges so that users have similar privileges as before
UPDATE
user
SET
Show_db_priv
=
Select_priv
,
Super_priv
=
Process_priv
,
Execute_priv
=
Process_priv
,
Create_tmp_table_priv
=
'Y'
,
Lock_tables_priv
=
'Y'
,
Repl_slave_priv
=
file_priv
,
Repl_client_priv
=
File_priv
where
user
<>
""
AND
@
hadShowDbPriv
=
0
;
-- Add fields that can be used to limit number of questions and connections
-- for some users.
ALTER
TABLE
user
ADD
max_questions
int
(
11
)
NOT
NULL
AFTER
x509_subject
,
ADD
max_updates
int
(
11
)
unsigned
NOT
NULL
AFTER
max_questions
,
ADD
max_connections
int
(
11
)
unsigned
NOT
NULL
AFTER
max_updates
;
--
-- Add Create_tmp_table_priv and Lock_tables_priv to db and host
--
ALTER
TABLE
db
ADD
Create_tmp_table_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
ADD
Lock_tables_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
;
...
...
@@ -100,6 +131,20 @@ ALTER TABLE host
ADD
Create_tmp_table_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
ADD
Lock_tables_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
;
alter
table
db
change
Db
Db
char
(
64
)
binary
DEFAULT
''
NOT
NULL
;
alter
table
host
change
Db
Db
char
(
64
)
binary
DEFAULT
''
NOT
NULL
;
alter
table
user
change
max_questions
max_questions
int
(
11
)
unsigned
DEFAULT
0
NOT
NULL
;
alter
table
tables_priv
change
Db
Db
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
change
Host
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
change
User
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
change
Table_name
Table_name
char
(
64
)
binary
DEFAULT
''
NOT
NULL
;
alter
table
tables_priv
add
KEY
Grantor
(
Grantor
);
alter
table
columns_priv
change
Db
Db
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
change
Host
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
change
User
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
change
Table_name
Table_name
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
change
Column_name
Column_name
char
(
64
)
binary
DEFAULT
''
NOT
NULL
;
alter
table
db
comment
=
'Database privileges'
;
alter
table
host
comment
=
'Host privileges; Merged with database privileges'
;
alter
table
user
comment
=
'Users and global privileges'
;
alter
table
func
comment
=
'User defined functions'
;
alter
table
tables_priv
comment
=
'Table privileges'
;
alter
table
columns_priv
comment
=
'Column privileges'
;
#
#
Create
some
possible
missing
tables
#
...
...
sql/repl_failsafe.cc
View file @
b49b24d9
...
...
@@ -914,8 +914,9 @@ int load_master_data(THD* thd)
setting active_mi, because init_master_info() sets active_mi with
defaults.
*/
if
(
init_master_info
(
active_mi
,
master_info_file
,
relay_log_info_file
,
0
))
send_error
(
&
thd
->
net
,
ER_MASTER_INFO
);
if
(
init_master_info
(
active_mi
,
master_info_file
,
relay_log_info_file
,
0
))
send_error
(
thd
,
ER_MASTER_INFO
);
strmake
(
active_mi
->
master_log_name
,
row
[
0
],
sizeof
(
active_mi
->
master_log_name
));
active_mi
->
master_log_pos
=
strtoull
(
row
[
1
],
(
char
**
)
0
,
10
);
...
...
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