CREATE TABLE decimals(d DECIMAL(18,1) , ts timestamp time index);

INSERT INTO decimals VALUES (99000000000000000.0, 1000);

SELECT d + 1 FROM decimals;

SELECT d + 1000000000000000.0 FROM decimals;

SELECT -1 - d FROM decimals;

SELECT -1000000000000000.0 - d FROM decimals;

SELECT 1 * d FROM decimals;

SELECT 2 * d FROM decimals;

DROP TABLE decimals;

CREATE TABLE IF NOT EXISTS `all_types` (
  `c_serial` DECIMAL(20,0) NOT NULL,
  `c_bit` TINYINT NOT NULL,
  `b1` INT NULL,
  `c_tinyint` SMALLINT NOT NULL,
  `c_tinyint_u` INT NOT NULL,
  `c_tinyint_z` INT NOT NULL,
  `c_tinyint_u_z` INT NOT NULL,
  `c_tinyint_n` SMALLINT NOT NULL,
  `c_tinyint_n_n` INT NOT NULL,
  `c_tinyint_n_z` INT NOT NULL,
  `c_tinyint_n_u_z` INT NOT NULL,
  `c_bool` SMALLINT NOT NULL,
  `c_boolean` SMALLINT NOT NULL,
  `c_smallint` SMALLINT NOT NULL,
  `c_smallint_u` INT NOT NULL,
  `c_smallint_z` INT NOT NULL,
  `c_smallint_u_z` INT NOT NULL,
  `c_smallint_n` SMALLINT NOT NULL,
  `c_smallint_n_n` INT NOT NULL,
  `c_smallint_n_z` INT NOT NULL,
  `c_smallint_n_u_z` INT NOT NULL,
  `c_mediumint` INT NOT NULL,
  `c_mediumint_u` BIGINT NOT NULL,
  `c_mediumint_z` BIGINT NOT NULL,
  `c_mediumint_u_z` BIGINT NOT NULL,
  `c_mediumint_n` INT NOT NULL,
  `c_mediumint_n_n` BIGINT NOT NULL,
  `c_mediumint_n_z` BIGINT NOT NULL,
  `c_mediumint_n_u_z` BIGINT NOT NULL,
  `c_int` INT NOT NULL,
  `c_int_u` BIGINT NOT NULL,
  `c_int_z` BIGINT NULL,
  `c_int_u_z` BIGINT NULL,
  `c_int_n` INT NOT NULL,
  `c_int_n_n` BIGINT NOT NULL,
  `c_int_n_z` BIGINT NULL,
  `c_int_n_u_z` BIGINT NULL,
  `c_integer` INT NOT NULL,
  `c_integer_u` BIGINT NOT NULL,
  `c_integer_z` BIGINT NULL,
  `c_integer_u_z` BIGINT NULL,
  `c_integer_n` INT NOT NULL,
  `c_integer_n_n` BIGINT NOT NULL,
  `c_integer_n_z` BIGINT NULL,
  `c_integer_n_u_z` BIGINT NULL,
  `c_bigint` BIGINT NOT NULL,
  `c_bigint_u` DECIMAL(20,0) NOT NULL,
  `c_bigint_z` DECIMAL(20,0) NULL,
  `c_bigint_u_z` DECIMAL(20,0) NULL,
  `c_bigint_n` BIGINT NOT NULL,
  `c_bigint_n_n` DECIMAL(20,0) NOT NULL,
  `c_bigint_n_z` DECIMAL(20,0) NULL,
  `c_bigint_n_u_z` DECIMAL(20,0) NULL,
  `c_decimal` DECIMAL(10,0) NOT NULL,
  `c_decimal_u` DECIMAL(10,0) NOT NULL,
  `c_decimal_z` DECIMAL(10,0) NULL,
  `c_decimal_u_z` DECIMAL(10,0) NULL,
  `c_decimal_n` DECIMAL(10,0) NOT NULL,
  `c_decimal_n_u` DECIMAL(10,0) NOT NULL,
  `c_decimal_n_z` DECIMAL(10,0) NOT NULL,
  `c_decimal_n_u_z` DECIMAL(10,0) NULL,
  `c_decimal_n_n` DECIMAL(10,3) NOT NULL,
  `c_decimal_n_n_u` DECIMAL(10,3) NOT NULL,
  `c_decimal_n_n_z` DECIMAL(10,3) NULL,
  `c_decimal_n_n_u_z` DECIMAL(10,3) NULL,
  `c_dec` DECIMAL(10,0) NOT NULL,
  `c_dec_u` DECIMAL(10,0) NOT NULL,
  `c_dec_z` DECIMAL(10,0) NULL,
  `c_dec_u_z` DECIMAL(10,0) NULL,
  `c_dec_n` DECIMAL(10,0) NOT NULL,
  `c_dec_n_u` DECIMAL(10,0) NOT NULL,
  `c_dec_n_z` DECIMAL(10,0) NULL,
  `c_dec_n_u_z` DECIMAL(10,0) NULL,
  `c_dec_n_n` DECIMAL(10,3) NOT NULL,
  `c_dec_n_n_u` DECIMAL(10,3) NOT NULL,
  `c_dec_n_n_z` DECIMAL(10,3) NULL,
  `c_dec_n_n_u_z` DECIMAL(10,3) NULL,
  `c_numeric` DECIMAL(10,0) NOT NULL,
  `c_numeric_u` DECIMAL(10,0) NOT NULL,
  `c_numeric_z` DECIMAL(10,0) NULL,
  `c_numeric_u_z` DECIMAL(10,0) NULL,
  `c_numeric_n` DECIMAL(10,0) NOT NULL,
  `c_numeric_n_u` DECIMAL(10,0) NOT NULL,
  `c_numeric_n_z` DECIMAL(10,0) NULL,
  `c_numeric_n_u_z` DECIMAL(10,0) NULL,
  `c_numeric_n_n` DECIMAL(10,3) NOT NULL,
  `c_numeric_n_n_u` DECIMAL(10,3) NOT NULL,
  `c_numeric_n_n_z` DECIMAL(10,3) NULL,
  `c_numeric_n_n_u_z` DECIMAL(10,3) NULL,
  `c_fixed` DECIMAL(10,0) NOT NULL,
  `c_fixed_u` DECIMAL(10,0) NOT NULL,
  `c_fixed_z` DECIMAL(10,0) NULL,
  `c_fixed_u_z` DECIMAL(10,0) NULL,
  `c_fixed_n` DECIMAL(10,0) NOT NULL,
  `c_fixed_n_u` DECIMAL(10,0) NOT NULL,
  `c_fixed_n_z` DECIMAL(10,0) NULL,
  `c_fixed_n_u_z` DECIMAL(10,0) NULL,
  `c_fixed_n_n` DECIMAL(10,3) NOT NULL,
  `c_fixed_n_n_u` DECIMAL(10,3) NOT NULL,
  `c_fixed_n_n_z` DECIMAL(10,3) NULL,
  `c_fixed_n_n_u_z` DECIMAL(10,3) NULL,
  `c_float` DECIMAL(12,0) NOT NULL,
  `c_float_u` DECIMAL(12,0) NOT NULL,
  `c_float_z` DECIMAL(12,0) NULL,
  `c_float_u_z` DECIMAL(12,0) NULL,
  `c_float_n` DECIMAL(12,0) NOT NULL,
  `c_float_n_u` DECIMAL(12,0) NOT NULL,
  `c_float_n_z` DECIMAL(12,0) NULL,
  `c_float_n_u_z` DECIMAL(12,0) NULL,
  `c_float_n_n` DECIMAL(12,0) NOT NULL,
  `c_float_n_n_u` DECIMAL(12,0) NOT NULL,
  `c_float_n_n_z` DECIMAL(12,0) NULL,
  `c_float_n_n_u_z` DECIMAL(12,0) NULL,
  `c_double` DECIMAL(22,0) NOT NULL,
  `c_double_u` DECIMAL(22,0) NOT NULL,
  `c_double_z` DECIMAL(22,0) NULL,
  `c_double_u_z` DECIMAL(22,0) NULL,
  `c_double_n_n` DECIMAL(22,0) NOT NULL,
  `c_double_n_n_u` DECIMAL(22,0) NOT NULL,
  `c_double_n_n_z` DECIMAL(22,0) NULL,
  `c_double_n_n_u_z` DECIMAL(22,0) NULL,
  `c_double_precision` DECIMAL(22,0) NOT NULL,
  `c_double_precision_u` DECIMAL(22,0) NOT NULL,
  `c_double_precision_z` DECIMAL(22,0) NULL,
  `c_double_precision_u_z` DECIMAL(22,0) NULL,
  `c_double_precision_n_n` DECIMAL(22,0) NOT NULL,
  `c_double_precision_n_n_u` DECIMAL(22,0) NOT NULL,
  `c_double_precision_n_n_z` DECIMAL(22,0) NULL,
  `c_double_precision_n_n_u_z` DECIMAL(22,0) NULL,
  `c_real` DECIMAL(22,0) NOT NULL,
  `c_real_u` DECIMAL(22,0) NOT NULL,
  `c_real_z` DECIMAL(22,0) NULL,
  `c_real_u_z` DECIMAL(22,0) NULL,
  `c_real_n_n` DECIMAL(22,0) NOT NULL,
  `c_real_n_n_u` DECIMAL(22,0) NOT NULL,
  `c_real_n_n_z` DECIMAL(22,0) NULL,
  `c_real_n_n_u_z` DECIMAL(22,0) NULL,
  `c_date` DATE NOT NULL,
  `c_datetime` DATETIME NOT NULL,
  `c_datetime_n` DATETIME NOT NULL,
  `c_timestamp` DATETIME NOT NULL,
  `c_timestamp_n` DATETIME NULL,
  `c_time` STRING NOT NULL,
  `c_time_n` STRING NOT NULL,
  `c_year` INT NOT NULL,
  `c_year_n` INT NOT NULL,
  `c_char` STRING NOT NULL,
  `c_char_n` STRING NOT NULL,
  `c_character` STRING NOT NULL,
  `c_character_n` STRING NOT NULL,
  `c_nchar` STRING NOT NULL,
  `c_nchar_n` STRING NOT NULL,
  `c_national_char` STRING NOT NULL,
  `c_national_char_n` STRING NOT NULL,
  `c_varchar` STRING NOT NULL,
  `c_character_varying` STRING NOT NULL,
  `c_long_varchar` STRING NOT NULL,
  `c_nvarchar` STRING NOT NULL,
  `c_national_varchar` STRING NOT NULL,
  `c_national_character_varying` STRING NOT NULL,
  `c_tinytext` STRING NOT NULL,
  `c_text` STRING NOT NULL,
  `c_text_n` STRING NOT NULL,
  `c_mediumtext` STRING NOT NULL,
  `c_longtext` STRING NOT NULL,
  `c_long` STRING NOT NULL,
  `c_enum` STRING NULL,
  `c_set` STRING NULL,
  `c_bit1` TINYINT NULL,
  `a1` STRING NULL,
  `m1` TIMESTAMP(3) NOT NULL,
  TIME INDEX (`m1`),
  PRIMARY KEY (`c_serial`)
);

INSERT INTO all_types VALUES (
    123456.987654431,
    1,
    100,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1.123,
    1.123,
    1.123,
    1.123,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1.123,
    1.123,
    1.123,
    1.123,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1.123,
    1.123,
    1.123,
    1.123,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1.123,
    1.123,
    1.123,
    1.123,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    '2024-01-01',
    '2024-01-01 12:00:00',
    '2024-01-01 12:00:00',
    '2024-01-01 12:00:00',
    '2024-01-01 12:00:00',
    '12:00:00',
    '12:00:00',
    2024,
    2024,
    'A',
    'A',
    'A',
    'A',
    'A',
    'A',
    'A',
    'A',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'ABC',
    'value1',
    'value1',
    1,
    'ABC',
    '2024-01-01 12:00:00.000'
);

SELECT * FROM public."all_types" ORDER BY m1 DESC LIMIT 100;

ADMIN flush_table('all_types');

SELECT * FROM public."all_types" ORDER BY m1 DESC LIMIT 100;

DROP TABLE all_types;
