aboutsummaryrefslogtreecommitdiff
path: root/src/test/modules
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-04-11 15:46:35 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2024-04-11 15:46:35 +0300
commitbc1e2092ebb857802a9713d0d3588079e2f0216a (patch)
treef55adc80b07150bcd7f5cbd50a9bfc89b3f301d6 /src/test/modules
parent87840b9741864dfdb9f63b0056e2783cdb49b8a5 (diff)
downloadpostgresql-bc1e2092ebb857802a9713d0d3588079e2f0216a.tar.gz
postgresql-bc1e2092ebb857802a9713d0d3588079e2f0216a.zip
Revert: Custom reloptions for table AM
This commit reverts 9bd99f4c26 and 422041542f per review by Andres Freund. Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de
Diffstat (limited to 'src/test/modules')
-rw-r--r--src/test/modules/Makefile1
-rw-r--r--src/test/modules/meson.build1
-rw-r--r--src/test/modules/test_tam_options/.gitignore4
-rw-r--r--src/test/modules/test_tam_options/Makefile23
-rw-r--r--src/test/modules/test_tam_options/expected/test_tam_options.out36
-rw-r--r--src/test/modules/test_tam_options/meson.build33
-rw-r--r--src/test/modules/test_tam_options/sql/test_tam_options.sql25
-rw-r--r--src/test/modules/test_tam_options/test_tam_options--1.0.sql12
-rw-r--r--src/test/modules/test_tam_options/test_tam_options.c66
-rw-r--r--src/test/modules/test_tam_options/test_tam_options.control4
10 files changed, 0 insertions, 205 deletions
diff --git a/src/test/modules/Makefile b/src/test/modules/Makefile
index 8f661525399..256799f520a 100644
--- a/src/test/modules/Makefile
+++ b/src/test/modules/Makefile
@@ -36,7 +36,6 @@ SUBDIRS = \
test_rls_hooks \
test_shm_mq \
test_slru \
- test_tam_options \
test_tidstore \
unsafe_tests \
worker_spi \
diff --git a/src/test/modules/meson.build b/src/test/modules/meson.build
index 235e342dfaa..d8fe059d236 100644
--- a/src/test/modules/meson.build
+++ b/src/test/modules/meson.build
@@ -35,7 +35,6 @@ subdir('test_resowner')
subdir('test_rls_hooks')
subdir('test_shm_mq')
subdir('test_slru')
-subdir('test_tam_options')
subdir('test_tidstore')
subdir('unsafe_tests')
subdir('worker_spi')
diff --git a/src/test/modules/test_tam_options/.gitignore b/src/test/modules/test_tam_options/.gitignore
deleted file mode 100644
index 5dcb3ff9723..00000000000
--- a/src/test/modules/test_tam_options/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated subdirectories
-/log/
-/results/
-/tmp_check/
diff --git a/src/test/modules/test_tam_options/Makefile b/src/test/modules/test_tam_options/Makefile
deleted file mode 100644
index bd6d4599a14..00000000000
--- a/src/test/modules/test_tam_options/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# src/test/modules/test_tam_options/Makefile
-
-MODULE_big = test_tam_options
-OBJS = \
- $(WIN32RES) \
- test_tam_options.o
-PGFILEDESC = "test_tam_options - test code for table access method reloptions"
-
-EXTENSION = test_tam_options
-DATA = test_tam_options--1.0.sql
-
-REGRESS = test_tam_options
-
-ifdef USE_PGXS
-PG_CONFIG = pg_config
-PGXS := $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
-else
-subdir = src/test/modules/test_tam_options
-top_builddir = ../../../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/contrib/contrib-global.mk
-endif
diff --git a/src/test/modules/test_tam_options/expected/test_tam_options.out b/src/test/modules/test_tam_options/expected/test_tam_options.out
deleted file mode 100644
index c921afcb270..00000000000
--- a/src/test/modules/test_tam_options/expected/test_tam_options.out
+++ /dev/null
@@ -1,36 +0,0 @@
-CREATE EXTENSION test_tam_options;
--- encourage use of parallel plans
-SET parallel_setup_cost = 0;
-SET parallel_tuple_cost = 0;
-SET min_parallel_table_scan_size = 0;
-SET max_parallel_workers_per_gather = 4;
-CREATE TABLE test (i int) USING heap_alter_options;
-INSERT INTO test SELECT i FROM generate_series(1, 10000) i;
-VACUUM ANALYZE test;
-EXPLAIN (costs off)
-SELECT * FROM test;
- QUERY PLAN
----------------------------------
- Gather
- Workers Planned: 4
- -> Parallel Seq Scan on test
-(3 rows)
-
-ALTER TABLE test SET (enable_parallel = OFF);
-EXPLAIN (costs off)
-SELECT * FROM test;
- QUERY PLAN
-------------------
- Seq Scan on test
-(1 row)
-
-ALTER TABLE test SET (enable_parallel = ON);
-EXPLAIN (costs off)
-SELECT * FROM test;
- QUERY PLAN
----------------------------------
- Gather
- Workers Planned: 4
- -> Parallel Seq Scan on test
-(3 rows)
-
diff --git a/src/test/modules/test_tam_options/meson.build b/src/test/modules/test_tam_options/meson.build
deleted file mode 100644
index d41a32a6803..00000000000
--- a/src/test/modules/test_tam_options/meson.build
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (c) 2024, PostgreSQL Global Development Group
-
-test_tam_options_sources = files(
- 'test_tam_options.c',
-)
-
-if host_system == 'windows'
- test_tam_options_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
- '--NAME', 'test_tam_options',
- '--FILEDESC', 'test_tam_options - test code for table access method reloptions',])
-endif
-
-test_tam_options = shared_module('test_tam_options',
- test_tam_options_sources,
- kwargs: pg_test_mod_args,
-)
-test_install_libs += test_tam_options
-
-test_install_data += files(
- 'test_tam_options.control',
- 'test_tam_options--1.0.sql',
-)
-
-tests += {
- 'name': 'test_tam_options',
- 'sd': meson.current_source_dir(),
- 'bd': meson.current_build_dir(),
- 'regress': {
- 'sql': [
- 'test_tam_options',
- ],
- },
-}
diff --git a/src/test/modules/test_tam_options/sql/test_tam_options.sql b/src/test/modules/test_tam_options/sql/test_tam_options.sql
deleted file mode 100644
index 4f975046568..00000000000
--- a/src/test/modules/test_tam_options/sql/test_tam_options.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-CREATE EXTENSION test_tam_options;
-
--- encourage use of parallel plans
-SET parallel_setup_cost = 0;
-SET parallel_tuple_cost = 0;
-SET min_parallel_table_scan_size = 0;
-SET max_parallel_workers_per_gather = 4;
-
-CREATE TABLE test (i int) USING heap_alter_options;
-
-INSERT INTO test SELECT i FROM generate_series(1, 10000) i;
-VACUUM ANALYZE test;
-
-EXPLAIN (costs off)
-SELECT * FROM test;
-
-ALTER TABLE test SET (enable_parallel = OFF);
-
-EXPLAIN (costs off)
-SELECT * FROM test;
-
-ALTER TABLE test SET (enable_parallel = ON);
-
-EXPLAIN (costs off)
-SELECT * FROM test;
diff --git a/src/test/modules/test_tam_options/test_tam_options--1.0.sql b/src/test/modules/test_tam_options/test_tam_options--1.0.sql
deleted file mode 100644
index 07569f7b5f1..00000000000
--- a/src/test/modules/test_tam_options/test_tam_options--1.0.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-/* src/test/modules/test_tam_options/test_tam_options--1.0.sql */
-
--- complain if script is sourced in psql, rather than via CREATE EXTENSION
-\echo Use "CREATE EXTENSION test_tam_options" to load this file. \quit
-
-CREATE FUNCTION heap_alter_options_tam_handler(internal)
-RETURNS table_am_handler
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT;
-
-CREATE ACCESS METHOD heap_alter_options TYPE TABLE
-HANDLER heap_alter_options_tam_handler;
diff --git a/src/test/modules/test_tam_options/test_tam_options.c b/src/test/modules/test_tam_options/test_tam_options.c
deleted file mode 100644
index 13e227e85b5..00000000000
--- a/src/test/modules/test_tam_options/test_tam_options.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*--------------------------------------------------------------------------
- *
- * test_tam_options.c
- * Test code for table access method reloptions.
- *
- * Copyright (c) 2024, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- * src/test/modules/test_tam_options/test_tam_options.c
- *
- * -------------------------------------------------------------------------
- */
-#include "postgres.h"
-
-#include "access/reloptions.h"
-#include "access/tableam.h"
-
-PG_MODULE_MAGIC;
-
-PG_FUNCTION_INFO_V1(heap_alter_options_tam_handler);
-
-/* An alternative relation options for heap */
-typedef struct
-{
- int32 vl_len_; /* varlena header (do not touch directly!) */
- bool enable_parallel; /* enable parallel scans? */
-} HeapAlterRdOptions;
-
-static bytea *
-heap_alter_reloptions(char relkind, Datum reloptions,
- CommonRdOptions *common, bool validate)
-{
- local_relopts relopts;
- HeapAlterRdOptions *result;
-
- Assert(relkind == RELKIND_RELATION ||
- relkind == RELKIND_TOASTVALUE ||
- relkind == RELKIND_MATVIEW);
-
- init_local_reloptions(&relopts, sizeof(HeapAlterRdOptions));
- add_local_bool_reloption(&relopts, "enable_parallel",
- "enable parallel scan", true,
- offsetof(HeapAlterRdOptions, enable_parallel));
-
- result = (HeapAlterRdOptions *) build_local_reloptions(&relopts,
- reloptions,
- validate);
-
- if (result != NULL && common != NULL)
- {
- common->parallel_workers = result->enable_parallel ? -1 : 0;
- }
-
- return (bytea *) result;
-}
-
-Datum
-heap_alter_options_tam_handler(PG_FUNCTION_ARGS)
-{
- static TableAmRoutine tam_routine;
-
- tam_routine = *GetHeapamTableAmRoutine();
- tam_routine.reloptions = heap_alter_reloptions;
-
- PG_RETURN_POINTER(&tam_routine);
-}
diff --git a/src/test/modules/test_tam_options/test_tam_options.control b/src/test/modules/test_tam_options/test_tam_options.control
deleted file mode 100644
index dd6682edcdf..00000000000
--- a/src/test/modules/test_tam_options/test_tam_options.control
+++ /dev/null
@@ -1,4 +0,0 @@
-comment = 'Test code for table access method reloptions'
-default_version = '1.0'
-module_pathname = '$libdir/test_tam_options'
-relocatable = true