ClickHouse/tests/queries/0_stateless/01543_toModifiedJulianDay.sql
nikitamikhaylov a8616ea262 better
2020-12-07 18:47:57 +03:00

39 lines
1.3 KiB
SQL

--
SELECT 'Invocation with constant';
SELECT toModifiedJulianDay('1858-11-16');
SELECT toModifiedJulianDay('1858-11-17');
SELECT toModifiedJulianDay('2020-11-01');
SELECT toModifiedJulianDay(NULL);
SELECT toModifiedJulianDay('unparsable'); -- { serverError 27 }
SELECT toModifiedJulianDay('1999-02-29'); -- { serverError 38 }
SELECT toModifiedJulianDay('1999-13-32'); -- { serverError 38 }
SELECT 'or null';
SELECT toModifiedJulianDayOrNull('2020-11-01');
SELECT toModifiedJulianDayOrNull('unparsable');
SELECT toModifiedJulianDayOrNull('1999-02-29');
SELECT toModifiedJulianDayOrNull('1999-13-32');
--
SELECT 'Invocation with String column';
DROP TABLE IF EXISTS toModifiedJulianDay_test;
CREATE TABLE toModifiedJulianDay_test (d String) ENGINE = Memory;
INSERT INTO toModifiedJulianDay_test VALUES ('1858-11-16'), ('1858-11-17'), ('2020-11-01');
SELECT toModifiedJulianDay(d) FROM toModifiedJulianDay_test;
DROP TABLE toModifiedJulianDay_test;
--
SELECT 'Invocation with FixedString column';
DROP TABLE IF EXISTS toModifiedJulianDay_test;
CREATE TABLE toModifiedJulianDay_test (d FixedString(10)) ENGINE = Memory;
INSERT INTO toModifiedJulianDay_test VALUES ('1858-11-16'), ('1858-11-17'), ('2020-11-01');
SELECT toModifiedJulianDay(d) FROM toModifiedJulianDay_test;
DROP TABLE toModifiedJulianDay_test;