Skip to content

Commit 2a5d26d

Browse files
committed
Remove $libdir prefix, test Pg18, update README
Remove the `$libdir/` prefix from `module_pathname`; pgTAP does not currently install a shared module, but future-proof it. While at it, document how to install the extension under a custom prefix on Postgres 18, and test it on Postgres 18. Also use fenced code blocks in the README.
1 parent 1e5eebb commit 2a5d26d

File tree

10 files changed

+261
-28
lines changed

10 files changed

+261
-28
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
strategy:
1111
matrix:
1212
include:
13-
- { version: 17, upgrade_to: "", update_from: 0.99.0 }
13+
- { version: 18, upgrade_to: "", update_from: 0.99.0 }
14+
- { version: 17, upgrade_to: 18, update_from: 0.99.0 }
1415
- { version: 16, upgrade_to: 17, update_from: 0.99.0 }
1516
- { version: 15, upgrade_to: 16, update_from: 0.99.0 }
1617
- { version: 14, upgrade_to: 15, update_from: 0.99.0 }
@@ -25,8 +26,8 @@ jobs:
2526
- { version: 9.2, upgrade_to: 9.3, update_from: "" } # updatecheck is not supported prior to 9.3
2627
- { version: 9.1, upgrade_to: 9.2, update_from: "" } # updatecheck is not supported prior to 9.3
2728
# Also test pg_upgrade across many versions
28-
- { version: 9.2, upgrade_to: 17, update_from: "", suffix: –17 }
29-
- { version: 9.4, upgrade_to: 17, update_from: "", suffix: –17 }
29+
- { version: 9.2, upgrade_to: 18, update_from: "", suffix: –18 }
30+
- { version: 9.4, upgrade_to: 18, update_from: "", suffix: –18 }
3031
name: 🐘 PostgreSQL ${{ matrix.version }}${{ matrix.suffix }}
3132
runs-on: ubuntu-latest
3233
container: pgxn/pgxn-tools

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Revision history for pgTAP
1010
to Jim Nasby for reporting the issue (#234) Rodolphe Quiédeville for for the
1111
pull request (#339).
1212
* Added `index_is_partial()`, thanks to Rodolphe Quiédeville (#342).
13+
* Removed the `$libdir/` prefix from the `module_pathname` directive, so that
14+
the module can be installed and found in any directory listed in
15+
`dynamic_library_path`.
1316

1417
1.3.3 2024-04-08T13:44:11Z
1518
--------------------------

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ endif
219219
ifeq ($(shell echo $(VERSION) | grep -qE "^(9[.][01]|8[.][1234])" && echo yes || echo no),yes)
220220
patch -p0 < compat/install-9.1.patch
221221
endif
222-
sed -e 's,MODULE_PATHNAME,$$libdir/pgtap,g' -e 's,__OS__,$(OSNAME),g' -e 's,__VERSION__,$(NUMVERSION),g' sql/pgtap.sql > sql/pgtap.tmp
222+
sed -e 's,MODULE_PATHNAME,pgtap,g' -e 's,__OS__,$(OSNAME),g' -e 's,__VERSION__,$(NUMVERSION),g' sql/pgtap.sql > sql/pgtap.tmp
223223
mv sql/pgtap.tmp sql/pgtap.sql
224224

225225
# Ugly hacks for now... TODO: script that understands $VERSION and will apply all the patch files for that version

README.md

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,74 +17,114 @@ be installed remotely.
1717

1818
To build it, just do this:
1919

20-
make
21-
make install
22-
make installcheck
20+
```sh
21+
make
22+
make install
23+
make installcheck
24+
```
2325

2426
If you encounter an error such as:
2527

26-
"Makefile", line 8: Need an operator
28+
```
29+
"Makefile", line 8: Need an operator
30+
```
2731

2832
You need to use GNU make, which may well be installed on your system as
2933
`gmake`:
3034

31-
gmake
32-
gmake install
33-
gmake installcheck
35+
```sh
36+
gmake
37+
gmake install
38+
gmake installcheck
39+
```
3440

3541
If you encounter an error such as:
3642

37-
make: pg_config: Command not found
38-
43+
```
44+
make: pg_config: Command not found
45+
```
3946
Or:
4047

41-
Makefile:52: *** pgTAP requires PostgreSQL 9.1 or later. This is . Stop.
48+
```
49+
Makefile:52: *** pgTAP requires PostgreSQL 9.1 or later. This is . Stop.
50+
```
4251

4352
Be sure that you have `pg_config` installed and in your path. If you used a
4453
package management system such as RPM to install PostgreSQL, be sure that the
4554
`-devel` package is also installed. If necessary tell the build process where
4655
to find it:
4756

48-
env PG_CONFIG=/path/to/pg_config make && make install && make installcheck
57+
```sh
58+
env PG_CONFIG=/path/to/pg_config make && make install && make installcheck
59+
```
4960

5061
And finally, if all that fails, copy the entire distribution directory to the
5162
`contrib/` subdirectory of the PostgreSQL source tree and try it there without
5263
`pg_config`:
5364

54-
env NO_PGXS=1 make && make install && make installcheck
65+
```sh
66+
env NO_PGXS=1 make && make install && make installcheck
67+
```
5568

5669
If you encounter an error such as:
5770

58-
ERROR: must be owner of database regression
71+
```
72+
ERROR: must be owner of database regression
73+
```
5974

6075
You need to run the test suite using a super user, such as the default
6176
"postgres" super user:
6277

63-
make installcheck PGUSER=postgres
78+
```
79+
make installcheck PGUSER=postgres
80+
```
6481

6582
If you encounter an error such as:
6683

67-
ERROR: Missing extensions required for testing: citext isn ltree
84+
```
85+
ERROR: Missing extensions required for testing: citext isn ltree
86+
```
6887

6988
Install the PostgreSQL
7089
[Additional Supplied Modules](https://www.postgresql.org/docs/current/contrib.html),
7190
which are required to run the tests. If you used a package management system
7291
such as RPM to install PostgreSQL, install the `-contrib` package.
7392

93+
To install the extension in a custom prefix on PostgreSQL 18 or later, pass
94+
the `prefix` argument to `install` (but no other `make` targets):
95+
96+
```sh
97+
make install prefix=/usr/local/extras
98+
```
99+
100+
Then ensure that the prefix is included in the following [`postgresql.conf`
101+
parameters]:
102+
103+
```ini
104+
extension_control_path = '/usr/local/extras/postgresql/share:$system'
105+
dynamic_library_path = '/usr/local/extras/postgresql/lib:$libdir'
106+
```
107+
74108
Once pgTAP is installed, you can add it to a database by connecting as a super
75109
user and running:
76110

77-
CREATE EXTENSION pgtap;
111+
```sql
112+
CREATE EXTENSION pgtap;
113+
```
78114

79115
If you've upgraded your cluster to PostgreSQL 9.1 and already had pgTAP
80116
installed, you can upgrade it to a properly packaged extension with:
81117

82-
CREATE EXTENSION pgtap FROM unpackaged;
118+
```sql
119+
CREATE EXTENSION pgtap FROM unpackaged;
120+
```
83121

84122
If you want to install pgTAP and all of its supporting objects into a specific
85123
schema, use the `SCHEMA` clause to specify the schema, like so:
86124

87-
CREATE EXTENSION pgtap SCHEMA tap;
125+
```sql
126+
CREATE EXTENSION pgtap SCHEMA tap;
127+
```
88128

89129
Dependencies
90130
------------
@@ -94,7 +134,7 @@ pgTAP requires PostgreSQL 9.1 or higher.
94134
Copyright and License
95135
---------------------
96136

97-
Copyright (c) 2008-2023 David E. Wheeler. Some rights reserved.
137+
Copyright (c) 2008-2025 David E. Wheeler. Some rights reserved.
98138

99139
Permission to use, copy, modify, and distribute this software and its
100140
documentation for any purpose, without fee, and without a written agreement is

doc/pgtap.mmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8827,7 +8827,7 @@ Credits
88278827
Copyright and License
88288828
---------------------
88298829

8830-
Copyright (c) 2008-2023 David E. Wheeler. Some rights reserved.
8830+
Copyright (c) 2008-2025 David E. Wheeler. Some rights reserved.
88318831

88328832
Permission to use, copy, modify, and distribute this software and its
88338833
documentation for any purpose, without fee, and without a written agreement is

pgtap.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# pgTAP extension
22
comment = 'Unit testing for PostgreSQL'
33
default_version = '1.3.4'
4-
module_pathname = '$libdir/pgtap'
4+
module_pathname = 'pgtap'
55
requires = 'plpgsql'
66
relocatable = true
77
superuser = false

sql/pgtap--1.3.0--1.3.1.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CREATE FUNCTION parse_type(type text, OUT typid oid, OUT typmod int4)
22
RETURNS RECORD
3-
AS '$libdir/pgtap'
3+
AS 'pgtap'
44
LANGUAGE C STABLE STRICT;
55

66
CREATE OR REPLACE FUNCTION format_type_string ( TEXT )

test/expected/runtests.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ok 3 - whatever."test ident"
1717
ok 3 - setup more
1818
# Test died: 22012: division by zero
1919
# CONTEXT:
20-
# SQL function "testdividebyzero" during startup
20+
# SQL function "testdividebyzero" statement 1
2121
# PL/pgSQL function _runner(text[],text[],text[],text[],text[]) line 62 at FOR over EXECUTE statement
2222
# SQL function "runtests" statement 1
2323
# SQL function "runtests" statement 1
@@ -108,7 +108,7 @@ ok 3 - whatever."test ident"
108108
ok 3 - setup more
109109
# Test died: 22012: division by zero
110110
# CONTEXT:
111-
# SQL function "testdividebyzero" during startup
111+
# SQL function "testdividebyzero" statement 1
112112
# PL/pgSQL function _runner(text[],text[],text[],text[],text[]) line 62 at FOR over EXECUTE statement
113113
# SQL function "runtests" statement 1
114114
not ok 4 - whatever.testdividebyzero

0 commit comments

Comments
 (0)