Skip to content

Commit f995759

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. Also move change items accidentally added to 0.98.0 to 1.2.0 when they were actually added, and update patch offsets.
1 parent 70756f2 commit f995759

File tree

10 files changed

+62
-24
lines changed

10 files changed

+62
-24
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: 13 additions & 11 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+
* Restored upgrade testing to the test workflow and fixed upgrades from 1.1.0
19+
to 1.2.0, from 1.3.0 to 1.3.1, and from 1.3.1 to 1.3.2.
1820

1921
1.3.3 2024-04-08T13:44:11Z
2022
--------------------------
@@ -148,6 +150,17 @@ 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+
* Added function type testing functions to complement `is_aggregate()` and
154+
`isnt_aggregate()`:
155+
+ `is_normal_function()`
156+
+ `isnt_normal_function()`
157+
+ `is_window()`
158+
+ `isnt_window()`
159+
+ `is_procedure()`
160+
+ `isnt_procedure()`
161+
* Made the diagnostic output of `is_aggregate()` and `isnt_aggregate()`
162+
consistent. Previously, when the function did not exist, some instances would
163+
generate diagnostic output and some would not.
151164

152165
1.1.0 2019-11-25T19:05:38Z
153166
--------------------------
@@ -259,17 +272,6 @@ Revision history for pgTAP
259272
* Added the materialized view-testing assertion functions to the v0.95.0 upgrade
260273
script; they were inadvertently omitted in the v0.95.0 release.
261274
* 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
---------------------------

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ endif
221221
EXTRA_CLEAN += sql/pgtap--0.99.0--1.0.0.sql
222222
sql/pgtap--0.99.0--1.0.0.sql: sql/pgtap--0.99.0--1.0.0.sql.in
223223
cp $< $@
224-
ifeq ($(shell echo $(VERSION) | grep -qE "^9[.][01234]|" && echo yes || echo no),yes)
224+
ifeq ($(shell echo $(VERSION) | grep -qE "^9[.][01234]" && echo yes || echo no),yes)
225225
patch -p0 < compat/9.4/pgtap--0.99.0--1.0.0.patch
226226
endif
227227

compat/install-9.1.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
RETURN ok( FALSE, descr ) || E'\n' || diag(
1212
' died: ' || _error_diag(SQLSTATE, SQLERRM, detail, hint, context, schname, tabname, colname, chkname, typname)
1313
);
14-
@@ -6732,10 +6728,6 @@
14+
@@ -6787,10 +6783,6 @@
1515
-- Something went wrong. Record that fact.
1616
errstate := SQLSTATE;
1717
errmsg := SQLERRM;
@@ -22,15 +22,15 @@
2222
END;
2323

2424
-- Always raise an exception to rollback any changes.
25-
@@ -7203,7 +7195,6 @@
25+
@@ -7258,7 +7250,6 @@
2626
RETURN ok( true, $3 );
2727
EXCEPTION
2828
WHEN datatype_mismatch THEN
2929
- GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT;
3030
RETURN ok( false, $3 ) || E'\n' || diag(
3131
E' Number of columns or their types differ between the queries' ||
3232
CASE WHEN have_rec::TEXT = want_rec::text THEN '' ELSE E':\n' ||
33-
@@ -7357,7 +7348,6 @@
33+
@@ -7412,7 +7403,6 @@
3434
RETURN ok( false, $3 );
3535
EXCEPTION
3636
WHEN datatype_mismatch THEN

compat/install-9.2.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
RETURN ok( FALSE, descr ) || E'\n' || diag(
1515
' died: ' || _error_diag(SQLSTATE, SQLERRM, detail, hint, context, schname, tabname, colname, chkname, typname)
1616
);
17-
@@ -6740,12 +6735,7 @@
17+
@@ -6795,12 +6790,7 @@
1818
GET STACKED DIAGNOSTICS
1919
detail = PG_EXCEPTION_DETAIL,
2020
hint = PG_EXCEPTION_HINT,

compat/install-9.4.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
-- There should have been no exception.
1919
GET STACKED DIAGNOSTICS
2020
detail = PG_EXCEPTION_DETAIL,
21-
@@ -10284,233 +10284,6 @@
21+
@@ -10339,233 +10339,6 @@
2222
), $2);
2323
$$ LANGUAGE SQL immutable;
2424

compat/install-9.6.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- sql/pgtap.sql
22
+++ sql/pgtap.sql
3-
@@ -10266,136 +10266,6 @@
3+
@@ -10321,136 +10321,6 @@
44
);
55
$$ LANGUAGE sql;
66

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)