Skip to main content
Markdown

Deploy PostgreSQL Applications and Functions

A PostgreSQL client deploys as an executable with its native libraries. Server functions deploy into the database host and additionally depend on PostgreSQL's major-version ABI. Use the procedure below for the artifact you built, with an SDK and runtime matching the destination architecture.

Client Applications​

For a configured native project target, create a runtime package:

Terminal
exaloop --target app package --bundle-runtime

Keep the package directory intact and supply the connection configuration and TLS certificates separately. See runtime packages for target requirements and dynamically loaded libraries.

Install Server Functions​

The function build emits codon_functions.control and codon_functions--0.1.0.sql. To distribute a PostgreSQL extension, install the library under pg_config --pkglibdir and those two files under pg_config --sharedir in its extension subdirectory. These destinations often require administrator access. The --version option sets the extension version.

After installation, a database superuser can run:

SQL
CREATE EXTENSION codon_functions;

Use either extension installation or the direct development SQL script, not both for the same function names. The extension is relocatable and can be installed in a chosen schema. PostgreSQL's normal function privileges apply; review the default PUBLIC execute permission and grant access as appropriate.

Deploy the matching Codon runtime libraries alongside a suitable library search configuration. Python and the C compiler are build tools, not server-side execution dependencies. All Codon modules in a backend must use the same runtime.

PostgreSQL retains a loaded library for the backend's lifetime. Use a new library filename when deploying a revision, update the SQL definitions, and reconnect existing sessions. Do not overwrite a library being used by live backends or put these libraries in shared_preload_libraries.

Server Safety​

This API provides scalar functions that execute as native code inside a PostgreSQL backend, with the server process's privileges. Staging validation therefore needs representative workloads and database permissions, as well as a compatible server and SDK.

Next Steps​