mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
2506b70d39
ROW keyword mandatory (although it's optional in SQL-99). mysql-test/r/row_test.result: New results with the ROW syntax. mysql-test/t/row_test.test: Updated tests to use the ROW keyword. sql/sql_yacc.yy: Fixed ambiguity between the row value syntax and INTERVAL syntax by making the ROW keyword mandatory (although it's optional in SQL-99). The real problem might actually be INTERVAL, where the two rules "INTERVAL_SYM expr interval '+' expr" and "INTERVAL_SYM '(' expr ',' expr_list ')'" caused 40+ reduce/reduce conflicts with the rows value syntax. So possibly, the INTERVAL syntax should be fixed instead...
60 lines
1.4 KiB
Text
60 lines
1.4 KiB
Text
SELECT ROW(1,2,3)=ROW(1,2,3);
|
|
ROW(1,2,3)=ROW(1,2,3)
|
|
1
|
|
SELECT ROW(2,2,3)=ROW(1+1,2,3);
|
|
ROW(2,2,3)=ROW(1+1,2,3)
|
|
1
|
|
SELECT ROW(1,2,3)=ROW(1+1,2,3);
|
|
ROW(1,2,3)=ROW(1+1,2,3)
|
|
0
|
|
SELECT ROW(1,2,3)<ROW(1+1,2,3);
|
|
ROW(1,2,3)<ROW(1+1,2,3)
|
|
1
|
|
SELECT ROW(1,2,3)>ROW(1+1,2,3);
|
|
ROW(1,2,3)>ROW(1+1,2,3)
|
|
0
|
|
SELECT ROW(1,2,3)<=ROW(1+1,2,3);
|
|
ROW(1,2,3)<=ROW(1+1,2,3)
|
|
1
|
|
SELECT ROW(1,2,3)>=ROW(1+1,2,3);
|
|
ROW(1,2,3)>=ROW(1+1,2,3)
|
|
0
|
|
SELECT ROW(1,2,3)<>ROW(1+1,2,3);
|
|
ROW(1,2,3)<>ROW(1+1,2,3)
|
|
1
|
|
SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
|
|
ROW(NULL,2,3)=ROW(NULL,2,3)
|
|
NULL
|
|
SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
|
|
ROW(NULL,2,3)<=>ROW(NULL,2,3)
|
|
1
|
|
SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
|
|
ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5))
|
|
1
|
|
SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
|
|
ROW('test',2,3.33)=ROW('test',2,3.33)
|
|
1
|
|
SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
|
|
Cardinality error (more/less than 3 columns)
|
|
drop table if exists t1;
|
|
create table t1 ( a int, b int, c int);
|
|
insert into t1 values (1,2,3), (2,3,1), (3,2,1);
|
|
select * from t1 where ROW(1,2,3)=ROW(a,b,c);
|
|
a b c
|
|
1 2 3
|
|
select * from t1 where ROW(0,2,3)=ROW(a,b,c);
|
|
a b c
|
|
select * from t1 where ROW(1,2,3)<ROW(a,b,c);
|
|
a b c
|
|
2 3 1
|
|
3 2 1
|
|
drop table t1;
|
|
select ROW(1,1);
|
|
Cardinality error (more/less than 1 columns)
|
|
drop table if exists t1;
|
|
create table t1 (i int);
|
|
select 1 from t1 where ROW(1,1);
|
|
Cardinality error (more/less than 1 columns)
|
|
select count(*) from t1 order by ROW(1,1);
|
|
Cardinality error (more/less than 1 columns)
|
|
drop table t1;
|