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
7b652e9a
Commit
7b652e9a
authored
Jan 14, 2004
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for the 2361 bug: ALTER TABLE ... DROP PRIMARY KEY drops a non-primary key
"PRIMARY" has been replaced by primary_key_name.
parent
4b91183c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
13 deletions
+14
-13
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_help.cc
sql/sql_help.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+4
-4
sql/sql_show.cc
sql/sql_show.cc
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+4
-4
sql/table.cc
sql/table.cc
+2
-2
No files found.
sql/mysql_priv.h
View file @
7b652e9a
...
...
@@ -38,6 +38,7 @@ typedef ulong key_part_map; /* Used for finding key parts */
/* useful constants */
extern
const
key_map
key_map_empty
;
extern
const
key_map
key_map_full
;
extern
const
char
*
primary_key_name
;
#include "mysql_com.h"
#include <violite.h>
...
...
sql/sql_help.cc
View file @
7b652e9a
...
...
@@ -274,9 +274,9 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
DBUG_ENTER
(
"get_topics_for_keyword"
);
if
((
iindex_topic
=
find_type
((
char
*
)
"PRIMARY"
,
if
((
iindex_topic
=
find_type
((
char
*
)
primary_key_name
,
&
topics
->
keynames
,
1
+
2
)
-
1
)
<
0
||
(
iindex_relations
=
find_type
((
char
*
)
"PRIMARY"
,
(
iindex_relations
=
find_type
((
char
*
)
primary_key_name
,
&
relations
->
keynames
,
1
+
2
)
-
1
)
<
0
)
{
send_error
(
thd
,
ER_CORRUPT_HELP_DB
);
...
...
sql/sql_select.cc
View file @
7b652e9a
...
...
@@ -9130,16 +9130,16 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
{
res
=
mysql_explain_select
(
thd
,
sl
,
(((
&
thd
->
lex
->
select_lex
)
==
sl
)
?
((
thd
->
lex
->
all_selects_list
!=
sl
)
?
"PRIMARY"
:
"SIMPLE"
)
:
((
thd
->
lex
->
all_selects_list
!=
sl
)
?
primary_key_name
:
"SIMPLE"
)
:
((
sl
==
first
)
?
((
sl
->
linkage
==
DERIVED_TABLE_TYPE
)
?
"DERIVED"
:
((
sl
->
uncacheable
&
UNCACHEABLE_DEPENDENT
)
?
((
sl
->
uncacheable
&
UNCACHEABLE_DEPENDENT
)
?
"DEPENDENT SUBQUERY"
:
(
sl
->
uncacheable
?
"UNCACHEABLE SUBQUERY"
:
"SUBQUERY"
)))
:
((
sl
->
uncacheable
&
UNCACHEABLE_DEPENDENT
)
?
((
sl
->
uncacheable
&
UNCACHEABLE_DEPENDENT
)
?
"DEPENDENT UNION"
:
sl
->
uncacheable
?
"UNCACHEABLE UNION"
:
"UNION"
))),
...
...
sql/sql_show.cc
View file @
7b652e9a
...
...
@@ -1167,7 +1167,7 @@ store_create_info(THD *thd, TABLE *table, String *packet)
bool
found_primary
=
0
;
packet
->
append
(
",
\n
"
,
4
);
if
(
i
==
primary_key
&&
!
strcmp
(
key_info
->
name
,
"PRIMARY"
))
if
(
i
==
primary_key
&&
!
strcmp
(
key_info
->
name
,
primary_key_name
))
{
found_primary
=
1
;
packet
->
append
(
"PRIMARY "
,
8
);
...
...
sql/sql_table.cc
View file @
7b652e9a
...
...
@@ -29,7 +29,7 @@
#include <io.h>
#endif
static
const
char
*
primary_key_name
=
"PRIMARY"
;
const
char
*
primary_key_name
=
"PRIMARY"
;
static
bool
check_if_keyname_exists
(
const
char
*
name
,
KEY
*
start
,
KEY
*
end
);
static
char
*
make_unique_key_name
(
const
char
*
field_name
,
KEY
*
start
,
KEY
*
end
);
...
...
@@ -2244,8 +2244,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
char
*
key_name
=
key_info
->
name
;
if
(
drop_primary
&&
!
my_strcasecmp
(
system_charset_info
,
key_name
,
"PRIMARY"
))
if
(
drop_primary
&&
(
key_info
->
flags
&
HA_NOSAME
)
&&
!
my_strcasecmp
(
system_charset_info
,
key_name
,
primary_key_name
))
{
drop_primary
=
0
;
continue
;
...
...
@@ -2305,7 +2305,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
key_list
.
push_back
(
new
Key
(
key_info
->
flags
&
HA_SPATIAL
?
Key
::
SPATIAL
:
(
key_info
->
flags
&
HA_NOSAME
?
(
!
my_strcasecmp
(
system_charset_info
,
key_name
,
"PRIMARY"
)
?
key_name
,
primary_key_name
)
?
Key
::
PRIMARY
:
Key
::
UNIQUE
)
:
(
key_info
->
flags
&
HA_FULLTEXT
?
Key
::
FULLTEXT
:
Key
::
MULTIPLE
)),
...
...
sql/table.cc
View file @
7b652e9a
...
...
@@ -481,8 +481,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
/* Fix key->name and key_part->field */
if
(
key_parts
)
{
uint
primary_key
=
(
uint
)
(
find_type
((
char
*
)
"PRIMARY"
,
&
outparam
->
keynames
,
3
)
-
1
);
uint
primary_key
=
(
uint
)
(
find_type
((
char
*
)
primary_key_name
,
&
outparam
->
keynames
,
3
)
-
1
);
uint
ha_option
=
outparam
->
file
->
table_flags
();
keyinfo
=
outparam
->
key_info
;
key_part
=
keyinfo
->
key_part
;
...
...
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