0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-15 07:29:41 +00:00
ad hoc ad79ef48a2
libsql wal tests (#1408)
* add tests

* add bench
2024-05-24 13:59:17 +00:00

154 lines
2.9 KiB
Plaintext

SELECT CAST('9223372036854775808' AS integer);
SELECT CAST(' +000009223372036854775808' AS integer);
SELECT CAST('12345678901234567890123' AS INTEGER);
SELECT CAST('-9223372036854775808' AS integer);
SELECT CAST('-9223372036854775809' AS integer);
SELECT CAST('-12345678901234567890123' AS INTEGER);
SELECT CAST('123e+5' AS INTEGER);
SELECT CAST('123e+5' AS NUMERIC);
SELECT CAST('123e+5' AS REAL);
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a NUMERIC);
INSERT INTO t1 VALUES
('9000000000000000001'),
('9000000000000000001 '),
(' 9000000000000000001'),
(' 9000000000000000001 ');
SELECT * FROM t1;
SELECT CAST('-' AS NUMERIC);
SELECT CAST('-0' AS NUMERIC);
SELECT CAST('+' AS NUMERIC);
SELECT CAST('/' AS NUMERIC);
SELECT '' - 2851427734582196970;
SELECT 0 - 2851427734582196970;
SELECT '' - 1;
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (c0 TEXT);
INSERT INTO t0(c0) VALUES ('1.0');
SELECT CAST(c0 AS NUMERIC) FROM t0;
SELECT -'.';
SELECT '.'+0;
SELECT CAST('.' AS numeric);
SELECT -CAST('.' AS numeric);
SELECT CAST('-0.0' AS numeric);
SELECT CAST('0.0' AS numeric);
SELECT CAST('+0.0' AS numeric);
SELECT CAST('-1.0' AS numeric);
SELECT quote(X'310032003300')==quote(substr(X'310032003300', 1))
SELECT CAST(X'310032003300' AS TEXT)
==CAST(substr(X'310032003300', 1) AS TEXT)
CREATE TABLE t0(c0);
INSERT INTO t0(c0) VALUES (0);
CREATE VIEW v1(c0, c1) AS
SELECT CAST(0.0 AS NUMERIC), COUNT(*) OVER () FROM t0;
SELECT v1.c0 FROM v1, t0 WHERE v1.c0=0;
CREATE TABLE dual(dummy TEXT);
INSERT INTO dual VALUES('X');
SELECT CAST(4 AS NUMERIC);
SELECT CAST(4.0 AS NUMERIC);
SELECT CAST(4.5 AS NUMERIC);
SELECT x, typeof(x) FROM (SELECT CAST(4 AS NUMERIC) AS x) JOIN dual;
SELECT x, typeof(x) FROM dual CROSS JOIN (SELECT CAST(4 AS NUMERIC) AS x);
SELECT x, typeof(x) FROM (SELECT CAST(4.0 AS NUMERIC) AS x) JOIN dual;
SELECT x, typeof(x) FROM dual CROSS JOIN (SELECT CAST(4.0 AS NUMERIC) AS x);
SELECT x, typeof(x) FROM (SELECT CAST(4.5 AS NUMERIC) AS x) JOIN dual;
SELECT x, typeof(x) FROM dual CROSS JOIN (SELECT CAST(4.5 AS NUMERIC) AS x);
VALUES(CAST(44 AS REAL)),(55);
SELECT CAST(44 AS REAL) AS 'm' UNION ALL SELECT 55;
SELECT * FROM (VALUES(CAST(44 AS REAL)),(55));
SELECT * FROM (SELECT CAST(44 AS REAL) AS 'm' UNION ALL SELECT 55);
SELECT * FROM dual CROSS JOIN (VALUES(CAST(44 AS REAL)),(55));
SELECT * FROM dual CROSS JOIN (SELECT CAST(44 AS REAL) AS 'm'
UNION ALL SELECT 55);
DROP VIEW v1;
CREATE VIEW v1 AS SELECT CAST(44 AS REAL) AS 'm' UNION ALL SELECT 55;
SELECT name, type FROM pragma_table_info('v1');
CREATE VIEW v2 AS VALUES(CAST(44 AS REAL)),(55);
SELECT type FROM pragma_table_info('v2');
SELECT * FROM v1;
SELECT * FROM v2;