From 186e929b67ca72e987f0ad64de54421f62303ac6 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 24 Nov 2021 15:20:16 +0100 Subject: [PATCH] wip --- Dockerfile | 13 +++++++++++++ tests/schema.spec.sql | 2 ++ tests/schema.sql | 14 ++++++++++++++ tools/pgtap | 7 ++++++- 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8276ff8..df7ea86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,13 @@ RUN apk add \ ; apk add \ --no-cache \ --virtual build-deps \ + clang \ + gcc \ git \ + icu-dev \ + llvm \ make \ + musl-dev \ patch \ perl \ perl-module-build \ @@ -48,6 +53,14 @@ RUN apk add \ ; su-exec postgres sh -c 'echo "" | with_tmp_db make installcheck' \ ; su-exec postgres sh -c 'echo "CREATE EXTENSION pgtap;" | with_tmp_db make test' \ ) \ +### plpgsql_check + ; git clone --depth 1 --branch master https://github.com/okbob/plpgsql_check \ + ; (cd plpgsql_check \ + ; CFLAGS=-Wno-unused-parameter make \ + ; make install \ + ; chown -R postgres . \ + ; su-exec postgres sh -c 'echo "" | with_tmp_db make installcheck' \ + ) \ ### cleanup ; rm -rf -- * \ ; apk del --no-cache build-deps diff --git a/tests/schema.spec.sql b/tests/schema.spec.sql index 58426bc..5df95f2 100644 --- a/tests/schema.spec.sql +++ b/tests/schema.spec.sql @@ -3,5 +3,7 @@ SELECT plan(1); SELECT has_table('t'); +select f1(); + SELECT * FROM finish(); ROLLBACK; diff --git a/tests/schema.sql b/tests/schema.sql index 7c1c39d..c7ff164 100644 --- a/tests/schema.sql +++ b/tests/schema.sql @@ -1 +1,15 @@ CREATE TABLE t (); + +-- taken from plpgsql_check +CREATE OR REPLACE FUNCTION public.f1() +RETURNS void +LANGUAGE plpgsql +AS $function$ +DECLARE r record; +BEGIN + FOR r IN SELECT * FROM t + LOOP + RAISE NOTICE '%', r.c; -- there is bug - table t missing "c" column + END LOOP; +END; +$function$; diff --git a/tools/pgtap b/tools/pgtap index de0e100..f87a6a0 100755 --- a/tools/pgtap +++ b/tools/pgtap @@ -21,5 +21,10 @@ cat - "$schema" <