timescaledb/test/sql/copy_where.sql
Lakshmi Narayanan Sreethar e5691bee11 Cleanup PG12 specific code from source and test files
Removed the PG12 specific macros and all the now, dead code. Also updated
the testcases which had workarounds in place to make them compatible
with PG12.
2023-07-25 16:00:18 +05:30

37 lines
1.4 KiB
SQL

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
------- TEST 1: Restrictive copy from file
CREATE TABLE "copy_golden" (
"time" bigint NOT NULL,
"value" double precision NOT NULL
);
\COPY copy_golden (time, value) FROM data/copy_data.csv WITH CSV HEADER
SELECT * FROM copy_golden ORDER BY TIME;
CREATE TABLE "copy_control" (
"time" bigint NOT NULL,
"value" double precision NOT NULL
);
\COPY copy_control (time, value) FROM data/copy_data.csv WITH CSV HEADER WHERE time > 10;
SELECT * FROM copy_control ORDER BY TIME;
CREATE TABLE "copy_test" (
"time" bigint NOT NULL,
"value" double precision NOT NULL
);
SELECT create_hypertable('copy_test', 'time', chunk_time_interval => 10);
\COPY copy_test (time, value) FROM data/copy_data.csv WITH CSV HEADER WHERE time > 10;
SELECT * FROM copy_test ORDER BY TIME;
-- Verify attempting to use subqueries fails the same as non-hypertables
\set ON_ERROR_STOP 0
\COPY copy_control (time, value) FROM data/copy_data.csv WITH CSV HEADER WHERE time IN (SELECT time FROM copy_golden);
\COPY copy_test (time, value) FROM data/copy_data.csv WITH CSV HEADER WHERE time IN (SELECT time FROM copy_golden);
\set ON_ERROR_STOP 1
DROP TABLE copy_golden;
DROP TABLE copy_control;
DROP TABLE copy_test;