LOAD 'chdb_hook'; /****************************************************************************/ -- PostgreSQL applies column type modifiers when importing values from chDB. -- Copy the corpus to /tmp, where the server definitely has read access. \! cp -f test/corpus/readings.csv /tmp/chdb-readings.csv \set readings_csv file:///tmp/chdb-readings.csv \set readings_structure 'value Decimal(10, 4), sensor String, taken DateTime64(6, ''UTC''), samples Array(Decimal(10, 4)), seq Int64, logged DateTime(''UTC'')' SET TimeZone = 'UTC'; CREATE TABLE readings ( value NUMERIC(4, 1), -- rounds sensor CHAR(3), -- pads taken TIMESTAMP(3), -- drops precision samples NUMERIC(4, 1)[], -- rounds every element seq TEXT, -- renders through the output function logged TIME ); COPY readings FROM :'readings_csv' (structure :'readings_structure'); SELECT * FROM readings; value | sensor | taken | samples | seq | logged -------+--------+------------------------------+------------+-----+---------- 1.2 | ab | Mon Jan 15 12:34:56.789 2024 | {1.2,-6.8} | 42 | 12:34:56 (1 row) -- DateTime to time doesn't skew with TimeZone SET TimeZone = 'America/Los_Angeles'; TRUNCATE readings; COPY readings FROM :'readings_csv' (structure :'readings_structure'); SELECT logged FROM readings; logged ---------- 12:34:56 (1 row) \set ECHO errors