1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-11-28 20:23:58 +03:00
Files
mariadb-columnstore-engine/mtr/basic/r/mcs39_select_function_calls.result
mariadb-RomanNavrotskiy 73b4147cf3 move mtr suites here
2021-01-31 01:38:31 +02:00

56 lines
1.2 KiB
Plaintext

DROP DATABASE IF EXISTS mcs39_db;
CREATE DATABASE mcs39_db;
USE mcs39_db;
CREATE TABLE t1(col INT)Engine=Columnstore;
INSERT INTO t1 VALUEs(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE FUNCTION func(num int) RETURNS INT RETURN(POW(num,2));
SET @a = func(11);
SET @b = 15;
SELECT @a;
@a
121
SELECT func(@a);
func(@a)
14641
SELECT func(-@b);
func(-@b)
225
SELECT func(0);
func(0)
0
SELECT func(11+22);
func(11+22)
1089
SELECT func(11-22);
func(11-22)
121
SELECT func(11*22);
func(11*22)
58564
SELECT func(11/22);
func(11/22)
1
SELECT col,@a FROM t1;
col @a
1 121
2 121
3 121
4 121
5 121
6 121
7 121
8 121
9 121
10 121
SELECT col AS 'num', func(col) as 'square of num' from t1;
ERROR 42000: The storage engine for the table doesn't support IDB-1017: Stored function is currently not supported in Columnstore.
SELECT f1(@b) AS 'square of 99', * FROM t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '* FROM t1' at line 1
SELECT func(@b/0);
ERROR 22012: Division by 0
SELECT func();
ERROR 42000: Incorrect number of arguments for FUNCTION mcs39_db.func; expected 1, got 0
SELECT fun(@b);
ERROR 42000: FUNCTION mcs39_db.fun does not exist
DROP DATABASE mcs39_db;