Commit 3d83d5aa authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt

into  rurik.mysql.com:/home/igor/mysql-5.0-opt
parents 21469f84 59e7a261
......@@ -36,19 +36,19 @@ Tables_in_test
t1
t2
t3
_
Test delimiter : from command line
a
1
_
Test delimiter :; from command line
a
1
_
Test 'go' command(vertical output) G
*************************** 1. row ***************************
a: 1
_
Test 'go' command g
a
1
......
......@@ -3398,8 +3398,9 @@ drop table t1,t2;
SELECT 0.9888889889 * 1.011111411911;
0.9888889889 * 1.011111411911
0.9998769417899202067879
select 1 as ' a ';
a
1
prepare stmt from 'select 1 as " a "';
Warnings:
Warning 1466 Leading spaces are removed from name ' a '
execute stmt;
a
1
......@@ -3239,6 +3239,50 @@ i
DROP TABLE t1;
DROP TABLE t2;
CREATE TABLE t1 (
id bigint(20) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO t1 VALUES
(1, 'Balazs'), (2, 'Joe'), (3, 'Frank');
CREATE TABLE t2 (
id bigint(20) unsigned NOT NULL auto_increment,
mid bigint(20) unsigned NOT NULL,
date date NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO t2 VALUES
(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
SELECT *,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 0, 1) AS date_last,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 3, 1) AS date_next_to_last
FROM t1;
id name date_last date_next_to_last
1 Balazs 2006-05-01 NULL
2 Joe 2006-04-20 NULL
3 Frank 2006-04-13 NULL
SELECT *,
(SELECT COUNT(*) FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 1, 1) AS date_count
FROM t1;
id name date_count
1 Balazs NULL
2 Joe NULL
3 Frank NULL
SELECT *,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 0, 1) AS date_last,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 1, 1) AS date_next_to_last
FROM t1;
id name date_last date_next_to_last
1 Balazs 2006-05-01 2006-03-30
2 Joe 2006-04-20 2006-04-06
3 Frank 2006-04-13 NULL
DROP TABLE t1,t2;
i1 int(11) NOT NULL default '0',
i2 int(11) NOT NULL default '0',
t datetime NOT NULL default '0000-00-00 00:00:00',
......
......@@ -20,16 +20,16 @@ insert into t1 values(1);
--disable_query_log
# Test delimiter : supplied on the command line
select "Test delimiter : from command line" as " ";
select "Test delimiter : from command line" as "_";
--exec $MYSQL test --delimiter=":" -e "select * from t1:"
# Test delimiter :; supplied on the command line
select "Test delimiter :; from command line" as " ";
select "Test delimiter :; from command line" as "_";
--exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
# Test 'go' command (vertical output) \G
select "Test 'go' command(vertical output) \G" as " ";
select "Test 'go' command(vertical output) \G" as "_";
--exec $MYSQL test -e "select * from t1\G"
# Test 'go' command \g
select "Test 'go' command \g" as " ";
select "Test 'go' command \g" as "_";
--exec $MYSQL test -e "select * from t1\g"
--enable_query_log
drop table t1;
......
......@@ -2910,4 +2910,5 @@ SELECT 0.9888889889 * 1.011111411911;
#
# Bug #10977: No warning issued if a column name is truncated
#
select 1 as ' a ';
prepare stmt from 'select 1 as " a "';
execute stmt;
......@@ -2163,6 +2163,46 @@ DROP TABLE t1;
DROP TABLE t2;
#
# Bug#20519: subselect with LIMIT M, N
#
CREATE TABLE t1 (
id bigint(20) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO t1 VALUES
(1, 'Balazs'), (2, 'Joe'), (3, 'Frank');
CREATE TABLE t2 (
id bigint(20) unsigned NOT NULL auto_increment,
mid bigint(20) unsigned NOT NULL,
date date NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO t2 VALUES
(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
SELECT *,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 0, 1) AS date_last,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 3, 1) AS date_next_to_last
FROM t1;
SELECT *,
(SELECT COUNT(*) FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 1, 1) AS date_count
FROM t1;
SELECT *,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 0, 1) AS date_last,
(SELECT date FROM t2 WHERE mid = t1.id
ORDER BY date DESC LIMIT 1, 1) AS date_next_to_last
FROM t1;
DROP TABLE t1,t2;
#
# Bug#20869: subselect with range access by DESC
#
......
......@@ -1209,6 +1209,11 @@ int
JOIN::reinit()
{
DBUG_ENTER("JOIN::reinit");
unit->offset_limit_cnt= (ha_rows)(select_lex->offset_limit ?
select_lex->offset_limit->val_uint() :
ULL(0));
first_record= 0;
if (exec_tmp_table1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment