Add simple tests and meson build. Maxim Orlov <m.orlov@postgrespro.ru>
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 24 Apr 2023 15:16:31 +0000 (18:16 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 24 Apr 2023 15:16:31 +0000 (18:16 +0300)
Makefile
expected/online_analyze.out [new file with mode: 0644]
meson.build [new file with mode: 0644]
sql/online_analyze.sql [new file with mode: 0644]

index 333add2..e92c9e8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ MODULE_big = online_analyze
 OBJS = online_analyze.o     
 #DATA_built = online_analyze.sql
 DOCS = README.online_analyze
-#REGRESS = online_analyze
+REGRESS = online_analyze
 
 ifdef USE_PGXS
 PGXS := $(shell pg_config --pgxs)
diff --git a/expected/online_analyze.out b/expected/online_analyze.out
new file mode 100644 (file)
index 0000000..ddc7bcb
--- /dev/null
@@ -0,0 +1,47 @@
+LOAD 'online_analyze';
+SET online_analyze.enable = on;
+SET "online_analyze.verbose" = on;
+SET online_analyze.table_type = "all";
+SHOW online_analyze.enable;
+ online_analyze.enable 
+-----------------------
+ on
+(1 row)
+
+SHOW "online_analyze.verbose";
+ online_analyze.verbose 
+------------------------
+ on
+(1 row)
+
+SHOW online_analyze.table_type;
+ online_analyze.table_type 
+---------------------------
+ all
+(1 row)
+
+CREATE TABLE oa_tbl(
+       foo int,
+       bar text
+);
+SHOW online_analyze.exclude_tables;
+ online_analyze.exclude_tables 
+-------------------------------
+(1 row)
+
+SET online_analyze.exclude_tables = "oa_tbl";
+SHOW online_analyze.exclude_tables;
+ online_analyze.exclude_tables 
+-------------------------------
+ public.oa_tbl
+(1 row)
+
+DROP TABLE oa_tbl;
+SHOW online_analyze.exclude_tables;
+ online_analyze.exclude_tables 
+-------------------------------
+(1 row)
+
+SET online_analyze.enable = off;
diff --git a/meson.build b/meson.build
new file mode 100644 (file)
index 0000000..798cd1c
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (c) 2023, Postgres Professional
+
+online_analyze_sources = files(
+  'online_analyze.c'
+)
+
+if host_system == 'windows'
+  online_analyze_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+    '--NAME', 'online_analyze',
+    '--FILEDESC', 'online_analyze - provides a set of features that immediately update statistics after INSERT, UPDATE, DELETE, or SELECT INTO operations for the affected tables.',])
+endif
+
+online_analyze = shared_module('online_analyze',
+  online_analyze_sources,
+  kwargs: contrib_mod_args,
+)
+contrib_targets += online_analyze
+
+tests += {
+  'name': 'online_analyze',
+  'sd': meson.current_source_dir(),
+  'bd': meson.current_build_dir(),
+  'regress': {
+    'sql': [
+      'online_analyze',
+    ],
+  },
+}
diff --git a/sql/online_analyze.sql b/sql/online_analyze.sql
new file mode 100644 (file)
index 0000000..760eaca
--- /dev/null
@@ -0,0 +1,21 @@
+LOAD 'online_analyze';
+
+SET online_analyze.enable = on;
+SET "online_analyze.verbose" = on;
+SET online_analyze.table_type = "all";
+
+SHOW online_analyze.enable;
+SHOW "online_analyze.verbose";
+SHOW online_analyze.table_type;
+
+CREATE TABLE oa_tbl(
+       foo int,
+       bar text
+);
+SHOW online_analyze.exclude_tables;
+SET online_analyze.exclude_tables = "oa_tbl";
+SHOW online_analyze.exclude_tables;
+DROP TABLE oa_tbl;
+SHOW online_analyze.exclude_tables;
+
+SET online_analyze.enable = off;