From 84a49cc221457405ad632eb190e1b4cc1f4dd297 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Mon, 26 Jul 2021 11:50:35 +0300 Subject: [PATCH] Improve error message for indexAMs not supported by columnar --- src/backend/columnar/columnar_tableam.c | 5 +++-- src/test/regress/expected/columnar_alter.out | 2 +- src/test/regress/expected/columnar_indexes.out | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/backend/columnar/columnar_tableam.c b/src/backend/columnar/columnar_tableam.c index 480e38e8e..acf092cb9 100644 --- a/src/backend/columnar/columnar_tableam.c +++ b/src/backend/columnar/columnar_tableam.c @@ -1866,8 +1866,9 @@ ColumnarProcessUtility(PlannedStmt *pstmt, if (!ColumnarSupportsIndexAM(indexStmt->accessMethod)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("only btree and hash indexes are supported on " - "columnar tables "))); + errmsg("unsupported access method for the " + "index on columnar table %s", + RelationGetRelationName(rel)))); } } diff --git a/src/test/regress/expected/columnar_alter.out b/src/test/regress/expected/columnar_alter.out index 4706fa386..707107568 100644 --- a/src/test/regress/expected/columnar_alter.out +++ b/src/test/regress/expected/columnar_alter.out @@ -412,7 +412,7 @@ CREATE TABLE circles ( c circle, EXCLUDE USING gist (c WITH &&) ) USING columnar; -ERROR: only btree and hash indexes are supported on columnar tables +ERROR: unsupported access method for the index on columnar table circles -- Row level security CREATE TABLE public.row_level_security_col (id int, pgUser CHARACTER VARYING) USING columnar; CREATE USER user1; diff --git a/src/test/regress/expected/columnar_indexes.out b/src/test/regress/expected/columnar_indexes.out index ef4a5d0de..7b28bce21 100644 --- a/src/test/regress/expected/columnar_indexes.out +++ b/src/test/regress/expected/columnar_indexes.out @@ -396,19 +396,19 @@ SELECT COUNT(*)=2 FROM pg_indexes WHERE tablename = 'p1'; CREATE TABLE testjsonb (j JSONB) USING columnar; INSERT INTO testjsonb SELECT CAST('{"f1" : ' ||'"'|| i*4 ||'", ' || '"f2" : '||'"'|| i*10 ||'"}' AS JSON) FROM generate_series(1,10) i; CREATE INDEX jidx ON testjsonb USING GIN (j); -ERROR: only btree and hash indexes are supported on columnar tables +ERROR: unsupported access method for the index on columnar table testjsonb INSERT INTO testjsonb SELECT CAST('{"f1" : ' ||'"'|| i*4 ||'", ' || '"f2" : '||'"'|| i*10 ||'"}' AS JSON) FROM generate_series(15,20) i; -- gist -- CREATE TABLE gist_point_tbl(id INT4, p POINT) USING columnar; INSERT INTO gist_point_tbl (id, p) SELECT g, point(g*10, g*10) FROM generate_series(1, 10) g; CREATE INDEX gist_pointidx ON gist_point_tbl USING gist(p); -ERROR: only btree and hash indexes are supported on columnar tables +ERROR: unsupported access method for the index on columnar table gist_point_tbl INSERT INTO gist_point_tbl (id, p) SELECT g, point(g*10, g*10) FROM generate_series(10, 20) g; -- sp gist -- CREATE TABLE box_temp (f1 box) USING columnar; INSERT INTO box_temp SELECT box(point(i, i), point(i * 2, i * 2)) FROM generate_series(1, 10) AS i; CREATE INDEX CONCURRENTLY box_spgist ON box_temp USING spgist (f1); -ERROR: only btree and hash indexes are supported on columnar tables +ERROR: unsupported access method for the index on columnar table box_temp -- CONCURRENTLY should not leave an invalid index behind SELECT COUNT(*)=0 FROM pg_index WHERE indrelid = 'box_temp'::regclass AND indisvalid = 'false'; ?column? @@ -420,7 +420,7 @@ INSERT INTO box_temp SELECT box(point(i, i), point(i * 2, i * 2)) FROM generate_ -- brin -- CREATE TABLE brin_summarize (value int) USING columnar; CREATE INDEX brin_summarize_idx ON brin_summarize USING brin (value) WITH (pages_per_range=2); -ERROR: only btree and hash indexes are supported on columnar tables +ERROR: unsupported access method for the index on columnar table brin_summarize -- Show that we safely fallback to serial index build. CREATE TABLE parallel_scan_test(a int) USING columnar WITH ( parallel_workers = 2 ); INSERT INTO parallel_scan_test SELECT i FROM generate_series(1,10) i;