Skip to content

Commit 7541bb0

Browse files
committed
Restore upgrade testing to CI and fix upgrades
Fix upgrades from 1.1.0 to 1.2.0, from 1.3.0 to 1.3.1, and from 1.3.1 to 1.3.2. Restore upgrade testing to the test workflow.
1 parent 70756f2 commit 7541bb0

File tree

5 files changed

+56
-18
lines changed

5 files changed

+56
-18
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- run: pg-build-test
4343

4444
# Test update.
45-
- run: 'if [ -d "$UPDATE_FROM" ]; then make uninstall clean updatecheck; fi'
45+
- run: 'if [ -n "$UPDATE_FROM" ]; then make uninstall clean updatecheck; fi'
4646

4747
# Test all, install, test, test-serial, and test-parallel, both from clean
4848
# repo and repeated with existing build, with and without PARALLEL_CONN=1.

Changes

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Revision history for pgTAP
1515
`dynamic_library_path`.
1616
* Tested on PostgreSQL 9.1–18 and fixed a test failure on PostgreSQL 18.
1717
* Improved Markdown formatting in `README.md`.
18+
* Fixed upgrades from 1.1.0 to 1.2.0, from 1.3.0 to 1.3.1, and from 1.3.1 to
19+
1.3.2 and restored upgrade testing to the test workflow.
1820

1921
1.3.3 2024-04-08T13:44:11Z
2022
--------------------------
@@ -148,6 +150,18 @@ Revision history for pgTAP
148150
serially (#279).
149151
* Fixed an issue where tests might not run in parallel even when the server
150152
supported it (#279).
153+
* Fixed failing tests on Postgres 8.1.
154+
* Added function type testing functions to complement `is_aggregate()` and
155+
`isnt_aggregate()`:
156+
+ `is_normal_function()`
157+
+ `isnt_normal_function()`
158+
+ `is_window()`
159+
+ `isnt_window()`
160+
+ `is_procedure()`
161+
+ `isnt_procedure()`
162+
* Made the diagnostic output of `is_aggregate()` and `isnt_aggregate()`
163+
consistent. Previously, when the function did not exist, some instances would
164+
generate diagnostic output and some would not.
151165

152166
1.1.0 2019-11-25T19:05:38Z
153167
--------------------------
@@ -258,18 +272,6 @@ Revision history for pgTAP
258272
+ `partitions_are()`
259273
* Added the materialized view-testing assertion functions to the v0.95.0 upgrade
260274
script; they were inadvertently omitted in the v0.95.0 release.
261-
* Fixed failing tests on Postgres 8.1.
262-
* Added function type testing functions to complement `is_aggregate()` and
263-
`isnt_aggregate()`:
264-
+ `is_normal_function()`
265-
+ `isnt_normal_function()`
266-
+ `is_window()`
267-
+ `isnt_window()`
268-
+ `is_procedure()`
269-
+ `isnt_procedure()`
270-
* Made the diagnostic output of `is_aggregate()` and `isnt_aggregate()`
271-
consistent. Previously, when the function did not exist, some instances would
272-
generate diagnostic output and some would not.
273275

274276
0.97.0 2016-11-28T22:18:29Z
275277
---------------------------

sql/pgtap--1.1.0--1.2.0.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,26 @@ BEGIN
329329
END;
330330
$$ LANGUAGE plpgsql STABLE;
331331

332+
DROP VIEW IF EXISTS tap_funky;
333+
CREATE VIEW tap_funky
334+
AS SELECT p.oid AS oid,
335+
n.nspname AS schema,
336+
p.proname AS name,
337+
pg_catalog.pg_get_userbyid(p.proowner) AS owner,
338+
array_to_string(p.proargtypes::regtype[], ',') AS args,
339+
CASE p.proretset WHEN TRUE THEN 'setof ' ELSE '' END
340+
|| p.prorettype::regtype AS returns,
341+
p.prolang AS langoid,
342+
p.proisstrict AS is_strict,
343+
_prokind(p.oid) AS kind,
344+
p.prosecdef AS is_definer,
345+
p.proretset AS returns_set,
346+
p.provolatile::char AS volatility,
347+
pg_catalog.pg_function_is_visible(p.oid) AS is_visible
348+
FROM pg_catalog.pg_proc p
349+
JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid
350+
;
351+
332352
-- Returns true if the specified function exists and is the specified type,
333353
-- false if it exists and is not the specified type, and NULL if it does not
334354
-- exist. Types are f for a normal function, p for a procedure, a for an

sql/pgtap--1.3.0--1.3.1.sql

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
CREATE FUNCTION parse_type(type text, OUT typid oid, OUT typmod int4)
2-
RETURNS RECORD
3-
AS 'pgtap'
4-
LANGUAGE C STABLE STRICT;
1+
-- Use DO to ignore failures when the shared library doesn't exist, because it
2+
-- only existed for 1.3.1, and if upgrades are running from a later release it
3+
-- won't be there.
4+
DO $$
5+
BEGIN
6+
CREATE FUNCTION parse_type(type text, OUT typid oid, OUT typmod int4)
7+
RETURNS RECORD
8+
AS 'pgtap'
9+
LANGUAGE C STABLE STRICT;
10+
EXCEPTION
11+
WHEN undefined_file THEN
12+
RAISE NOTICE 'No pgtap shared library; skipping C parse_type()';
13+
END;
14+
$$;
515

616
CREATE OR REPLACE FUNCTION format_type_string ( TEXT )
717
RETURNS TEXT AS $$
@@ -211,3 +221,9 @@ END;
211221
$$ LANGUAGE plpgsql;
212222

213223
DROP FUNCTION _quote_ident_like(TEXT, TEXT);
224+
225+
-- has_pk( schema, table )
226+
CREATE OR REPLACE FUNCTION has_pk ( NAME, NAME )
227+
RETURNS TEXT AS $$
228+
SELECT has_pk( $1, $2, 'Table ' || quote_ident($1) || '.' || quote_ident($2) || ' should have a primary key' );
229+
$$ LANGUAGE sql;

sql/pgtap--1.3.1--1.3.2.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DROP FUNCTION parse_type(type text, OUT typid oid, OUT typmod int4);
1+
DROP FUNCTION IF EXISTS parse_type(type text, OUT typid oid, OUT typmod int4);
22

33
CREATE OR REPLACE FUNCTION format_type_string ( TEXT )
44
RETURNS TEXT AS $$

0 commit comments

Comments
 (0)