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
24f6437c
Commit
24f6437c
authored
Sep 28, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-ndb
parents
34ac282e
f3daec83
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
115 additions
and
8 deletions
+115
-8
mysql-test/r/ndb_alter_table.result
mysql-test/r/ndb_alter_table.result
+63
-4
mysql-test/t/ndb_alter_table.test
mysql-test/t/ndb_alter_table.test
+37
-3
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+3
-1
sql/sql_table.cc
sql/sql_table.cc
+12
-0
No files found.
mysql-test/r/ndb_alter_table.result
View file @
24f6437c
...
...
@@ -72,6 +72,21 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 100 3 4 5 PENDING 0000-00-00 00:00:00
1 101 3 4 5 PENDING 0000-00-00 00:00:00
2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
delete from t1;
insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
SET SQL_MODE='';
insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
0 0 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
1 103 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
alter table t1 drop column col4_5;
insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col5 col7 col8
0 0 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
1 103 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
2 104 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL,
...
...
@@ -79,16 +94,60 @@ b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
ALTER TABLE t1 ADD COLUMN c int not null;
select * from t1;
select * from t1
order by a
;
a b c
9410 9412 0
select * from t1;
select * from t1
order by a
;
a b c
9410 9412 0
alter table t1 drop c;
select * from t1;
select * from t1
order by a
;
a b
9410 9412
drop table t1;
select * from t1;
select * from t1
order by a
;
ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0,1),(17,18);
select * from t1 order by a;
a b
0 1
17 18
alter table t1 modify column a int not null auto_increment;
select * from t1 order by a;
a b
0 1
17 18
INSERT INTO t1 VALUES (0,19),(20,21);
select * from t1 order by a;
a b
0 1
17 18
18 19
20 21
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0,1),(17,18);
select * from t1;
a b
17 18
0 1
alter table t1 add c int not null unique auto_increment;
select * from t1 order by a;
a b c
0 1 2
17 18 1
INSERT INTO t1 VALUES (18,19,3),(20,21,0);
select * from t1 order by a;
a b c
0 1 2
17 18 1
18 19 3
20 21 4
drop table t1;
mysql-test/t/ndb_alter_table.test
View file @
24f6437c
...
...
@@ -47,6 +47,14 @@ select * from t1 order by col1;
insert
into
t1
values
(
2
,
NULL
,
4
,
3
,
5
,
99
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
show
table
status
;
select
*
from
t1
order
by
col1
;
delete
from
t1
;
insert
into
t1
values
(
0
,
0
,
4
,
3
,
5
,
99
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
SET
SQL_MODE
=
''
;
insert
into
t1
values
(
1
,
0
,
4
,
3
,
5
,
99
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
select
*
from
t1
order
by
col1
;
alter
table
t1
drop
column
col4_5
;
insert
into
t1
values
(
2
,
0
,
4
,
3
,
5
,
"PENDING"
,
"EXTRA"
,
'2004-01-01 00:00:00'
);
select
*
from
t1
order
by
col1
;
drop
table
t1
;
...
...
@@ -66,19 +74,45 @@ connect (con2,localhost,,,test);
connection
con1
;
ALTER
TABLE
t1
ADD
COLUMN
c
int
not
null
;
select
*
from
t1
;
select
*
from
t1
order
by
a
;
connection
con2
;
select
*
from
t1
;
select
*
from
t1
order
by
a
;
alter
table
t1
drop
c
;
connection
con1
;
select
*
from
t1
;
select
*
from
t1
order
by
a
;
drop
table
t1
;
connection
con2
;
--
error
1146
select
*
from
t1
order
by
a
;
CREATE
TABLE
t1
(
a
INT
NOT
NULL
PRIMARY
KEY
,
b
INT
NOT
NULL
)
ENGINE
=
ndbcluster
;
INSERT
INTO
t1
VALUES
(
0
,
1
),(
17
,
18
);
select
*
from
t1
order
by
a
;
alter
table
t1
modify
column
a
int
not
null
auto_increment
;
select
*
from
t1
order
by
a
;
INSERT
INTO
t1
VALUES
(
0
,
19
),(
20
,
21
);
select
*
from
t1
order
by
a
;
drop
table
t1
;
CREATE
TABLE
t1
(
a
INT
NOT
NULL
PRIMARY
KEY
,
b
INT
NOT
NULL
)
ENGINE
=
ndbcluster
;
INSERT
INTO
t1
VALUES
(
0
,
1
),(
17
,
18
);
select
*
from
t1
;
alter
table
t1
add
c
int
not
null
unique
auto_increment
;
select
*
from
t1
order
by
a
;
INSERT
INTO
t1
VALUES
(
18
,
19
,
3
),(
20
,
21
,
0
);
select
*
from
t1
order
by
a
;
drop
table
t1
;
#--disable_warnings
#DROP TABLE IF EXISTS t2;
...
...
sql/ha_ndbcluster.cc
View file @
24f6437c
...
...
@@ -3402,7 +3402,9 @@ longlong ha_ndbcluster::get_auto_increment()
DBUG_ENTER
(
"get_auto_increment"
);
DBUG_PRINT
(
"enter"
,
(
"m_tabname: %s"
,
m_tabname
));
int
cache_size
=
(
rows_to_insert
>
autoincrement_prefetch
)
?
(
rows_to_insert
-
rows_inserted
<
autoincrement_prefetch
)
?
rows_to_insert
-
rows_inserted
:
(
rows_to_insert
>
autoincrement_prefetch
)
?
rows_to_insert
:
autoincrement_prefetch
;
Uint64
auto_value
=
...
...
sql/sql_table.cc
View file @
24f6437c
...
...
@@ -3303,6 +3303,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
List
<
Item
>
all_fields
;
ha_rows
examined_rows
;
bool
auto_increment_field_copied
=
0
;
ulong
old_sql_mode
;
bool
no_auto_on_zero
;
DBUG_ENTER
(
"copy_data_between_tables"
);
if
(
!
(
copy
=
new
Copy_field
[
to
->
fields
]))
...
...
@@ -3361,6 +3363,11 @@ copy_data_between_tables(TABLE *from,TABLE *to,
goto
err
;
}
/* Turn on NO_AUTO_VALUE_ON_ZERO if not already on */
old_sql_mode
=
thd
->
variables
.
sql_mode
;
if
(
!
(
no_auto_on_zero
=
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_VALUE_ON_ZERO
))
thd
->
variables
.
sql_mode
|=
MODE_NO_AUTO_VALUE_ON_ZERO
;
/* Handler must be told explicitly to retrieve all columns, because
this function does not set field->query_id in the columns to the
current query id */
...
...
@@ -3417,6 +3424,11 @@ copy_data_between_tables(TABLE *from,TABLE *to,
to
->
file
->
extra
(
HA_EXTRA_NO_IGNORE_DUP_KEY
);
ha_enable_transaction
(
thd
,
TRUE
);
/* Turn off NO_AUTO_VALUE_ON_ZERO if it was not already off */
if
(
!
no_auto_on_zero
)
thd
->
variables
.
sql_mode
=
old_sql_mode
;
/*
Ensure that the new table is saved properly to disk so that we
can do a rename
...
...
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