Developer Informaion
Building the extension
Each function and test is organized into its own separate file for easy management. The shell script create_sql.sh is responsible for assembling these files into the appropriate SQL scripts needed for extension creation.
Configuration
Copy the example configuration file build.cfg.example to build.cfg.
Modify build.cfg to include the database connection information of your environment.
Running the Script
The script automatically generates the necessary SQL scripts by combining the function and test files.
It is assumed that you have a .pgpass file in your home directory, containing the database credentials matching the configuration. This file simplifies the login process during script execution.
Otherwise you have to login with credentials for each execution.
The test results are generated with messages and captions in your local language settings. In addition the test/sql/out/pgsql-tweaks-test-[version number].out file has timing on, you see the execution time for each test.
Parameters
The script accepts three parameters to fine grane testing and releasing.
With no parameters it will use the following default settings:
- No pgxn.org release
- database kept
- additional not packages installed
Named parameters do not need a sortorder.
Help
You can use the following paramerts to get the help text:
- –help
- -h
- -?
Example
# Create the PGXN release
./create_sql --help
No parameters: defaults used; –pgxn(-px:): Create release for pgxn.org; –drop(-d:): Drop database at the end; –packages(-p): Include additonal packages, –help(-?, -h): This text
PGXN
The first parameter offers the creation of release files for PGXN.
- Default: N
- Create release:
- y
- –pgxn
- -px
- y
Example
# Create the PGXN release
./create_sql y
./create_sql -pgxn
./create_sql -px
DROPDATABASE
The second parameter gives the option to keep or drop the test database pgsql_tweaks_test.
- Default: N
- Drop:
- y
- –drop
- -d
- y
Example
# No PGXN release, database not dropped
./create_sql N N
#### Execution with Defaults
# No PGXN release, database dropped
./create_sql N y
# No PGXN release, database dropped
./create_sql --drop
./create_sql -d
WITHPACKAGES
As some views do need additional packages, it is necessary to test with and without additional packages.
Currently there are only two additional packages used, for details please see List of Additional Extensions.
- Default: N
- Create additional packages:
- y
- –packages
- -p
- y
Example
# No PGXN release, database not dropped, without additional packages
./create_sql N N N
# No PGXN release, database dropped, with additional packages
./create_sql N N y
# No PGXN release, database kept, with additional packages
./create_sql --packages
./create_sql -p
Example with Default Parameters
./create_sql.sh
version
-----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 17.6 (Ubuntu 17.6-1.pgdg24.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, 64-bit
(1 row)
Extensions pg_stat_statements and pgstattuple created
Database pgsql_tweaks_test kept
No pgxn zip file has been created
Releasing
The script accepts an optional argument to control whether a zip file for PGXN (PostgreSQL Extension Network) is created. PGXN is also the prefered installation method.
You have to pass 'y' as the first argument to the script. The language of the test results will be in English UTF8 en_EN. In addition a zip archive is generated ready for submission to PGXN.
The test/sql/out/pgsql-tweaks-test-[version number].out file is generated without timing, otherwise the test results would not be comparable.
Example:
./create_sql.sh y
This will create a zip file of the extension in the $HOME/tmp directory with the pattern pgsql-tweaks-[version number].zip.
When the directory $HOME/tmp does not exist, it is created by the scirpt.
If no argument is provided, or if the argument is not 'y', the PGXN zip file is not created.