From 5f3ebba7ad1ccef0d50835e11c079d586a5b4f0c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 15 Nov 2024 11:59:33 +0100 Subject: [PATCH 1/6] First commit --- .github/workflows/tests.yml | 58 ++++++++++++++++++++ .gitignore | 1 + META.json | 47 +++++++++++++++++ Makefile | 42 +++++++++++++++ pgtle_footer.in | 2 + pgtle_header.in | 6 +++ schedoc.control | 5 ++ sql/table.sql | 102 ++++++++++++++++++++++++++++++++++++ test/integration_tests.sql | 96 +++++++++++++++++++++++++++++++++ 9 files changed, 359 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 .gitignore create mode 100644 META.json create mode 100644 Makefile create mode 100644 pgtle_footer.in create mode 100644 pgtle_header.in create mode 100644 schedoc.control create mode 100644 sql/table.sql create mode 100644 test/integration_tests.sql diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..07930e2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,58 @@ +# .github/workflows/pgtest.yml +name: Postgres tests + +on: push + +jobs: + pgtap: + runs-on: ubuntu-latest + strategy: + matrix: + version: [ '12', '13', '14', '15', '16', '17' ] + + container: pgxn/pgxn-tools + env: + PGUSER: postgres + + steps: + - run: pg-start ${{ matrix.version }} + - uses: actions/checkout@main + + # Basic regression test. + - run: pg-build-test + + - name: build application + run: make all + + - name: install extension + run: make install + + - name: create extension + run: >- + psql --host localhost --username postgres --dbname postgres \ + -c 'CREATE EXTENSION schedoc' + env: + PGPASSWORD: postgres + + - name: Checkout pgtap + uses: actions/checkout@v4 + with: + repository: theory/pgtap + path: pgtap + ref: v1.3.3 + + - name: install pgtap + working-directory: pgtap + run: make && psql --host localhost --username postgres --dbname postgres --file sql/pgtap.sql + env: + PGPASSWORD: postgres + + - name: run unit tests + run: pg_prove --host localhost --dbname postgres --username postgres test/sql/*.sql + env: + PGPASSWORD: postgres + + - name: run integration tests + run: pg_prove --host localhost --dbname postgres --username postgres test/*.sql + env: + PGPASSWORD: postgres diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/META.json b/META.json new file mode 100644 index 0000000..75974f8 --- /dev/null +++ b/META.json @@ -0,0 +1,47 @@ +{ + "name": "schedoc", + "abstract": "Schema documentation for PostgreSQL based on ddl_historization extension", + "description": "Schema documentation system based on COMMENT with json data and ddl_historization.", + "version": "0.0.1", + "maintainer": [ + "Rodolphe QuiƩdeville " + ], + "license": { + "PostgreSQL": "https://www.postgresql.org/about/licence" + }, + "prereqs": { + "runtime": { + "requires": { + "plpgsql": 0, + "PostgreSQL": "12.0.0", + "ddl_historization": "0.0.5" + } + } + }, + "provides": { + "schedoc": { + "abstract": "Schema documentation for PostgreSQL", + "file": "dist/schedoc", + "version": "0.0.1" + } + }, + "resources": { + "bugtracker": { + "web": "https://github.com/ZeroGachis/pg_schedoc/issues" + }, + "repository": { + "url": "https://github.com/ZeroGachis/pg_schedoc.git", + "web": "https://github.com/ZeroGachis/pg_schedoc", + "type": "git" + } + }, + "generated_by": "Rodolphe QuiƩdeville", + "meta-spec": { + "version": "1.0.0", + "url": "https://pgxn.org/meta/spec.txt" + }, + "tags": [ + "documentation", + "schema" + ] +} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b4cb7c4 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +.PHONY : all dist pgtle clean install test + +FILES = $(wildcard sql/*.sql) + +EXTENSION = schedoc + +EXTVERSION = $(shell grep -m 1 '[[:space:]]\{3\}"version":' META.json | \ + sed -e 's/[[:space:]]*"version":[[:space:]]*"\([^"]*\)",\{0,1\}/\1/') + +DATA = dist/schedoc--$(EXTVERSION).sql + +DIST = dist/$(EXTENSION)--$(EXTVERSION).sql + +PGTLEOUT = dist/pgtle.$(EXTENSION)-$(EXTVERSION).sql + +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) + +# edit this value if you want to deploy by hand +SCHEMA = @extschema@ + +include $(PGXS) + +all: $(DIST) $(PGTLEOUT) + +clean: + rm -f $(PGTLEOUT) $(DIST) + +$(DIST): $(FILES) + cat sql/table.sql > $@ + cat $@ > dist/$(EXTENSION).sql + +test: + pg_prove -f test/sql/*.sql + +$(PGTLEOUT): dist/$(EXTENSION)--$(EXTVERSION).sql pgtle_header.in pgtle_footer.in + sed -e 's/_EXTVERSION_/$(EXTVERSION)/' pgtle_header.in > $(PGTLEOUT) + cat dist/$(EXTENSION)--$(EXTVERSION).sql >> $(PGTLEOUT) + cat pgtle_footer.in >> $(PGTLEOUT) + +dist: $(PGTLEOUT) + git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ -o $(EXTENSION)-$(EXTVERSION).zip HEAD diff --git a/pgtle_footer.in b/pgtle_footer.in new file mode 100644 index 0000000..c409b99 --- /dev/null +++ b/pgtle_footer.in @@ -0,0 +1,2 @@ +$_pg_tle_$ +); diff --git a/pgtle_header.in b/pgtle_header.in new file mode 100644 index 0000000..d53acda --- /dev/null +++ b/pgtle_header.in @@ -0,0 +1,6 @@ +SELECT pgtle.install_extension +( + 'schedoc', + '_EXTVERSION_', + 'Schema documentation based on COMMENT', +$_pg_tle_$ diff --git a/schedoc.control b/schedoc.control new file mode 100644 index 0000000..cd839e0 --- /dev/null +++ b/schedoc.control @@ -0,0 +1,5 @@ +comment = 'Schema automatic documentation based on ddl_historization and COMMENT' +default_version = '0.0.1' +relocatable = false +module_pathname = '$libdir/pg_schedoc' +requires = 'ddl_historization' diff --git a/sql/table.sql b/sql/table.sql new file mode 100644 index 0000000..ec4e5dc --- /dev/null +++ b/sql/table.sql @@ -0,0 +1,102 @@ +-- +-- +-- + +CREATE TYPE data_status AS ENUM ('public', 'private', 'legacy', 'wip'); + +CREATE TABLE schedoc_column_raw ( + objoid oid, + objsubid oid, + comment jsonb, + status data_status, + PRIMARY KEY (objoid, objsubid) +); + +CREATE VIEW schedoc_column_comments AS + + SELECT current_database() as databasename, c.relname as tablename, a.attname as columnname, status + FROM schedoc_column_raw ccr + JOIN pg_class c ON c.oid = ccr.objoid + JOIN pg_attribute a ON (a.attnum = ccr.objsubid AND a.attrelid = ccr.objoid); + +-- +-- +-- +CREATE OR REPLACE FUNCTION schedoc_start() +RETURNS void + LANGUAGE plpgsql AS +$EOF$ +DECLARE + schemaname TEXT; +BEGIN + SELECT n.nspname FROM pg_extension e JOIN pg_namespace n ON n.oid=e.extnamespace WHERE e.extname='ddl_historization' INTO schemaname; + + -- + -- Function to manage INSERT statements + -- + + EXECUTE format('CREATE OR REPLACE FUNCTION %s.schedoc_trg() + RETURNS trigger LANGUAGE plpgsql AS $$ + BEGIN + INSERT INTO %s.schedoc_column_raw (objoid, objsubid, comment, status) + VALUES ( + NEW.objoid, + NEW.objsubid, + %s.get_column_description(NEW.objoid, NEW.objsubid)::jsonb, + %s.get_column_status(NEW.objoid, NEW.objsubid)::public.data_status + ) ON CONFLICT (objoid, objsubid) + DO UPDATE SET + comment = public.get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb, + status = public.get_column_status(EXCLUDED.objoid, EXCLUDED.objsubid)::public.data_status; + RETURN NEW; + END; +$$', schemaname, schemaname, schemaname, schemaname); + + -- + -- Create two triggers, one for UPDATE and one for INSERT + -- + + EXECUTE format(' + CREATE TRIGGER schedoc_trg + BEFORE INSERT ON %s.ddl_history + FOR EACH ROW + WHEN (NEW.ddl_tag = ''COMMENT'') + EXECUTE PROCEDURE %s.schedoc_trg()', + schemaname,schemaname); + +END; +$EOF$; + + +CREATE OR REPLACE FUNCTION get_column_description(bjoid oid, bjsubid oid) +RETURNS text + LANGUAGE plpgsql AS +$EOF$ +DECLARE + description TEXT; +BEGIN + SELECT pg_description.description FROM pg_description + WHERE pg_description.objoid=bjoid AND pg_description.objsubid=bjsubid INTO description; + + RETURN description; +END; +$EOF$; + +CREATE OR REPLACE FUNCTION get_column_status(bjoid oid, bjsubid oid) +RETURNS text + LANGUAGE plpgsql AS +$EOF$ +DECLARE + status TEXT; +BEGIN + SELECT pg_description.description::jsonb->>'status' FROM pg_description + WHERE pg_description.objoid=bjoid AND pg_description.objsubid=bjsubid INTO status; + + RETURN status; +END; +$EOF$; + +-- CREATE TRIGGER schedoc_trg +-- BEFORE INSERT ON ddl_history +-- FOR EACH ROW +-- EXECUTE PROCEDURE schedoc_trg(); diff --git a/test/integration_tests.sql b/test/integration_tests.sql new file mode 100644 index 0000000..7b57cee --- /dev/null +++ b/test/integration_tests.sql @@ -0,0 +1,96 @@ +-- +-- We assume that ddl_historization is installed in public schema +-- + +SET search_path=public,pgtap; + +BEGIN; + +SELECT plan(9); + +TRUNCATE ddl_history; + +-- 2 +CREATE TABLE foobar_schedoc (id int); + + + +DROP EXTENSION IF EXISTS schedoc; +CREATE EXTENSION schedoc; + +SELECT has_extension('schedoc'); +SELECT has_table('schedoc_column_raw'); +SELECT has_view('schedoc_column_comments'); + + +SELECT schedoc_start(); + +-- 3 +ALTER TABLE foobar_schedoc ADD COLUMN toto int; +CREATE INDEX ON foobar_schedoc (toto); + +-- +TRUNCATE ddl_history; +COMMENT ON COLUMN foobar_schedoc.id IS '{"status": "private"}'; + +-- +SELECT results_eq( + 'SELECT count(*) FROM ddl_history', + 'SELECT CAST(1 as bigint)', + 'We have 1 row in ddl_history'); + +SELECT results_eq( + 'SELECT count(*) FROM schedoc_column_raw', + 'SELECT CAST(1 as bigint)', + 'We have 1 row in schedoc_column_raw'); + +SELECT results_eq( + 'SELECT comment,status::text FROM schedoc_column_raw LIMIT 1', + 'SELECT ''{"status": "private"}''::jsonb, ''private''::text ', + 'We have right values in schedoc_column_raw'); + + +SELECT results_eq( + 'SELECT status::text FROM schedoc_column_raw', + 'SELECT ''private''::text ', + 'We have right values in schedoc_column_comments'); + + +CREATE OR REPLACE FUNCTION setcomm_unauthorized_value() +RETURNS void + LANGUAGE plpgsql AS +$EOF$ +BEGIN + COMMENT ON COLUMN foobar_schedoc.id IS '{"status": "foobar"}'; +END; +$EOF$; + +PREPARE unauthorized_value AS SELECT * FROM setcomm_unauthorized_value(); +SELECT throws_ok( + 'unauthorized_value', + '22P02', + 'invalid input value for enum data_status: "foobar"', + 'We should get an input value error' +); +-- +-- The comment is not in JSONB format +-- +CREATE OR REPLACE FUNCTION setcomm_wrong_format() +RETURNS void + LANGUAGE plpgsql AS +$EOF$ +BEGIN + COMMENT ON COLUMN foobar_schedoc.id IS 'This is not a JSON'; +END; +$EOF$; + +PREPARE wrong_format AS SELECT * FROM setcomm_wrong_format(); +SELECT throws_ok( + 'wrong_format', + '22P02', + 'invalid input syntax for type json', + 'We should get an input syntax error' +); + + +ROLLBACK; From 7e33eaa10f4299669ba246de2da8f9c034bcea86 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 15 Nov 2024 12:04:02 +0100 Subject: [PATCH 2/6] Add dist files and reduce number of pgversion to 16 and 17 --- .github/workflows/tests.yml | 2 +- dist/pgtle.schedoc-0.0.1.sql | 110 +++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 dist/pgtle.schedoc-0.0.1.sql diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 07930e2..b2ceb43 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: [ '12', '13', '14', '15', '16', '17' ] + version: [ '16', '17' ] container: pgxn/pgxn-tools env: diff --git a/dist/pgtle.schedoc-0.0.1.sql b/dist/pgtle.schedoc-0.0.1.sql new file mode 100644 index 0000000..faefec4 --- /dev/null +++ b/dist/pgtle.schedoc-0.0.1.sql @@ -0,0 +1,110 @@ +SELECT pgtle.install_extension +( + 'schedoc', + '0.0.1', + 'Schema documentation based on COMMENT', +$_pg_tle_$ +-- +-- +-- + +CREATE TYPE data_status AS ENUM ('public', 'private', 'legacy', 'wip'); + +CREATE TABLE schedoc_column_raw ( + objoid oid, + objsubid oid, + comment jsonb, + status data_status, + PRIMARY KEY (objoid, objsubid) +); + +CREATE VIEW schedoc_column_comments AS + + SELECT current_database() as databasename, c.relname as tablename, a.attname as columnname, status + FROM schedoc_column_raw ccr + JOIN pg_class c ON c.oid = ccr.objoid + JOIN pg_attribute a ON (a.attnum = ccr.objsubid AND a.attrelid = ccr.objoid); + +-- +-- +-- +CREATE OR REPLACE FUNCTION schedoc_start() +RETURNS void + LANGUAGE plpgsql AS +$EOF$ +DECLARE + schemaname TEXT; +BEGIN + SELECT n.nspname FROM pg_extension e JOIN pg_namespace n ON n.oid=e.extnamespace WHERE e.extname='ddl_historization' INTO schemaname; + + -- + -- Function to manage INSERT statements + -- + + EXECUTE format('CREATE OR REPLACE FUNCTION %s.schedoc_trg() + RETURNS trigger LANGUAGE plpgsql AS $$ + BEGIN + INSERT INTO %s.schedoc_column_raw (objoid, objsubid, comment, status) + VALUES ( + NEW.objoid, + NEW.objsubid, + %s.get_column_description(NEW.objoid, NEW.objsubid)::jsonb, + %s.get_column_status(NEW.objoid, NEW.objsubid)::public.data_status + ) ON CONFLICT (objoid, objsubid) + DO UPDATE SET + comment = public.get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb, + status = public.get_column_status(EXCLUDED.objoid, EXCLUDED.objsubid)::public.data_status; + RETURN NEW; + END; +$$', schemaname, schemaname, schemaname, schemaname); + + -- + -- Create two triggers, one for UPDATE and one for INSERT + -- + + EXECUTE format(' + CREATE TRIGGER schedoc_trg + BEFORE INSERT ON %s.ddl_history + FOR EACH ROW + WHEN (NEW.ddl_tag = ''COMMENT'') + EXECUTE PROCEDURE %s.schedoc_trg()', + schemaname,schemaname); + +END; +$EOF$; + + +CREATE OR REPLACE FUNCTION get_column_description(bjoid oid, bjsubid oid) +RETURNS text + LANGUAGE plpgsql AS +$EOF$ +DECLARE + description TEXT; +BEGIN + SELECT pg_description.description FROM pg_description + WHERE pg_description.objoid=bjoid AND pg_description.objsubid=bjsubid INTO description; + + RETURN description; +END; +$EOF$; + +CREATE OR REPLACE FUNCTION get_column_status(bjoid oid, bjsubid oid) +RETURNS text + LANGUAGE plpgsql AS +$EOF$ +DECLARE + status TEXT; +BEGIN + SELECT pg_description.description::jsonb->>'status' FROM pg_description + WHERE pg_description.objoid=bjoid AND pg_description.objsubid=bjsubid INTO status; + + RETURN status; +END; +$EOF$; + +-- CREATE TRIGGER schedoc_trg +-- BEFORE INSERT ON ddl_history +-- FOR EACH ROW +-- EXECUTE PROCEDURE schedoc_trg(); +$_pg_tle_$ +); From 397e6006269483c9dd5991b778e8ad1fbebfd7b1 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 15 Nov 2024 12:07:13 +0100 Subject: [PATCH 3/6] Add dependency in test workflow --- .github/workflows/tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b2ceb43..da01c69 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,6 +21,10 @@ jobs: # Basic regression test. - run: pg-build-test + # Basic regression test. + - name: install dependency + run: pgxn install ddl_historization + - name: build application run: make all @@ -30,7 +34,7 @@ jobs: - name: create extension run: >- psql --host localhost --username postgres --dbname postgres \ - -c 'CREATE EXTENSION schedoc' + -c 'CREATE EXTENSION schedoc CASCADE' env: PGPASSWORD: postgres From 891643c34351a8f19b9eec65cb8764a53fa54e4d Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 15 Nov 2024 13:32:17 +0100 Subject: [PATCH 4/6] Add unit test --- test/sql/table_test.sql | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/sql/table_test.sql diff --git a/test/sql/table_test.sql b/test/sql/table_test.sql new file mode 100644 index 0000000..a1a5738 --- /dev/null +++ b/test/sql/table_test.sql @@ -0,0 +1,23 @@ +-- +-- We assume that ddl_historization is installed in public schema +-- + +SET search_path=public,pgtap; + +BEGIN; + +SELECT plan(6); + +CREATE EXTENSION schedoc CASCADE; + +SELECT has_extension('schedoc'); +SELECT has_table('schedoc_column_raw'); +SELECT has_view('schedoc_column_comments'); + +SELECT has_enum('data_status'); + +SELECT enum_has_labels('data_status', ARRAY['public', 'private', 'legacy', 'wip']); + +SELECT has_function('schedoc_start'); + +ROLLBACK; From 03feb350a702ecd10a15b77805ea25dede600b87 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 15 Nov 2024 13:39:04 +0100 Subject: [PATCH 5/6] Rename functions --- dist/pgtle.schedoc-0.0.1.sql | 14 +++++++------- sql/table.sql | 14 +++++++------- test/sql/table_test.sql | 6 +++++- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/dist/pgtle.schedoc-0.0.1.sql b/dist/pgtle.schedoc-0.0.1.sql index faefec4..1d4c1d9 100644 --- a/dist/pgtle.schedoc-0.0.1.sql +++ b/dist/pgtle.schedoc-0.0.1.sql @@ -48,15 +48,15 @@ BEGIN VALUES ( NEW.objoid, NEW.objsubid, - %s.get_column_description(NEW.objoid, NEW.objsubid)::jsonb, - %s.get_column_status(NEW.objoid, NEW.objsubid)::public.data_status + %s.schedoc_get_column_description(NEW.objoid, NEW.objsubid)::jsonb, + %s.schedoc_get_column_status(NEW.objoid, NEW.objsubid)::public.data_status ) ON CONFLICT (objoid, objsubid) DO UPDATE SET - comment = public.get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb, - status = public.get_column_status(EXCLUDED.objoid, EXCLUDED.objsubid)::public.data_status; + comment = %s.schedoc_get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb, + status = %s.schedoc_get_column_status(EXCLUDED.objoid, EXCLUDED.objsubid)::public.data_status; RETURN NEW; END; -$$', schemaname, schemaname, schemaname, schemaname); +$$', schemaname, schemaname, schemaname, schemaname, schemaname, schemaname); -- -- Create two triggers, one for UPDATE and one for INSERT @@ -74,7 +74,7 @@ END; $EOF$; -CREATE OR REPLACE FUNCTION get_column_description(bjoid oid, bjsubid oid) +CREATE OR REPLACE FUNCTION schedoc_get_column_description(bjoid oid, bjsubid oid) RETURNS text LANGUAGE plpgsql AS $EOF$ @@ -88,7 +88,7 @@ BEGIN END; $EOF$; -CREATE OR REPLACE FUNCTION get_column_status(bjoid oid, bjsubid oid) +CREATE OR REPLACE FUNCTION schedoc_get_column_status(bjoid oid, bjsubid oid) RETURNS text LANGUAGE plpgsql AS $EOF$ diff --git a/sql/table.sql b/sql/table.sql index ec4e5dc..08488fc 100644 --- a/sql/table.sql +++ b/sql/table.sql @@ -42,15 +42,15 @@ BEGIN VALUES ( NEW.objoid, NEW.objsubid, - %s.get_column_description(NEW.objoid, NEW.objsubid)::jsonb, - %s.get_column_status(NEW.objoid, NEW.objsubid)::public.data_status + %s.schedoc_get_column_description(NEW.objoid, NEW.objsubid)::jsonb, + %s.schedoc_get_column_status(NEW.objoid, NEW.objsubid)::public.data_status ) ON CONFLICT (objoid, objsubid) DO UPDATE SET - comment = public.get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb, - status = public.get_column_status(EXCLUDED.objoid, EXCLUDED.objsubid)::public.data_status; + comment = %s.schedoc_get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb, + status = %s.schedoc_get_column_status(EXCLUDED.objoid, EXCLUDED.objsubid)::public.data_status; RETURN NEW; END; -$$', schemaname, schemaname, schemaname, schemaname); +$$', schemaname, schemaname, schemaname, schemaname, schemaname, schemaname); -- -- Create two triggers, one for UPDATE and one for INSERT @@ -68,7 +68,7 @@ END; $EOF$; -CREATE OR REPLACE FUNCTION get_column_description(bjoid oid, bjsubid oid) +CREATE OR REPLACE FUNCTION schedoc_get_column_description(bjoid oid, bjsubid oid) RETURNS text LANGUAGE plpgsql AS $EOF$ @@ -82,7 +82,7 @@ BEGIN END; $EOF$; -CREATE OR REPLACE FUNCTION get_column_status(bjoid oid, bjsubid oid) +CREATE OR REPLACE FUNCTION schedoc_get_column_status(bjoid oid, bjsubid oid) RETURNS text LANGUAGE plpgsql AS $EOF$ diff --git a/test/sql/table_test.sql b/test/sql/table_test.sql index a1a5738..715cd0a 100644 --- a/test/sql/table_test.sql +++ b/test/sql/table_test.sql @@ -6,7 +6,7 @@ SET search_path=public,pgtap; BEGIN; -SELECT plan(6); +SELECT plan(8); CREATE EXTENSION schedoc CASCADE; @@ -20,4 +20,8 @@ SELECT enum_has_labels('data_status', ARRAY['public', 'private', 'legacy', 'wip' SELECT has_function('schedoc_start'); +SELECT has_function('schedoc_get_column_description', ARRAY['oid', 'oid']); +SELECT has_function('schedoc_get_column_status', ARRAY['oid', 'oid']); + + ROLLBACK; From 01ecaf5d8e1e974dc30d2307c0fa7f8df0820c6c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 15 Nov 2024 13:40:13 +0100 Subject: [PATCH 6/6] Fix test --- test/sql/table_test.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/sql/table_test.sql b/test/sql/table_test.sql index 715cd0a..e758c46 100644 --- a/test/sql/table_test.sql +++ b/test/sql/table_test.sql @@ -8,8 +8,6 @@ BEGIN; SELECT plan(8); -CREATE EXTENSION schedoc CASCADE; - SELECT has_extension('schedoc'); SELECT has_table('schedoc_column_raw'); SELECT has_view('schedoc_column_comments');