summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-06-21 10:50:14 +0300
committermonty@hundin.mysql.fi <>2001-06-21 10:50:14 +0300
commit11e567229ac41541908f976b130ff792bd6754d6 (patch)
tree1aa843ac71d84cfb5316c1bc479b55cd0cf74b45
parent34b528f13fea33b7ca15a31e91e627f7c1c72ace (diff)
downloadmariadb-git-11e567229ac41541908f976b130ff792bd6754d6.tar.gz
UNIQUE keys are not anymore shown as PRIMARY KEY
-rw-r--r--Docs/manual.texi3
-rw-r--r--mysql-test/r/show_check.result10
-rw-r--r--mysql-test/t/show_check.test7
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/sql_show.cc10
5 files changed, 30 insertions, 4 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 64d80a61f94..2193cdab4ad 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46425,6 +46425,9 @@ not yet 100% confident in this code.
Added option @code{--warnings} to @code{mysqld}. Now @code{mysqld}
only prints the error @code{Aborted connection} if this option is used.
@item
+Fixed problem with @code{SHOW CREATE TABLE} when you didn't have a
+@code{PRIMARY KEY}.
+@item
Fixed properly the rename of @code{innodb_unix_file_flush_method} to
@code{innodb_flush_method}.
@item
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index ce2e5d4f58d..099ea2fa109 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -80,3 +80,13 @@ t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ UNIQUE KEY `aa` (`a`)
+) TYPE=MyISAM
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ PRIMARY KEY (`a`)
+) TYPE=MyISAM
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index f4f58c8c885..476d8dcdf0d 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -65,3 +65,10 @@ create table t1 (
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;
+
+create table t1 (a int not null, unique aa (a));
+show create table t1;
+drop table t1;
+create table t1 (a int not null, primary key (a));
+show create table t1;
+drop table t1;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 177d4ab1ab4..e11da82f43f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1190,7 +1190,7 @@ Some pointers may be invalid and cause the dump to abort...\n");
fprintf(stderr, "\n
Successfully dumped variables, if you ran with --log, take a look at the\n\
details of what thread %ld did to cause the crash. In some cases of really\n\
-bad corruption, the above values may be invalid\n\n",
+bad corruption, the values shown above may be invalid\n\n",
thd->thread_id);
}
fprintf(stderr, "\
@@ -3011,6 +3011,8 @@ static void usage(void)
Start without grant tables. This gives all users\n\
FULL ACCESS to all tables!\n\
--safe-mode Skip some optimize stages (for testing)\n\
+ --safe-show-database Don't show databases for which the user has no\n\
+ privileges\n\
--skip-concurrent-insert\n\
Don't use concurrent insert with MyISAM\n\
--skip-delay-key-write\n\
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 39ddb79e9de..6f99495d94d 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -839,18 +839,22 @@ store_create_info(THD *thd, TABLE *table, String *packet)
for (uint i=0 ; i < table->keys ; i++,key_info++)
{
+ KEY_PART_INFO *key_part= key_info->key_part;
+ bool found_primary=0;
packet->append(",\n ", 4);
- KEY_PART_INFO *key_part= key_info->key_part;
- if (i == primary_key)
+ if (i == primary_key && !strcmp(key_info->name,"PRIMARY"))
+ {
+ found_primary=1;
packet->append("PRIMARY ", 8);
+ }
else if (key_info->flags & HA_NOSAME)
packet->append("UNIQUE ", 7);
else if (key_info->flags & HA_FULLTEXT)
packet->append("FULLTEXT ", 9);
packet->append("KEY ", 4);
- if (i != primary_key)
+ if (!found_primary)
append_identifier(thd,packet,key_info->name);
packet->append(" (", 2);