Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rodo committed Dec 11, 2024
1 parent f4f80e2 commit 120fa6d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*~
schedoc.control
*.zip
2 changes: 1 addition & 1 deletion dist/schedoc.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ BEGIN
NEW.objoid,
NEW.objsubid,
%s.schedoc_get_column_description(NEW.objoid, NEW.objsubid)::jsonb,
%s.schedoc_get_column_status(NEW.objoid, NEW.objsubid)::public.schedoc_status,
%s.schedoc_get_column_status(NEW.objoid, NEW.objsubid)::public.schedoc_status
) ON CONFLICT (objoid, objsubid)
DO UPDATE SET
comment = %s.schedoc_get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb,
Expand Down
2 changes: 1 addition & 1 deletion sql/function.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BEGIN
NEW.objoid,
NEW.objsubid,
%s.schedoc_get_column_description(NEW.objoid, NEW.objsubid)::jsonb,
%s.schedoc_get_column_status(NEW.objoid, NEW.objsubid)::public.schedoc_status,
%s.schedoc_get_column_status(NEW.objoid, NEW.objsubid)::public.schedoc_status
) ON CONFLICT (objoid, objsubid)
DO UPDATE SET
comment = %s.schedoc_get_column_description(EXCLUDED.objoid, EXCLUDED.objsubid)::jsonb,
Expand Down
13 changes: 6 additions & 7 deletions test/create_column.sql
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
--
-- This test must fail
--

--
SET search_path=public,pgtap;

BEGIN;

SELECT plan(9);
SELECT plan(4);

TRUNCATE ddl_history;

-- 2
CREATE TABLE foobar_schedoc (id int);
CREATE TABLE schedoc_unit_t (id int);

DROP EXTENSION IF EXISTS schedoc CASCADE;
CREATE EXTENSION schedoc CASCADE;


-- create some objects non concerned by the extension
ALTER TABLE foobar_schedoc ADD COLUMN toto int;
CREATE INDEX ON foobar_schedoc (toto);
ALTER TABLE schedoc_unit_t ADD COLUMN toto int;
CREATE INDEX ON schedoc_unit_t (toto);

--
TRUNCATE ddl_history;
COMMENT ON COLUMN foobar_schedoc.id IS '{"status": "private"}';
COMMENT ON COLUMN schedoc_unit_t.id IS '{"status": "private"}';

--
SELECT results_eq(
Expand Down
15 changes: 5 additions & 10 deletions test/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ BEGIN;
SELECT plan(2);

TRUNCATE ddl_history;
TRUNCATE ddl_history_columns;
TRUNCATE ddl_history_column;

-- 2
CREATE TABLE foobar_schedoc (id int, label text);
CREATE TABLE schedoc_unitt (id int, label text);

--
SELECT results_eq(
Expand All @@ -22,15 +22,10 @@ SELECT results_eq(


SELECT results_eq(
'SELECT count(*) FROM ddl_history_columns',
'SELECT count(*) FROM ddl_history_column',
'SELECT CAST(2 as bigint)',
'We have 2 rows in ddl_history_columns');





DROP TABLE foobar_schedoc;
'We have 2 rows in ddl_history_column');

DROP TABLE schedoc_unitt;

ROLLBACK;

0 comments on commit 120fa6d

Please sign in to comment.