summaryrefslogtreecommitdiffstats
path: root/t/foo/foo-123
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:35:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:35:12 +0000
commit53b8d04ebc10d070b7efafd6dfa9de2897916888 (patch)
treee95cc322bcaf0990808f10f0fdcb508014e7e496 /t/foo/foo-123
parentInitial commit. (diff)
downloadpostgresql-common-53b8d04ebc10d070b7efafd6dfa9de2897916888.tar.xz
postgresql-common-53b8d04ebc10d070b7efafd6dfa9de2897916888.zip
Adding upstream version 258.upstream/258
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/foo/foo-123')
-rw-r--r--t/foo/foo-123/Makefile10
-rw-r--r--t/foo/foo-123/README.md5
-rw-r--r--t/foo/foo-123/expected/foo.out8
-rw-r--r--t/foo/foo-123/expected/upgrade.out14
-rw-r--r--t/foo/foo-123/foo--100--123.sql3
-rw-r--r--t/foo/foo-123/foo--100.sql3
-rw-r--r--t/foo/foo-123/foo--123.sql3
-rw-r--r--t/foo/foo-123/foo.c13
-rw-r--r--t/foo/foo-123/foo.control2
-rw-r--r--t/foo/foo-123/sql/foo.sql5
-rw-r--r--t/foo/foo-123/sql/upgrade.sql7
11 files changed, 73 insertions, 0 deletions
diff --git a/t/foo/foo-123/Makefile b/t/foo/foo-123/Makefile
new file mode 100644
index 0000000..9f9a2f8
--- /dev/null
+++ b/t/foo/foo-123/Makefile
@@ -0,0 +1,10 @@
+MODULE_big = foo
+OBJS = foo.o
+EXTENSION = foo
+DATA = foo--100.sql foo--100--123.sql foo--123.sql
+REGRESS = foo upgrade
+
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+
diff --git a/t/foo/foo-123/README.md b/t/foo/foo-123/README.md
new file mode 100644
index 0000000..14235f9
--- /dev/null
+++ b/t/foo/foo-123/README.md
@@ -0,0 +1,5 @@
+The PostgreSQL foo extension
+============================
+
+This extension exists for testing postgresql-common's `dh_make_pgxs` and
+`dh --with pgxs` mechanisms.
diff --git a/t/foo/foo-123/expected/foo.out b/t/foo/foo-123/expected/foo.out
new file mode 100644
index 0000000..62afef7
--- /dev/null
+++ b/t/foo/foo-123/expected/foo.out
@@ -0,0 +1,8 @@
+CREATE EXTENSION foo;
+SELECT foo();
+ foo
+-----
+ bar
+(1 row)
+
+DROP EXTENSION foo;
diff --git a/t/foo/foo-123/expected/upgrade.out b/t/foo/foo-123/expected/upgrade.out
new file mode 100644
index 0000000..98fc8e6
--- /dev/null
+++ b/t/foo/foo-123/expected/upgrade.out
@@ -0,0 +1,14 @@
+CREATE EXTENSION foo VERSION "100";
+SELECT foo();
+ foo
+---------
+ old bar
+(1 row)
+
+ALTER EXTENSION foo UPDATE TO "123";
+SELECT foo();
+ foo
+-----
+ bar
+(1 row)
+
diff --git a/t/foo/foo-123/foo--100--123.sql b/t/foo/foo-123/foo--100--123.sql
new file mode 100644
index 0000000..a6e7adc
--- /dev/null
+++ b/t/foo/foo-123/foo--100--123.sql
@@ -0,0 +1,3 @@
+CREATE OR REPLACE FUNCTION foo ()
+RETURNS text LANGUAGE C
+AS '$libdir/foo';
diff --git a/t/foo/foo-123/foo--100.sql b/t/foo/foo-123/foo--100.sql
new file mode 100644
index 0000000..5ed8546
--- /dev/null
+++ b/t/foo/foo-123/foo--100.sql
@@ -0,0 +1,3 @@
+CREATE OR REPLACE FUNCTION foo ()
+RETURNS text LANGUAGE SQL
+AS $$ SELECT 'old bar'::text $$;
diff --git a/t/foo/foo-123/foo--123.sql b/t/foo/foo-123/foo--123.sql
new file mode 100644
index 0000000..a6e7adc
--- /dev/null
+++ b/t/foo/foo-123/foo--123.sql
@@ -0,0 +1,3 @@
+CREATE OR REPLACE FUNCTION foo ()
+RETURNS text LANGUAGE C
+AS '$libdir/foo';
diff --git a/t/foo/foo-123/foo.c b/t/foo/foo-123/foo.c
new file mode 100644
index 0000000..8677acc
--- /dev/null
+++ b/t/foo/foo-123/foo.c
@@ -0,0 +1,13 @@
+#include "postgres.h"
+#include "fmgr.h"
+#include "utils/builtins.h"
+
+PG_MODULE_MAGIC;
+
+PG_FUNCTION_INFO_V1 (foo);
+
+Datum
+foo (PG_FUNCTION_ARGS)
+{
+ PG_RETURN_TEXT_P(cstring_to_text("bar"));
+}
diff --git a/t/foo/foo-123/foo.control b/t/foo/foo-123/foo.control
new file mode 100644
index 0000000..81c95c8
--- /dev/null
+++ b/t/foo/foo-123/foo.control
@@ -0,0 +1,2 @@
+default_version = '123'
+comment = 'The foo extension'
diff --git a/t/foo/foo-123/sql/foo.sql b/t/foo/foo-123/sql/foo.sql
new file mode 100644
index 0000000..155f63e
--- /dev/null
+++ b/t/foo/foo-123/sql/foo.sql
@@ -0,0 +1,5 @@
+CREATE EXTENSION foo;
+
+SELECT foo();
+
+DROP EXTENSION foo;
diff --git a/t/foo/foo-123/sql/upgrade.sql b/t/foo/foo-123/sql/upgrade.sql
new file mode 100644
index 0000000..b4427b4
--- /dev/null
+++ b/t/foo/foo-123/sql/upgrade.sql
@@ -0,0 +1,7 @@
+CREATE EXTENSION foo VERSION "100";
+
+SELECT foo();
+
+ALTER EXTENSION foo UPDATE TO "123";
+
+SELECT foo();