From 96aee23a385158a847d22b2ba4d792f5d21f96f9 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 22 Jan 2026 14:47:47 -0500 Subject: [PATCH 1/2] Run `installcheck` tests in parallel Configure `make installcheck` to run the tests in parallel, resulting in far faster test execution on multi-core systems. Adjust the schemas in which some of the tests work to ensure they don't stomp on each other. --- .gitignore | 1 + CHANGELOG.md | 12 +++++++++-- Makefile | 9 ++++++-- test/expected/binary_inserts.out | 8 ++++--- test/expected/binary_inserts_1.out | 8 ++++--- test/expected/binary_queries.out | 32 +++++++++++++++------------- test/expected/binary_queries_1.out | 32 +++++++++++++++------------- test/expected/binary_queries_2.out | 34 ++++++++++++++++-------------- test/expected/binary_queries_3.out | 34 ++++++++++++++++-------------- test/expected/binary_queries_4.out | 32 +++++++++++++++------------- test/expected/binary_queries_5.out | 32 +++++++++++++++------------- test/expected/custom_casts.out | 24 +++++++++++---------- test/expected/deparse_checks.out | 8 ++++--- test/expected/deparse_checks_1.out | 8 ++++--- test/expected/engines.out | 16 ++++++++------ test/expected/engines_1.out | 16 ++++++++------ test/expected/http_inserts.out | 8 ++++--- test/expected/http_inserts_1.out | 8 ++++--- test/sql/binary_inserts.sql | 4 +++- test/sql/binary_queries.sql | 3 +++ test/sql/custom_casts.sql | 4 +++- test/sql/deparse_checks.sql | 4 +++- test/sql/engines.sql | 4 +++- test/sql/http_inserts.sql | 4 +++- 24 files changed, 201 insertions(+), 144 deletions(-) diff --git a/.gitignore b/.gitignore index 9d21dc4..3f86edb 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ compile_commands.json .env .cache/ log/ +/test/schedule diff --git a/CHANGELOG.md b/CHANGELOG.md index a393c51..094e5b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ All notable changes to this project will be documented in this file. It uses the (almost) always fetches these values in UTC, so can store them as `TIMESTAMPTZ` values. * Implemented `INSERT` support for the UUID and INET (IPv4 and IPv6) types. - Thanks to Rahul Mehta for the report (#127)! + Thanks to Rahul Mehta for the report ([#127])! ### 🪲 Bug Fixes @@ -37,8 +37,16 @@ All notable changes to this project will be documented in this file. It uses the * Added tests demonstrating subqueries that pg_clickhouse does not yet push down, to be improved in future releases. - [v0.1.3]: https://github.com/clickhouse/pg_clickhouse/compare/v0.1.2...v0.1.3 +### 🏗️ Build Setup + +* Configured `make installcheck` to run the tests in parallel, resulting in + far faster test execution on multi-core systems. Adjusted the schemas in + which some of the tests work to ensure they don't stomp on each other. + + [v0.1.3]: https://github.com/ClickHouse/pg_clickhouse/compare/v0.1.2...v0.1.3 [ClickHouse Issue 88088]: https://github.com/ClickHouse/ClickHouse/pull/88088 + [#127]: https://github.com/ClickHouse/pg_clickhouse/issues/127 + "ClickHouse/pg_clickhouse#127 INSERT into ClickHouse table with UUID column fails: unexpected column type for 2950: UUID" ## [v0.1.2] — 2026-01-07 diff --git a/Makefile b/Makefile index 9f7d892..57e5e2d 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ DISTVERSION = $(shell grep -m 1 '[[:space:]]\{3\}"version":' META.json | \ DATA = $(sort $(wildcard sql/$(EXTENSION)--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql) DOCS = $(wildcard doc/*.md) TESTS = $(wildcard test/sql/*.sql) -REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS)) +REGRESS = --schedule test/schedule REGRESS_OPTS = --inputdir=test --load-extension=$(EXTENSION) PG_CONFIG ?= pg_config MODULE_big = $(EXTENSION) @@ -71,7 +71,7 @@ ifneq ($(OS),darwin) endif # Clean up the clickhouse-cpp build directory and generated files. -EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql src/fdw.c compile_commands.json $(EXTENSION)-$(DISTVERSION).zip +EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql src/fdw.c compile_commands.json test/schedule $(EXTENSION)-$(DISTVERSION).zip ifndef NO_VENDOR_CLEAN EXTRA_CLEAN += $(CH_CPP_BUILD_DIR) endif @@ -137,6 +137,11 @@ dist: $(EXTENSION)-$(DISTVERSION).zip $(EXTENSION)-$(DISTVERSION).zip: git archive-all -v --prefix "$(EXTENSION)-$(DISTVERSION)/" --force-submodules $(EXTENSION)-$(DISTVERSION).zip +test/schedule: + @echo "test: $(patsubst test/sql/%.sql,%,$(TESTS))" > $@ + +installcheck: test/schedule + # Test the PGXN distribution. dist-test: $(EXTENSION)-$(DISTVERSION).zip unzip $(EXTENSION)-$(DISTVERSION).zip diff --git a/test/expected/binary_inserts.out b/test/expected/binary_inserts.out index 47b2ead..63d5a71 100644 --- a/test/expected/binary_inserts.out +++ b/test/expected/binary_inserts.out @@ -76,7 +76,9 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_inserts_test.addr ( (1 row) -IMPORT FOREIGN SCHEMA binary_inserts_test FROM SERVER binary_inserts_loopback INTO public; +CREATE SCHEMA binary_inserts_test; +IMPORT FOREIGN SCHEMA binary_inserts_test FROM SERVER binary_inserts_loopback INTO binary_inserts_test; +SET search_path = binary_inserts_test, public; /* ints */ INSERT INTO ints SELECT i, i + 1, i + 2, i+ 3 FROM generate_series(1, 3) i; @@ -182,7 +184,7 @@ SELECT * FROM null_ints ORDER BY c1; /* check dates and strings */ ALTER TABLE complex ALTER COLUMN c8 SET DATA TYPE timestamp(3); \d+ complex - Foreign table "public.complex" + Foreign table "binary_inserts_test.complex" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+--------------------------------+-----------+----------+---------+-------------+----------+--------------+------------- c1 | integer | | not null | | | plain | | @@ -250,7 +252,7 @@ SELECT * FROM arrays ORDER BY c1; /* Check UUIDs and IPs */ \d addr - Foreign table "public.addr" + Foreign table "binary_inserts_test.addr" Column | Type | Collation | Nullable | Default | FDW options --------+------+-----------+----------+---------+------------- c1 | uuid | | not null | | diff --git a/test/expected/binary_inserts_1.out b/test/expected/binary_inserts_1.out index f0e0010..06defc4 100644 --- a/test/expected/binary_inserts_1.out +++ b/test/expected/binary_inserts_1.out @@ -76,7 +76,9 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_inserts_test.addr ( (1 row) -IMPORT FOREIGN SCHEMA binary_inserts_test FROM SERVER binary_inserts_loopback INTO public; +CREATE SCHEMA binary_inserts_test; +IMPORT FOREIGN SCHEMA binary_inserts_test FROM SERVER binary_inserts_loopback INTO binary_inserts_test; +SET search_path = binary_inserts_test, public; /* ints */ INSERT INTO ints SELECT i, i + 1, i + 2, i+ 3 FROM generate_series(1, 3) i; @@ -182,7 +184,7 @@ SELECT * FROM null_ints ORDER BY c1; /* check dates and strings */ ALTER TABLE complex ALTER COLUMN c8 SET DATA TYPE timestamp(3); \d+ complex - Foreign table "public.complex" + Foreign table "binary_inserts_test.complex" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+--------------------------------+-----------+----------+---------+-------------+----------+--------------+------------- c1 | integer | | not null | | | plain | | @@ -241,7 +243,7 @@ SELECT * FROM arrays ORDER BY c1; /* Check UUIDs and IPs */ \d addr - Foreign table "public.addr" + Foreign table "binary_inserts_test.addr" Column | Type | Collation | Nullable | Default | FDW options --------+------+-----------+----------+---------+------------- c1 | uuid | | not null | | diff --git a/test/expected/binary_queries.out b/test/expected/binary_queries.out index f6c38aa..e489dcd 100644 --- a/test/expected/binary_queries.out +++ b/test/expected/binary_queries.out @@ -45,6 +45,8 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int (1 row) +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, @@ -165,7 +167,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OF -> Sort Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Sort Key: t1.c1, t1.tableoid - -> Foreign Scan on public.ft1 t1 + -> Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (8 rows) @@ -188,7 +190,7 @@ SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OFFSET 100 LIMIT 10; EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: t1.*, c1 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 ORDER BY c1 ASC NULLS LAST LIMIT 10 OFFSET 100 (3 rows) @@ -216,7 +218,7 @@ SELECT * FROM ft1 WHERE false; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c7 >= '1')) AND ((c1 = 101)) AND ((c6 = '1')) (3 rows) @@ -322,7 +324,7 @@ RESET enable_nestloop; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const QUERY PLAN -------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 1)) (3 rows) @@ -330,7 +332,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 100)) AND ((c2 = 0)) (3 rows) @@ -346,7 +348,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest QUERY PLAN --------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (3 rows) @@ -354,7 +356,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((round(abs(c1), 0) = 1)) (3 rows) @@ -362,7 +364,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) QUERY PLAN ------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (- c1))) (3 rows) @@ -370,7 +372,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); -- OpExpr(r) QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((1 = factorial(c1))) (3 rows) @@ -378,7 +380,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE (((c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL))) (3 rows) @@ -386,7 +388,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((has([c2, 1, (c1 + 0)],c1))) (3 rows) @@ -509,7 +511,7 @@ SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]) ORDER BY c1; -- Scalar EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- ArrayRef QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (([c1, c2, 3])[1]))) (3 rows) @@ -632,7 +634,7 @@ SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] ORDER BY c1; -- ArrayRef EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c6 = 'foo''s\\bar')) (3 rows) @@ -640,7 +642,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c8 = 'foo')) (3 rows) @@ -700,7 +702,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT COUNT(DISTINCT c1) FILTER (WHERE c1 < 20) FR -------------------------------------------------------------------------------------- Aggregate Output: count(DISTINCT c1) FILTER (WHERE (c1 < 20)) - -> Foreign Scan on public.ft2 + -> Foreign Scan on binary_queries_test.ft2 Output: c1, c2 Remote SQL: SELECT c1 FROM binary_queries_test.t2 ORDER BY c1 ASC NULLS LAST (5 rows) diff --git a/test/expected/binary_queries_1.out b/test/expected/binary_queries_1.out index 79556a4..5782a88 100644 --- a/test/expected/binary_queries_1.out +++ b/test/expected/binary_queries_1.out @@ -45,6 +45,8 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int (1 row) +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, @@ -165,7 +167,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OF -> Sort Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Sort Key: t1.c1, t1.tableoid - -> Foreign Scan on public.ft1 t1 + -> Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (8 rows) @@ -188,7 +190,7 @@ SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OFFSET 100 LIMIT 10; EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: t1.*, c1 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 ORDER BY c1 ASC NULLS LAST LIMIT 10 OFFSET 100 (3 rows) @@ -216,7 +218,7 @@ SELECT * FROM ft1 WHERE false; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c7 >= '1')) AND ((c1 = 101)) AND ((c6 = '1')) (3 rows) @@ -322,7 +324,7 @@ RESET enable_nestloop; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const QUERY PLAN -------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 1)) (3 rows) @@ -330,7 +332,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 100)) AND ((c2 = 0)) (3 rows) @@ -346,7 +348,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest QUERY PLAN --------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (3 rows) @@ -354,7 +356,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((round(abs(c1), 0) = 1)) (3 rows) @@ -362,7 +364,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) QUERY PLAN ------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (- c1))) (3 rows) @@ -370,7 +372,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); -- OpExpr(r) QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((1 = factorial(c1))) (3 rows) @@ -378,7 +380,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE (((c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL))) (3 rows) @@ -386,7 +388,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((has([c2, 1, (c1 + 0)],c1))) (3 rows) @@ -509,7 +511,7 @@ SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]) ORDER BY c1; -- Scalar EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- ArrayRef QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (([c1, c2, 3])[1]))) (3 rows) @@ -632,7 +634,7 @@ SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] ORDER BY c1; -- ArrayRef EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c6 = 'foo''s\\bar')) (3 rows) @@ -640,7 +642,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c8 = 'foo')) (3 rows) @@ -700,7 +702,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT COUNT(DISTINCT c1) FILTER (WHERE c1 < 20) FR -------------------------------------------------------------------------------------- Aggregate Output: count(DISTINCT c1) FILTER (WHERE (c1 < 20)) - -> Foreign Scan on public.ft2 + -> Foreign Scan on binary_queries_test.ft2 Output: c1, c2 Remote SQL: SELECT c1 FROM binary_queries_test.t2 ORDER BY c1 ASC NULLS LAST (5 rows) diff --git a/test/expected/binary_queries_2.out b/test/expected/binary_queries_2.out index b04a05f..37f04c2 100644 --- a/test/expected/binary_queries_2.out +++ b/test/expected/binary_queries_2.out @@ -45,6 +45,8 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int (1 row) +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, @@ -165,7 +167,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OF -> Sort Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Sort Key: t1.c1, t1.tableoid - -> Foreign Scan on public.ft1 t1 + -> Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (8 rows) @@ -188,7 +190,7 @@ SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OFFSET 100 LIMIT 10; EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: t1.*, c1 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 ORDER BY c1 ASC NULLS LAST LIMIT 10 OFFSET 100 (3 rows) @@ -216,7 +218,7 @@ SELECT * FROM ft1 WHERE false; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c7 >= '1')) AND ((c1 = 101)) AND ((c6 = '1')) (3 rows) @@ -322,7 +324,7 @@ RESET enable_nestloop; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const QUERY PLAN -------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 1)) (3 rows) @@ -330,7 +332,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 100)) AND ((c2 = 0)) (3 rows) @@ -338,7 +340,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- NullTest QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 IS NULL)) (3 rows) @@ -346,7 +348,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 IS NOT NULL)) (3 rows) @@ -354,7 +356,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((round(abs(c1), 0) = 1)) (3 rows) @@ -362,7 +364,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) QUERY PLAN ------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (- c1))) (3 rows) @@ -370,7 +372,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); -- OpExpr(r) QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((1 = factorial(c1))) (3 rows) @@ -378,7 +380,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE (((c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL))) (3 rows) @@ -386,7 +388,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((has([c2, 1, (c1 + 0)],c1))) (3 rows) @@ -509,7 +511,7 @@ SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]) ORDER BY c1; -- Scalar EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- ArrayRef QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (([c1, c2, 3])[1]))) (3 rows) @@ -632,7 +634,7 @@ SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] ORDER BY c1; -- ArrayRef EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c6 = 'foo''s\\bar')) (3 rows) @@ -640,7 +642,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c8 = 'foo')) (3 rows) @@ -700,7 +702,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT COUNT(DISTINCT c1) FILTER (WHERE c1 < 20) FR -------------------------------------------------------------------------------------- Aggregate Output: count(DISTINCT c1) FILTER (WHERE (c1 < 20)) - -> Foreign Scan on public.ft2 + -> Foreign Scan on binary_queries_test.ft2 Output: c1, c2 Remote SQL: SELECT c1 FROM binary_queries_test.t2 ORDER BY c1 ASC NULLS LAST (5 rows) diff --git a/test/expected/binary_queries_3.out b/test/expected/binary_queries_3.out index d139b9c..8165dce 100644 --- a/test/expected/binary_queries_3.out +++ b/test/expected/binary_queries_3.out @@ -45,6 +45,8 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int (1 row) +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, @@ -165,7 +167,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OF -> Sort Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Sort Key: t1.c1, t1.tableoid - -> Foreign Scan on public.ft1 t1 + -> Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (8 rows) @@ -188,7 +190,7 @@ SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OFFSET 100 LIMIT 10; EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: t1.*, c1 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 ORDER BY c1 ASC NULLS LAST LIMIT 10 OFFSET 100 (3 rows) @@ -216,7 +218,7 @@ SELECT * FROM ft1 WHERE false; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c7 >= '1')) AND ((c1 = 101)) AND ((c6 = '1')) (3 rows) @@ -322,7 +324,7 @@ RESET enable_nestloop; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const QUERY PLAN -------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 1)) (3 rows) @@ -330,7 +332,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 100)) AND ((c2 = 0)) (3 rows) @@ -338,7 +340,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- NullTest QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 IS NULL)) (3 rows) @@ -346,7 +348,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 IS NOT NULL)) (3 rows) @@ -354,7 +356,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((round(abs(c1), 0) = 1)) (3 rows) @@ -362,7 +364,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) QUERY PLAN ------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (- c1))) (3 rows) @@ -370,7 +372,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); -- OpExpr(r) QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((1 = factorial(c1))) (3 rows) @@ -378,7 +380,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE (((c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL))) (3 rows) @@ -386,7 +388,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((has([c2, 1, (c1 + 0)],c1))) (3 rows) @@ -509,7 +511,7 @@ SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]) ORDER BY c1; -- Scalar EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- ArrayRef QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (([c1, c2, 3])[1]))) (3 rows) @@ -632,7 +634,7 @@ SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] ORDER BY c1; -- ArrayRef EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c6 = 'foo''s\\bar')) (3 rows) @@ -640,7 +642,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c8 = 'foo')) (3 rows) @@ -700,7 +702,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT COUNT(DISTINCT c1) FILTER (WHERE c1 < 20) FR ----------------------------------------------------------- Aggregate Output: count(DISTINCT c1) FILTER (WHERE (c1 < 20)) - -> Foreign Scan on public.ft2 + -> Foreign Scan on binary_queries_test.ft2 Output: c1, c2 Remote SQL: SELECT c1 FROM binary_queries_test.t2 (5 rows) diff --git a/test/expected/binary_queries_4.out b/test/expected/binary_queries_4.out index 0276928..9adcedf 100644 --- a/test/expected/binary_queries_4.out +++ b/test/expected/binary_queries_4.out @@ -45,6 +45,8 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int (1 row) +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, @@ -165,7 +167,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OF -> Sort Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Sort Key: t1.c1, t1.tableoid - -> Foreign Scan on public.ft1 t1 + -> Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (8 rows) @@ -188,7 +190,7 @@ SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OFFSET 100 LIMIT 10; EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: t1.*, c1 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 ORDER BY c1 ASC NULLS LAST LIMIT 10 OFFSET 100 (3 rows) @@ -216,7 +218,7 @@ SELECT * FROM ft1 WHERE false; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c7 >= '1')) AND ((c1 = 101)) AND ((c6 = '1')) (3 rows) @@ -322,7 +324,7 @@ RESET enable_nestloop; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const QUERY PLAN -------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 1)) (3 rows) @@ -330,7 +332,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 100)) AND ((c2 = 0)) (3 rows) @@ -346,7 +348,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest QUERY PLAN --------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (3 rows) @@ -354,7 +356,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((round(abs(c1), 0) = 1)) (3 rows) @@ -362,7 +364,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) QUERY PLAN ------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (- c1))) (3 rows) @@ -370,7 +372,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); -- OpExpr(r) QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((1 = factorial(c1))) (3 rows) @@ -378,7 +380,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE (((c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL))) (3 rows) @@ -386,7 +388,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((has([c2, 1, (c1 + 0)],c1))) (3 rows) @@ -509,7 +511,7 @@ SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]) ORDER BY c1; -- Scalar EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- ArrayRef QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (([c1, c2, 3])[1]))) (3 rows) @@ -632,7 +634,7 @@ SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] ORDER BY c1; -- ArrayRef EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c6 = 'foo''s\\bar')) (3 rows) @@ -640,7 +642,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c8 = 'foo')) (3 rows) @@ -700,7 +702,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT COUNT(DISTINCT c1) FILTER (WHERE c1 < 20) FR -------------------------------------------------------------------------------------- Aggregate Output: count(DISTINCT c1) FILTER (WHERE (c1 < 20)) - -> Foreign Scan on public.ft2 + -> Foreign Scan on binary_queries_test.ft2 Output: c1, c2 Remote SQL: SELECT c1 FROM binary_queries_test.t2 ORDER BY c1 ASC NULLS LAST (5 rows) diff --git a/test/expected/binary_queries_5.out b/test/expected/binary_queries_5.out index 8374d46..0a3fbb9 100644 --- a/test/expected/binary_queries_5.out +++ b/test/expected/binary_queries_5.out @@ -45,6 +45,8 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int (1 row) +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, @@ -165,7 +167,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OF -> Sort Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Sort Key: t1.c1, t1.tableoid - -> Foreign Scan on public.ft1 t1 + -> Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (8 rows) @@ -188,7 +190,7 @@ SELECT * FROM ft1 t1 ORDER BY t1.c1, t1.tableoid OFFSET 100 LIMIT 10; EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: t1.*, c1 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 ORDER BY c1 ASC NULLS LAST LIMIT 10 OFFSET 100 (3 rows) @@ -216,7 +218,7 @@ SELECT * FROM ft1 WHERE false; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c7 >= '1')) AND ((c1 = 101)) AND ((c6 = '1')) (3 rows) @@ -322,7 +324,7 @@ RESET enable_nestloop; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const QUERY PLAN -------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 1)) (3 rows) @@ -330,7 +332,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = 100)) AND ((c2 = 0)) (3 rows) @@ -346,7 +348,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest QUERY PLAN --------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 (3 rows) @@ -354,7 +356,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((round(abs(c1), 0) = 1)) (3 rows) @@ -362,7 +364,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) QUERY PLAN ------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (- c1))) (3 rows) @@ -370,7 +372,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); -- OpExpr(r) QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((1 = factorial(c1))) (3 rows) @@ -378,7 +380,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = factorial(c1); EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE (((c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL))) (3 rows) @@ -386,7 +388,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((has([c2, 1, (c1 + 0)],c1))) (3 rows) @@ -509,7 +511,7 @@ SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]) ORDER BY c1; -- Scalar EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- ArrayRef QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c1 = (([c1, c2, 3])[1]))) (3 rows) @@ -632,7 +634,7 @@ SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] ORDER BY c1; -- ArrayRef EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c6 = 'foo''s\\bar')) (3 rows) @@ -640,7 +642,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote QUERY PLAN ------------------------------------------------------------------------------------------------------ - Foreign Scan on public.ft1 t1 + Foreign Scan on binary_queries_test.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT c1, c2, c3, c4, c5, c6, c7, c8 FROM binary_queries_test.t1 WHERE ((c8 = 'foo')) (3 rows) @@ -700,7 +702,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT COUNT(DISTINCT c1) FILTER (WHERE c1 < 20) FR -------------------------------------------------------------------------------------- Aggregate Output: count(DISTINCT c1) FILTER (WHERE (c1 < 20)) - -> Foreign Scan on public.ft2 + -> Foreign Scan on binary_queries_test.ft2 Output: c1, c2 Remote SQL: SELECT c1 FROM binary_queries_test.t2 ORDER BY c1 ASC NULLS LAST (5 rows) diff --git a/test/expected/custom_casts.out b/test/expected/custom_casts.out index 244e6e1..620b27e 100644 --- a/test/expected/custom_casts.out +++ b/test/expected/custom_casts.out @@ -34,11 +34,13 @@ $$); (1 row) -IMPORT FOREIGN SCHEMA casts_test FROM SERVER casts_loopback INTO public; +CREATE SCHEMA casts_test; +IMPORT FOREIGN SCHEMA casts_test FROM SERVER casts_loopback INTO casts_test; +SET search_path = casts_test, public; EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUInt8(num) IN (8, 3, 5); QUERY PLAN ----------------------------------------------------------------------------------- - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt8(num) IN (8,3,5))) (3 rows) @@ -54,7 +56,7 @@ SELECT num FROM things WHERE toUInt8(num) IN (8, 3, 5); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUInt8(name) IN (1, 2, 3); QUERY PLAN ------------------------------------------------------------------------------------ - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt8(name) IN (1,2,3))) (3 rows) @@ -70,7 +72,7 @@ SELECT num FROM things WHERE toUInt8(name) IN (1, 2, 3); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint16(num) IN (8, 3, 5); QUERY PLAN ------------------------------------------------------------------------------------ - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt16(num) IN (8,3,5))) (3 rows) @@ -86,7 +88,7 @@ SELECT num FROM things WHERE toUint16(num) IN (8, 3, 5); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint16(name) IN (1, 2, 3); QUERY PLAN ------------------------------------------------------------------------------------- - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt16(name) IN (1,2,3))) (3 rows) @@ -102,7 +104,7 @@ SELECT num FROM things WHERE toUint16(name) IN (1, 2, 3); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint32(num) IN (8, 3, 5); QUERY PLAN ------------------------------------------------------------------------------------ - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt32(num) IN (8,3,5))) (3 rows) @@ -118,7 +120,7 @@ SELECT num FROM things WHERE toUint32(num) IN (8, 3, 5); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint32(name) IN (1, 2, 3); QUERY PLAN ------------------------------------------------------------------------------------- - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt32(name) IN (1,2,3))) (3 rows) @@ -134,7 +136,7 @@ SELECT num FROM things WHERE toUint32(name) IN (1, 2, 3); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint64(num) IN (8, 3, 5); QUERY PLAN ------------------------------------------------------------------------------------ - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt64(num) IN (8,3,5))) (3 rows) @@ -150,7 +152,7 @@ SELECT num FROM things WHERE toUint64(num) IN (8, 3, 5); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint64(name) IN (1, 2, 3); QUERY PLAN ------------------------------------------------------------------------------------- - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt64(name) IN (1,2,3))) (3 rows) @@ -166,7 +168,7 @@ SELECT num FROM things WHERE toUint64(name) IN (1, 2, 3); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint128(num) IN (8, 3, 5); QUERY PLAN ------------------------------------------------------------------------------------- - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt128(num) IN (8,3,5))) (3 rows) @@ -182,7 +184,7 @@ SELECT num FROM things WHERE toUint128(num) IN (8, 3, 5); EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUint128(name) IN (1, 2, 3); QUERY PLAN -------------------------------------------------------------------------------------- - Foreign Scan on public.things + Foreign Scan on casts_test.things Output: num Remote SQL: SELECT num FROM casts_test.things WHERE ((toUInt128(name) IN (1,2,3))) (3 rows) diff --git a/test/expected/deparse_checks.out b/test/expected/deparse_checks.out index 217b690..fa2a118 100644 --- a/test/expected/deparse_checks.out +++ b/test/expected/deparse_checks.out @@ -28,9 +28,11 @@ SELECT clickhouse_raw_query(' (1 row) -IMPORT FOREIGN SCHEMA "deparse_test" FROM SERVER deparse_lookback INTO public; +CREATE SCHEMA deparse_test; +IMPORT FOREIGN SCHEMA deparse_test FROM SERVER deparse_lookback INTO deparse_test; +SET search_path = deparse_test, public; \d+ t1 - Foreign table "public.t1" + Foreign table "deparse_test.t1" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+----------+-----------+----------+---------+-------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -63,7 +65,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM t1 ORDER BY a NULLS FIRST, b LIMIT 3; QUERY PLAN ----------------------------------------------------------------------------------------------------- - Foreign Scan on public.t1 + Foreign Scan on deparse_test.t1 Output: a, b Remote SQL: SELECT a, b FROM deparse_test.t1 ORDER BY a ASC NULLS FIRST, b ASC NULLS LAST LIMIT 3 (3 rows) diff --git a/test/expected/deparse_checks_1.out b/test/expected/deparse_checks_1.out index e8c9320..5884642 100644 --- a/test/expected/deparse_checks_1.out +++ b/test/expected/deparse_checks_1.out @@ -28,9 +28,11 @@ SELECT clickhouse_raw_query(' (1 row) -IMPORT FOREIGN SCHEMA "deparse_test" FROM SERVER deparse_lookback INTO public; +CREATE SCHEMA deparse_test; +IMPORT FOREIGN SCHEMA deparse_test FROM SERVER deparse_lookback INTO deparse_test; +SET search_path = deparse_test, public; \d+ t1 - Foreign table "public.t1" + Foreign table "deparse_test.t1" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+----------+-----------+----------+---------+-------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -60,7 +62,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM t1 ORDER BY a NULLS FIRST, b LIMIT 3; QUERY PLAN ----------------------------------------------------------------------------------------------------- - Foreign Scan on public.t1 + Foreign Scan on deparse_test.t1 Output: a, b Remote SQL: SELECT a, b FROM deparse_test.t1 ORDER BY a ASC NULLS FIRST, b ASC NULLS LAST LIMIT 3 (3 rows) diff --git a/test/expected/engines.out b/test/expected/engines.out index ac58be9..d71081e 100644 --- a/test/expected/engines.out +++ b/test/expected/engines.out @@ -93,9 +93,11 @@ SELECT clickhouse_raw_query(' (1 row) -IMPORT FOREIGN SCHEMA "engines_test" FROM SERVER engines_loopback INTO public; +CREATE SCHEMA engines_test; +IMPORT FOREIGN SCHEMA engines_test FROM SERVER engines_loopback INTO engines_test; +SET search_path = engines_test, public; \d+ t1 - Foreign table "public.t1" + Foreign table "engines_test.t1" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+-------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -107,7 +109,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't1', engine 'MergeTree') \d+ t1_aggr - Foreign table "public.t1_aggr" + Foreign table "engines_test.t1_aggr" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -119,7 +121,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't1_aggr', engine 'MaterializedView') \d+ t2 - Foreign table "public.t2" + Foreign table "engines_test.t2" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -131,7 +133,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't2', engine 'AggregatingMergeTree') \d+ t3 - Foreign table "public.t3" + Foreign table "engines_test.t3" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+-----------+-----------+----------+---------+-------------+----------+--------------+------------- a | integer | | not null | | | plain | | @@ -145,7 +147,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't3', engine 'MergeTree') \d+ t3_aggr - Foreign table "public.t3_aggr" + Foreign table "engines_test.t3_aggr" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+-------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -157,7 +159,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't3_aggr', engine 'MaterializedView') \d+ t4 - Foreign table "public.t4" + Foreign table "engines_test.t4" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | diff --git a/test/expected/engines_1.out b/test/expected/engines_1.out index d6f3159..9ba0f4c 100644 --- a/test/expected/engines_1.out +++ b/test/expected/engines_1.out @@ -93,9 +93,11 @@ SELECT clickhouse_raw_query(' (1 row) -IMPORT FOREIGN SCHEMA "engines_test" FROM SERVER engines_loopback INTO public; +CREATE SCHEMA engines_test; +IMPORT FOREIGN SCHEMA engines_test FROM SERVER engines_loopback INTO engines_test; +SET search_path = engines_test, public; \d+ t1 - Foreign table "public.t1" + Foreign table "engines_test.t1" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+-------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -104,7 +106,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't1', engine 'MergeTree') \d+ t1_aggr - Foreign table "public.t1_aggr" + Foreign table "engines_test.t1_aggr" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -113,7 +115,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't1_aggr', engine 'MaterializedView') \d+ t2 - Foreign table "public.t2" + Foreign table "engines_test.t2" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -122,7 +124,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't2', engine 'AggregatingMergeTree') \d+ t3 - Foreign table "public.t3" + Foreign table "engines_test.t3" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+-----------+-----------+----------+---------+-------------+----------+--------------+------------- a | integer | | not null | | | plain | | @@ -132,7 +134,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't3', engine 'MergeTree') \d+ t3_aggr - Foreign table "public.t3_aggr" + Foreign table "engines_test.t3_aggr" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+-------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | @@ -141,7 +143,7 @@ Server: engines_loopback FDW options: (database 'engines_test', table_name 't3_aggr', engine 'MaterializedView') \d+ t4 - Foreign table "public.t4" + Foreign table "engines_test.t4" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------------------------------+---------+--------------+------------- a | integer | | not null | | | plain | | diff --git a/test/expected/http_inserts.out b/test/expected/http_inserts.out index 9bb44d3..e34fc93 100644 --- a/test/expected/http_inserts.out +++ b/test/expected/http_inserts.out @@ -76,7 +76,9 @@ SELECT clickhouse_raw_query('CREATE TABLE http_inserts_test.addr ( (1 row) -IMPORT FOREIGN SCHEMA http_inserts_test FROM SERVER http_inserts_loopback INTO public; +CREATE SCHEMA http_inserts_test; +IMPORT FOREIGN SCHEMA http_inserts_test FROM SERVER http_inserts_loopback INTO http_inserts_test; +SET search_path = http_inserts_test, public; /* ints */ INSERT INTO ints SELECT i, i + 1, i + 2, i+ 3 FROM generate_series(1, 3) i; @@ -182,7 +184,7 @@ SELECT * FROM null_ints ORDER BY c1; /* check dates and strings */ ALTER TABLE complex ALTER COLUMN c8 SET DATA TYPE timestamp(3); \d+ complex - Foreign table "public.complex" + Foreign table "http_inserts_test.complex" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+--------------------------------+-----------+----------+---------+-------------+----------+--------------+------------- c1 | integer | | not null | | | plain | | @@ -249,7 +251,7 @@ SELECT * FROM arrays ORDER BY c1; /* Check UUIDs and IPs */ \d addr - Foreign table "public.addr" + Foreign table "http_inserts_test.addr" Column | Type | Collation | Nullable | Default | FDW options --------+------+-----------+----------+---------+------------- c1 | uuid | | not null | | diff --git a/test/expected/http_inserts_1.out b/test/expected/http_inserts_1.out index 783ee8a..285e9d9 100644 --- a/test/expected/http_inserts_1.out +++ b/test/expected/http_inserts_1.out @@ -76,7 +76,9 @@ SELECT clickhouse_raw_query('CREATE TABLE http_inserts_test.addr ( (1 row) -IMPORT FOREIGN SCHEMA http_inserts_test FROM SERVER http_inserts_loopback INTO public; +CREATE SCHEMA http_inserts_test; +IMPORT FOREIGN SCHEMA http_inserts_test FROM SERVER http_inserts_loopback INTO http_inserts_test; +SET search_path = http_inserts_test, public; /* ints */ INSERT INTO ints SELECT i, i + 1, i + 2, i+ 3 FROM generate_series(1, 3) i; @@ -182,7 +184,7 @@ SELECT * FROM null_ints ORDER BY c1; /* check dates and strings */ ALTER TABLE complex ALTER COLUMN c8 SET DATA TYPE timestamp(3); \d+ complex - Foreign table "public.complex" + Foreign table "http_inserts_test.complex" Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description --------+--------------------------------+-----------+----------+---------+-------------+----------+--------------+------------- c1 | integer | | not null | | | plain | | @@ -240,7 +242,7 @@ SELECT * FROM arrays ORDER BY c1; /* Check UUIDs and IPs */ \d addr - Foreign table "public.addr" + Foreign table "http_inserts_test.addr" Column | Type | Collation | Nullable | Default | FDW options --------+------+-----------+----------+---------+------------- c1 | uuid | | not null | | diff --git a/test/sql/binary_inserts.sql b/test/sql/binary_inserts.sql index 4c9a0d2..71c35d2 100644 --- a/test/sql/binary_inserts.sql +++ b/test/sql/binary_inserts.sql @@ -39,7 +39,9 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_inserts_test.addr ( ) ENGINE = MergeTree PARTITION BY c1 ORDER BY (c1); '); -IMPORT FOREIGN SCHEMA binary_inserts_test FROM SERVER binary_inserts_loopback INTO public; +CREATE SCHEMA binary_inserts_test; +IMPORT FOREIGN SCHEMA binary_inserts_test FROM SERVER binary_inserts_loopback INTO binary_inserts_test; +SET search_path = binary_inserts_test, public; /* ints */ INSERT INTO ints diff --git a/test/sql/binary_queries.sql b/test/sql/binary_queries.sql index 5c93438..f703d5f 100644 --- a/test/sql/binary_queries.sql +++ b/test/sql/binary_queries.sql @@ -18,6 +18,9 @@ SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t3 (c1 Int, c3 Str SELECT clickhouse_raw_query('CREATE TABLE binary_queries_test.t4 (c1 Int, c2 Int, c3 String) ENGINE = MergeTree PARTITION BY c1 % 10000 ORDER BY (c1);'); +CREATE SCHEMA binary_queries_test; +SET search_path = binary_queries_test, public; + CREATE FOREIGN TABLE ft1 ( c0 int, c1 int NOT NULL, diff --git a/test/sql/custom_casts.sql b/test/sql/custom_casts.sql index 26176f8..a689cb3 100644 --- a/test/sql/custom_casts.sql +++ b/test/sql/custom_casts.sql @@ -18,7 +18,9 @@ SELECT clickhouse_raw_query($$ FROM numbers(10); $$); -IMPORT FOREIGN SCHEMA casts_test FROM SERVER casts_loopback INTO public; +CREATE SCHEMA casts_test; +IMPORT FOREIGN SCHEMA casts_test FROM SERVER casts_loopback INTO casts_test; +SET search_path = casts_test, public; EXPLAIN (VERBOSE, COSTS OFF) SELECT num FROM things WHERE toUInt8(num) IN (8, 3, 5); SELECT num FROM things WHERE toUInt8(num) IN (8, 3, 5); diff --git a/test/sql/deparse_checks.sql b/test/sql/deparse_checks.sql index 08fea2d..1b2bce6 100644 --- a/test/sql/deparse_checks.sql +++ b/test/sql/deparse_checks.sql @@ -11,7 +11,9 @@ SELECT clickhouse_raw_query(' SELECT clickhouse_raw_query(' insert into deparse_test.t1 select number % 10, number % 10 > 5 from numbers(1, 100);'); -IMPORT FOREIGN SCHEMA "deparse_test" FROM SERVER deparse_lookback INTO public; +CREATE SCHEMA deparse_test; +IMPORT FOREIGN SCHEMA deparse_test FROM SERVER deparse_lookback INTO deparse_test; +SET search_path = deparse_test, public; \d+ t1 ALTER TABLE t1 ALTER COLUMN b SET DATA TYPE bool; diff --git a/test/sql/engines.sql b/test/sql/engines.sql index ca0e592..ab4c9c2 100644 --- a/test/sql/engines.sql +++ b/test/sql/engines.sql @@ -48,7 +48,9 @@ SELECT clickhouse_raw_query(' engine = AggregatingMergeTree() order by a'); -IMPORT FOREIGN SCHEMA "engines_test" FROM SERVER engines_loopback INTO public; +CREATE SCHEMA engines_test; +IMPORT FOREIGN SCHEMA engines_test FROM SERVER engines_loopback INTO engines_test; +SET search_path = engines_test, public; \d+ t1 \d+ t1_aggr diff --git a/test/sql/http_inserts.sql b/test/sql/http_inserts.sql index fb224f0..14243bc 100644 --- a/test/sql/http_inserts.sql +++ b/test/sql/http_inserts.sql @@ -39,7 +39,9 @@ SELECT clickhouse_raw_query('CREATE TABLE http_inserts_test.addr ( ) ENGINE = MergeTree PARTITION BY c1 ORDER BY (c1); '); -IMPORT FOREIGN SCHEMA http_inserts_test FROM SERVER http_inserts_loopback INTO public; +CREATE SCHEMA http_inserts_test; +IMPORT FOREIGN SCHEMA http_inserts_test FROM SERVER http_inserts_loopback INTO http_inserts_test; +SET search_path = http_inserts_test, public; /* ints */ INSERT INTO ints From ac1a3b45df95d2a306ce1040a591c7a39f927023 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 22 Jan 2026 15:04:27 -0500 Subject: [PATCH 2/2] Add security policy --- CHANGELOG.md | 4 +++ SECURITY.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 SECURITY.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 094e5b5..7e5cf91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,10 @@ All notable changes to this project will be documented in this file. It uses the * Fixed a server crash when attempting to insert types not yet supported by the binary engine. +### 🚀 Distribution + +* Added the [security policy](SECURITY.md). + ### 📔 Notes * Cleaned up some comments and old references to postgres_fdw left from the diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..ad9df9a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,80 @@ +# pg_clickhouse Security Vulnerability Response Policy + +## Security Change Log and Support + +Details regarding security fixes are publicly reported in the [change log]. + +## Reporting a Vulnerability + +We're extremely grateful for security researchers and users who report +vulnerabilities to the pg_clickhouse Open Source Community. Developers +thoroughly investigate all reports. + +To report a potential vulnerability in pg_clickhouse please send the details +about it through our public bug bounty program hosted by [Bugcrowd] and be +rewarded for it as per the program scope and rules of engagement. + +### When Should I Report a Vulnerability? + +* You think you discovered a potential security vulnerability in pg_clickhouse +* You are unsure how a vulnerability affects pg_clickhouse + +### When Should I **Not** Report a Vulnerability? + +* You need help tuning pg_clickhouse components for security +* You need help applying security related updates +* Your issue is not related to security + +## Security Vulnerability Response + +pg_clickhouse maintainers acknowledged and analyze each report within 5 +working days. As a security issue moves from triage to identified fix to +release planning, we will keep the reporter updated. + +## Public Disclosure Timing + +The pg_clickhouse maintainers and the bug submitter will negotiate a public +disclosure date. We prefer to fully disclose the bug as soon as possible once +a user mitigation is available. It is reasonable to delay disclosure when the +bug or the fix is not yet fully understood, the solution is not well-tested, +or for vendor coordination. The disclosure timeframe ranges from immediate +(especially if it's already publicly known) to 90 days. For a vulnerability +with a straightforward mitigation, we expect the report date to disclosure +date to be on the order of 7 days. + +## Embargo Policy + +Open source users and support customers may subscribe to receive alerts during +the embargo period by visiting the [Trust Center], requesting access, and +subscribing for alerts. Subscribers agree not to make these notifications +public, issue communications, share this information with others, or issue +public patches before the disclosure date. Accidental disclosures must be +reported immediately to trust@clickhouse.com. Failure to follow this policy or +repeated leaks may result in removal from the subscriber list. + +### Participation criteria: + +1. Be a current open source user or support customer with a valid corporate + email domain (no @gmail.com, @azure.com, etc.). +2. Sign up to the pg_clickhouse [Trust Center] +3. Accept the pg_clickhouse Security Vulnerability Response Policy as + outlined here. +4. Subscribe to pg_clickhouse OSS Trust Center alerts. + +### Removal criteria: + +1. Members may be removed for failure to follow this policy or for repeated + leaks. +2. Members may be removed for bounced messages (mail delivery failure). +3. Members may unsubscribe at any time. + +### Notification process: + +pg_clickhouse will post notifications within the [Trust Center] and notify +subscribers. Subscribers must log in to the Trust Center to download the +notification. The notification will include the timeframe for public +disclosure. + + [change log]: CHANGELOG.md + [Bugcrowd]: https://bugcrowd.com/clickhouse + [Trust Center]: https://trust.clickhouse.com/?product=pg_clickhouse