1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Create 'main' test directory and move 't' and 'r' there

This commit is contained in:
Michael Widenius
2018-03-09 14:05:35 +02:00
committed by Monty
parent ab1941266c
commit a7abddeffa
2114 changed files with 75 additions and 77 deletions

View File

@ -0,0 +1,46 @@
#
# Tests for the LAST_VALUE function
#
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
# CREATE TABLE `queue` (
# `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
# `priority` int(11) DEFAULT NULL,
# `state` int(11) DEFAULT NULL,
# `pid` int(10) unsigned DEFAULT NULL,
# `dat` varbinary(200) DEFAULT NULL,
# PRIMARY KEY (`id`)
# )
CREATE TABLE t1 (a INT, b INT, c INT, d INT);
INSERT INTO t1 VALUES (1,3,0,NULL),(2,2,0,NULL),(3,4,0,NULL),(4,2,0,NULL);
SELECT * FROM t1;
UPDATE t1 SET c=LAST_VALUE(@last_a:=a,@last_b:=b,@last_c:=c,1), d=4211 WHERE c=0 ORDER BY b DESC LIMIT 1;
SELECT @last_a, @last_b, @last_c;
SELECT * FROM t1;
DROP TABLE t1;
#
# Test with different types
#
# PS protocol gives slightly different metadata for the length
--enable_metadata
--disable_ps_protocol
SELECT LAST_VALUE(@last_a:=1,@last_b:=1);
select @last_b;
--enable_ps_protocol
SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0);
select @last_b;
SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
select @last_b;
SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
select @last_b;
SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
select @last_b;
--disable_metadata
--error ER_PARSE_ERROR
SELECT LAST_VALUE();