mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
0704d47007
mysql-test/t/features.test: --ps-protocol counts both prepare and execute mysql-test/t/last_value.test: Disable ps-protocol for metadata tests
46 lines
1.2 KiB
Text
46 lines
1.2 KiB
Text
#
|
|
# 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();
|