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
358567df
Commit
358567df
authored
Jun 03, 2007
by
mhansson@dl145s.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.1-opt
into dl145s.mysql.com:/dev/shm/mhansson/my51-bug27741-mpush
parents
aa1abcf9
b642eb12
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
136 additions
and
9 deletions
+136
-9
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+14
-0
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+33
-4
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+12
-0
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+10
-3
sql/item_func.cc
sql/item_func.cc
+53
-1
sql/item_func.h
sql/item_func.h
+5
-0
sql/mysqld.cc
sql/mysqld.cc
+5
-0
sql/sql_table.cc
sql/sql_table.cc
+4
-1
No files found.
mysql-test/r/alter_table.result
View file @
358567df
...
...
@@ -1103,3 +1103,17 @@ Field Type Null Key Default Extra
unsigned_int_field bigint(20) unsigned NO MUL
char_field char(10) YES NULL
DROP TABLE t2;
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
INSERT INTO t1 VALUES (1, 2, NULL);
SELECT * FROM t1;
f1 f2 f3
1 2 NULL
ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f1;
SELECT * FROM t1;
f1 f3 f2
1 NULL 2
ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f2;
SELECT * FROM t1;
f1 f2 f3
1 2 NULL
DROP TABLE t1;
mysql-test/r/user_var.result
View file @
358567df
...
...
@@ -317,10 +317,39 @@ SHOW COUNT(*) WARNINGS;
SHOW COUNT(*) ERRORS;
@@session.error_count
1
create table t1(f1 int);
insert into t1 values(1),(1),(2);
select @a:=f1, count(f1) from t1 group by 1 order by 1;
create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1));
insert into t1 values
(1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6),
(3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6),
(3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6);
select @a:=f1, count(f1) from t1 group by 1 desc;
@a:=f1 count(f1)
1 2
4 1
3 2
2 1
1 4
select @a:=f1, count(f1) from t1 group by 1 asc;
@a:=f1 count(f1)
1 4
2 1
3 2
4 1
select @a:=f2, count(f2) from t1 group by 1 desc;
@a:=f2 count(f2)
d 1
c 2
b 1
a 4
select @a:=f3, count(f3) from t1 group by 1 desc;
@a:=f3 count(f3)
4.5 1
3.5 2
2.5 1
1.5 4
select @a:=f4, count(f4) from t1 group by 1 desc;
@a:=f4 count(f4)
4.6 1
3.6 2
2.6 1
1.6 4
drop table t1;
mysql-test/t/alter_table.test
View file @
358567df
...
...
@@ -839,3 +839,15 @@ ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL;
DESCRIBE
t2
;
DROP
TABLE
t2
;
#
# Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
#
CREATE
TABLE
t1
(
f1
INT
,
f2
INT
,
f3
INT
);
INSERT
INTO
t1
VALUES
(
1
,
2
,
NULL
);
SELECT
*
FROM
t1
;
ALTER
TABLE
t1
MODIFY
COLUMN
f3
INT
AFTER
f1
;
SELECT
*
FROM
t1
;
ALTER
TABLE
t1
MODIFY
COLUMN
f3
INT
AFTER
f2
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
mysql-test/t/user_var.test
View file @
358567df
...
...
@@ -226,7 +226,14 @@ SHOW COUNT(*) ERRORS;
#
# Bug#28494: Grouping by Item_func_set_user_var produces incorrect result.
#
create
table
t1
(
f1
int
);
insert
into
t1
values
(
1
),(
1
),(
2
);
select
@
a
:=
f1
,
count
(
f1
)
from
t1
group
by
1
order
by
1
;
create
table
t1
(
f1
int
,
f2
varchar
(
2
),
f3
float
,
f4
decimal
(
2
,
1
));
insert
into
t1
values
(
1
,
"a"
,
1.5
,
1.6
),
(
1
,
"a"
,
1.5
,
1.6
),
(
2
,
"b"
,
2.5
,
2.6
),
(
3
,
"c"
,
3.5
,
3.6
),
(
4
,
"d"
,
4.5
,
4.6
),
(
1
,
"a"
,
1.5
,
1.6
),
(
3
,
"c"
,
3.5
,
3.6
),
(
1
,
"a"
,
1.5
,
1.6
);
select
@
a
:=
f1
,
count
(
f1
)
from
t1
group
by
1
desc
;
select
@
a
:=
f1
,
count
(
f1
)
from
t1
group
by
1
asc
;
select
@
a
:=
f2
,
count
(
f2
)
from
t1
group
by
1
desc
;
select
@
a
:=
f3
,
count
(
f3
)
from
t1
group
by
1
desc
;
select
@
a
:=
f4
,
count
(
f4
)
from
t1
group
by
1
desc
;
drop
table
t1
;
sql/item_func.cc
View file @
358567df
...
...
@@ -3799,6 +3799,23 @@ Item_func_set_user_var::fix_length_and_dec()
}
/*
Mark field in read_map
NOTES
This is used by filesort to register used fields in a a temporary
column read set or to register used fields in a view
*/
bool
Item_func_set_user_var
::
register_field_in_read_map
(
uchar
*
arg
)
{
TABLE
*
table
=
(
TABLE
*
)
arg
;
if
(
result_field
->
table
==
table
||
!
table
)
bitmap_set_bit
(
result_field
->
table
->
read_set
,
result_field
->
field_index
);
return
0
;
}
/*
Set value to user variable.
...
...
@@ -4035,7 +4052,8 @@ bool
Item_func_set_user_var
::
check
(
bool
use_result_field
)
{
DBUG_ENTER
(
"Item_func_set_user_var::check"
);
DBUG_ASSERT
(
!
use_result_field
||
result_field
);
if
(
use_result_field
&&
!
result_field
)
use_result_field
=
FALSE
;
switch
(
cached_result_type
)
{
case
REAL_RESULT
:
...
...
@@ -4179,6 +4197,40 @@ my_decimal *Item_func_set_user_var::val_decimal(my_decimal *val)
}
double
Item_func_set_user_var
::
val_result
()
{
DBUG_ASSERT
(
fixed
==
1
);
check
(
TRUE
);
update
();
// Store expression
return
entry
->
val_real
(
&
null_value
);
}
longlong
Item_func_set_user_var
::
val_int_result
()
{
DBUG_ASSERT
(
fixed
==
1
);
check
(
TRUE
);
update
();
// Store expression
return
entry
->
val_int
(
&
null_value
);
}
String
*
Item_func_set_user_var
::
str_result
(
String
*
str
)
{
DBUG_ASSERT
(
fixed
==
1
);
check
(
TRUE
);
update
();
// Store expression
return
entry
->
val_str
(
&
null_value
,
str
,
decimals
);
}
my_decimal
*
Item_func_set_user_var
::
val_decimal_result
(
my_decimal
*
val
)
{
DBUG_ASSERT
(
fixed
==
1
);
check
(
TRUE
);
update
();
// Store expression
return
entry
->
val_decimal
(
&
null_value
,
val
);
}
void
Item_func_set_user_var
::
print
(
String
*
str
)
{
str
->
append
(
STRING_WITH_LEN
(
"(@"
));
...
...
sql/item_func.h
View file @
358567df
...
...
@@ -1236,6 +1236,10 @@ public:
longlong
val_int
();
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
);
double
val_result
();
longlong
val_int_result
();
String
*
str_result
(
String
*
str
);
my_decimal
*
val_decimal_result
(
my_decimal
*
);
bool
update_hash
(
void
*
ptr
,
uint
length
,
enum
Item_result
type
,
CHARSET_INFO
*
cs
,
Derivation
dv
,
bool
unsigned_arg
);
bool
send
(
Protocol
*
protocol
,
String
*
str_arg
);
...
...
@@ -1255,6 +1259,7 @@ public:
return
save_in_field
(
field
,
no_conversions
,
1
);
}
void
save_org_in_field
(
Field
*
field
)
{
(
void
)
save_in_field
(
field
,
1
,
0
);
}
bool
register_field_in_read_map
(
uchar
*
arg
);
};
...
...
sql/mysqld.cc
View file @
358567df
...
...
@@ -3805,6 +3805,11 @@ we force server id to 2, but this MySQL server will not act as a slave.");
freopen
(
log_error_file
,
"a+"
,
stderr
);
FreeConsole
();
// Remove window
}
else
{
/* Don't show error dialog box when on foreground: it stops the server */
SetErrorMode
(
SEM_NOOPENFILEERRORBOX
|
SEM_FAILCRITICALERRORS
);
}
#endif
/*
...
...
sql/sql_table.cc
View file @
358567df
...
...
@@ -5932,6 +5932,7 @@ view_err:
goto
err
;
}
find_it
.
after
(
def
);
// Put element after this
need_copy_table
=
ALTER_TABLE_DATA_CHANGED
;
}
}
if
(
alter_info
->
alter_list
.
elements
)
...
...
@@ -6170,12 +6171,14 @@ view_err:
(
uint
*
)
thd
->
alloc
(
sizeof
(
uint
)
*
prepared_key_list
.
elements
)))
goto
err
;
/* Check how much the tables differ. */
need_copy_table
=
compare_tables
(
table
,
&
prepared_create_list
,
uint
res
=
compare_tables
(
table
,
&
prepared_create_list
,
key_info_buffer
,
key_count
,
create_info
,
alter_info
,
order_num
,
index_drop_buffer
,
&
index_drop_count
,
index_add_buffer
,
&
index_add_count
,
varchar
);
if
(
!
need_copy_table
)
need_copy_table
=
res
;
}
/*
...
...
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