Repository navigation
Extensions
Everything on this page is part of release 0.2.0 (2026-11-30) and of 0.2.1 (2026-12-02), which adds pg_cron; 0.1.0 and 0.1.1 have none of it. It is phase 15, the management of third-party PostgreSQL extensions (ADR 0029, Accepted 2026-11-23; design extension-management-phase15.md). It is built in kingres_shard 0.10, the REST contract 0.35.0 (14 operations added, 192 in all; additive only) and the system database migration 0046. Two real extensions are bundled in the Debian package, the image and the RPM packages: pgvector 0.8.7 and pgaudit (see "The bundled extensions"). pg_cron is not part of 0.2.0: it was built and tested and then withheld, because it could not be switched on through the control plane; it is bundled again in 0.2.1 (the REST contract is 0.37.0 with 199 operations in 0.2.1).
The five extensions of KingresDB are always there. Any other extension is not installed by hand with CREATE EXTENSION on one server: in a cluster, an extension that exists on one server and not on another, or in a version that differs, breaks queries, moves and failover. So an extension must be in the registry, and it is created, updated and dropped on every server in one transaction, from psql and from the console alike.
-
The registry is compiled into the library of
kingres_shardand is also generated intokingresd, from one file (kingres/extensions/extensions.yaml); a test andcheck_clustercompare the two copies. Each entry has a status (supported or refused), a class that says what the extension may do, a version list, the digests of its files, and the features of KingresDB it conflicts with.SELECT * FROM kingres.supported_extensionsandkingres.extension_registryshow it. -
Refusals at
CREATE EXTENSION. An extension that is not in the registry is refused with SQLSTATEKE001; a refused one withKE002and the reason. This happens in a hook, before any script of the extension has run. The other codes are in "The error codes" below; none is retryable. -
Cluster-wide
CREATE,ALTERandDROP EXTENSION. Every server is asked first (version and files, the probe); then the change is made on all servers in one transaction. A new server added to the cluster gets the extensions of the cluster, or is refused.check_clusterreports differences. -
Feature locks. Some extensions conflict with a feature of KingresDB. Switching one on is refused (
KE006) when the database uses a feature it conflicts with; while it is on, the locked feature is refused (KE007), at the entry points of sharding and moves and inside the other KingresDB extensions (below); switching it off is refused while objects depend on it (KE008, never cascaded).database feature-setanddatabase extension plan-switchsay what a change would do before it is made. -
The files come from KingresDB's own packages. The project's Debian package and image carry the tested extensions, built from pinned upstream releases;
kingresdinstalls no files and only verifies them against the digests of the registry (KE009). PostGIS is planned as a separate package pinned to the exact KingresDB version.
A refusal carries a SQLSTATE of class KE. None of them goes away by repeating the statement; each message names what to change.
| SQLSTATE | Meaning |
|---|---|
KE001 |
The extension, or that version, is not in the registry |
KE002 |
The extension is refused (it overlaps a KingresDB component, or conflicts with failover and moves) |
KE003 |
The servers do not agree on the version, or the library files of an extension differ between servers |
KE004 |
A requirement of a server is missing: the preload library is not loaded (on the server that runs the statement, and on every other primary before a statement is sent to it), a standby does not preload what its primary does, or the files of a managed extension are missing on a new node or a standby (add_node, standby registration) |
KE005 |
A use is refused: a table uses an extension in a way its class does not allow, or the schema of the extension is open to roles that are not superusers (below) |
KE006 |
Switching on is refused: the database uses a feature the extension locks |
KE007 |
A KingresDB action is refused because an extension locks its feature in this database |
KE008 |
Switching off is refused: objects depend on the extension (no cascade) |
KE009 |
A file of a bundled extension differs from the tested build |
So files that are missing on a new node or a standby are KE004 (a requirement of the server), and files that are another version or differ are KE003.
An extension that cannot live next to a KingresDB feature on the same data is admitted under a lock: it can be switched on only when the features it needs free are not in use (KE006), and while it is on those features are refused (KE007) wherever they start. The locks are honoured inside the other KingresDB extensions too, not only at the entry points of sharding and moves: kingres_timepart 0.4 (timepart_set_policy, create_time_partitions, drop_old_time_partitions, timepart_adopt, timepart_begin_run; ALTER EXTENSION kingres_timepart UPDATE), kingres_columnar (every new columnar relation), kingres_ledger (ledger_enable), kingres_sketch (the functions that start a sketch and SET kingres_shard.count_distinct_mode = approximate) and the setting shippable_extensions for the pushdown. What exists keeps working (a columnar table, a ledger, a sketch that is read). A server without kingres_shard has no lock. The guards read the registry only when a superuser owns it, and take the shared feature lock of kingres_shard, so a switch-on cannot race a concurrent use; on a hot standby they take no lock. kingres.feature_set shows the state of each feature.
create_distributed_table and create_reference_table refuse with KE005, before anything is changed, a table that uses an extension against the rules of its class (the Distribute dialog of the console shows the same rows, and kingres.table_change_report() lists them):
- a distribution column of an extension type that the registry does not mark as a distribution key;
- a column type, a default or an index access method of an extension installed on one node only (for example
pg_cron,pgaudit); - an index through an access method the registry does not list for tables, and any unique index or exclusion constraint through the access method of an extension;
- a table access method other than
heapandcolumnar; - the parent of a pg_partman set.
Settings that change what an index scan answers (hnsw.ef_search and the like) are listed in the registry as forwarded settings: the value of your session is applied on the remote transaction of every shipped statement. Not looked at: expression indexes, partial-index predicates, CHECK constraints and triggers that call a function of a per-node extension, and the tables of a distributed schema.
The schema rule. CREATE EXTENSION and ALTER EXTENSION ... UPDATE of a listed extension are refused (KE005) when the schema the extension has is owned by a role that is not a superuser, the installer or pg_database_owner, or grants CREATE widely. A database upgraded from PostgreSQL 14 or older has CREATE for PUBLIC on public, and application schemas are often owned by the application role: before the first operation on an extension, a superuser revokes CREATE on the schema from PUBLIC and gives the schema to a superuser or pg_database_owner (the commands are in the operator guide, chapter 15).
add_node of a primary makes every managed extension on the new node first, at the cluster's version, and refuses before anything else changes (KE004 for missing files, KE003 for files that differ). Registering a standby checks that it has the control and script files of every managed extension, that the libraries are the same files as those of the server that registers it, and that it preloads the libraries of its primary that belong to KingresDB or that a managed extension needs; other libraries of the primary are the standby's own business, so standbys registered earlier keep working. A standby that cannot be reached is registered with a warning. check_cluster reports extension_library_not_loaded, preload_differs, hook_order_differs and extension_package_differs.
-
In the registry now.
plpgsqlandpg_stat_statements(already part of 0.1.0 and 0.1.1), and a safe set of PostgreSQL contrib modules:pgcrypto,uuid-ossp,citext,hstore,pg_trgm,btree_gin,btree_gist,fuzzystrmatch,unaccent,intarray,ltree,cube,earthdistance,isn,seg,tablefunc,bloom,lo,tsm_system_rows,tsm_system_time,dict_int,amcheck,pgstattuple,pg_buffercache,pg_visibilityandpg_prewarm. -
Refused for good (
KE002). An extension that duplicates a function of KingresDB is never added (the no-overlap rule of ADR 0029): Citus andcitus_columnar(sharding), TimescaleDB andpg_partman(time partitioning),pg_mooncakeand other table access methods (columnar storage),pglogical(it takes the replication slots that moves and failover use). The owner also refused on 2026-11-28postgres_fdwanddblink(they reach other servers around the router) andpg_repackandpg_ivm(they rewrite tables that the ledger and the moves track). -
Bundled real extensions:
vector(pgvector) andpgauditsince 0.2.0, andpg_cronsince 0.2.1, below. In 0.2.0pg_cronis in the registry as refused for that release only (KE002, "Not part of 0.2.0: it cannot be switched on through the control plane yet; planned for a later release."): it is not a refusal of principle like Citus or TimescaleDB. Others only where they do not conflict with sharding or the ledger; PostGIS and the other candidates of the design are not bundled yet, and PostGIS is planned as a separate package.
The first third-party extensions are pgvector 0.8.7 (the extension is named vector) and pgaudit (18.1 on PostgreSQL 18, 19.0 on PostgreSQL 19). They are in the registry and ship in the main Debian package, in the container image and in the RPM packages of the four targets, not in a package of their own. The project builds each one from its pinned upstream release (URL, SHA-256 and git commit are recorded and checked before anything is extracted), against KingresDB, never taken from another distribution; the files are in /opt/kingres/extensions/<project>/, with an SBOM and the licence texts, and kingresd checks the SHA-256 of their files against the registry before it switches one on. There is no way to add a version at run time. How they are built is in kingres/docs/dev/building-extensions.md.
-
vector (pgvector). A statement that orders by a distance operator on a distributed table is answered by the complete scan: the rows of every group are fetched and ordered on the node that was asked, so the answer is exact and the HNSW and IVFFlat indexes of the leaves are not used (the pushdown of pgvector is not built). A statement with a condition on the distribution column goes to one group and may use the index, whose answer can then be approximate. The registry lists the index access methods
hnswandivfflatas allowed on distributed and reference tables, and forwards the seven pgvector settings (hnsw.ef_search,hnsw.iterative_scan,hnsw.max_scan_tuples,hnsw.scan_mem_multiplier,ivfflat.probes,ivfflat.iterative_scan,ivfflat.max_probes) from your session to the nodes with the statement. A write to a reference table that uses thevectortype through a literal cast or a function of the extension is refused as not shippable. A bucket move builds the indexes of the leaf again at the destination, and the group that gave the bucket away keeps an orphan table, and so keeps the type in use (KE008on drop), untilkingres.cleanup_moved_bucketshas run. -
pg_cron (withheld from 0.2.0; bundled and switchable again since 0.2.1, below). pg_cron 1.6.8 was planned for this release and was built, tested and packaged, and was then taken out before the release by the owner's decision of 2026-11-29: the release gate showed on the release image that it cannot be switched on through any supported interface. Its required settings (
cron.use_background_workers,cron.max_running_jobs,cron.database_name) are hidden parameters that the configuration API refuses, and the cron database and the grant on the schemacronhave no supported route. Nothing of it is in the Debian package, the image or the RPM packages. The registry keeps an entry with the statusrefusedso that a user finds the reason:CREATE EXTENSION pg_cronis refused withKE002and that text, also frompsqland also when an administrator has installed it by hand; it is not in the preload allowlist, and the console shows it as refused. It is planned to return as a supported entry in a later release (0.2.1).
pg_cron in release 0.2.1 (0.2.0 does not have it). pg_cron 1.6.8 is bundled again, with its files and digests (rebuilt in the pinned builders of the Ubuntu image and of the four RPM targets, both majors; every digest set equals the pin) and its registry entry is supported and switchable through the control plane. What changed: (1) the configuration API still refuses every parameter that PostgreSQL hides from ordinary users, except one that a supported, bundled registry entry names in its required settings: cron.use_background_workers, cron.max_running_jobs and cron.database_name are settable at the cluster level only, to a value that the rule of the entry accepts (checked at the preview, at the apply and again on each server), with a restart; every other hidden parameter stays refused, and a setting must carry the prefix of its own extension or library. (2) pg_cron works in one database, the one of cron.database_name (the default, postgres, cannot be used because kingresd installs nothing there): name a user database that has sharding on and that no drop task holds. (3) The switch-on gives USAGE on the schema cron to the role kingres_admin in the same transaction; the read-back of the install checks the grant on the primary of the map group and makes it again when it is missing; dropping the extension removes the schema and the grant. (4) The read-back and the list look at the primary of the map group and fail closed (state partial) when the catalog does not say where it is.
How to switch pg_cron on (0.2.1). The order is fixed and a first switch-on takes two restarts: (1) preload and restart (PUT /cluster/preload), because the settings of a library do not exist before it is loaded; (2) set cron.use_background_workers = on, cron.max_running_jobs (at most 4) and cron.database_name on the Configuration page at the cluster level and restart the pending servers; (3) switch on (POST /databases/{db}/extensions) in the database of cron.database_name. The plan of the switch names the next missing step in the remedy of its blocker. During a rolling upgrade a server that still runs the 0.2.0 build refuses the three settings and CREATE EXTENSION pg_cron until it is upgraded, so upgrade every server before pg_cron is set up.
The guards. DELETE /databases/{db} answers 409 while pg_cron uses that database (cron.database_name stores it or a server still runs it; the remedy is to switch pg_cron off, remove the setting, restart, then drop; the drop task checks again). PUT /cluster/preload answers 409 when a library is removed while a value is stored for one of its settings, at any level; this also applies to pgaudit and pgaudit.log: remove the value first.
The limits of pg_cron. There is one scheduler for the cluster, on the primary of the map group; the extension exists there only, every job runs there, and after a failover the promoted primary runs the scheduler. A job runs as the role that scheduled it, as a background worker (so the managed pg_hba.conf does not refuse it); the rules of pg_hba.conf and the password checks of that role (VALID UNTIL) do not apply to a job, so a job that was scheduled keeps running for a role that was changed afterwards, and also after a member is removed from kingres_admin. A job does not run while the node is in recovery. A member of kingres_admin can call cron.schedule and cron.unschedule and read cron.job and cron.job_run_details (limited by row security to its own jobs); cron.schedule_in_database and cron.alter_job stay with the superuser, so a member cannot schedule for another role or in another database, and any other role has no USAGE. An extension made with a plain CREATE EXTENSION gets no grant: run GRANT USAGE ON SCHEMA cron TO kingres_admin in the database of cron.database_name. The launcher and up to four jobs use five slots of max_worker_processes. See Limitations and Known Issues.
-
pgaudit. Per node: each node writes the audit lines of the statements it runs into its own log. A statement sent to the groups is audited on each node that runs a part of it, but there it is the fragment that the sharding extension sent (application name
kingres_shard); the user and the text of the client are in the log of the node that received the statement only. The logs together say what ran where, not who asked.kingresdrefuses to switch it on whilepgaudit.logisnone, and the library must be preloaded on every server first (KE004).
A bundled extension has one version per major; ALTER EXTENSION ... UPDATE of pgvector and pgaudit has nothing to update to until a release raises the version. bloom is in the contrib set with its access method, so a table that already has a bloom index can be distributed.
The build of the bundled extensions in release 0.2.1 (0.2.0 does not have it). The source archives are fetched into a cache before the build and checked again inside it (KINGRES_EXT_CACHE, KINGRES_EXT_FETCH=0, --offline; see Building from Source), and the dnf packages of every RPM builder are pinned, so that a builder rebuilt on another day is meant to give the same bytes of the extension files as the digests in the registry (see Release Process for the pins, when they are renewed and what the AlmaLinux vault fallback does not cover). The registry itself changes in one way: a withheld entry is refused by the validator when it carries required settings, worker slots, a preload library, versions or files; no entry changes. The REST contract text of refused now says that a refused entry either duplicates a component of KingresDB or is withheld from the release (as pg_cron is in 0.2.0); this is description text only.
The RPM packages carry both extensions. The registry keeps one set of digests per platform and major (the Debian package and the image are ubuntu2404-amd64; each RPM target has its own set), because an extension compiled in the container of an RPM target is another binary.
kingres_shard.allow_unlisted_extensions is off by default. It is set only in the configuration file of kingresd (a restart is needed), every use is audited, and the console shows a red "unsupported configuration" banner. It lets an untested extension that is not bundled past KE001 (a warning), when an administrator has put its files on every server by hand. It never overrides a refusal (KE002) or a lock of the ledger.
An extension that needs a library in shared_preload_libraries is handled by the cluster-wide preload list: kingresd owns the setting, an extra library must be on an allowlist of the registry, the change is checked on every server, applied with a restart in the safe order (standbys before primaries) and rolled back on failure. The console and the command line show the plan before a restart.
- Console: the Extensions page, the Extensions tab of a database, and a dashboard card; three tasks (install, update, remove), alerts and audit actions.
-
Command line (Command Line Client):
extension catalog,extension show,extension packages;database extension list,install,update,remove,plan-switch;database extension-catalogue,database feature-set;preload show,plan,check,set. - REST API: the catalogue and database endpoints and the preload endpoints of contract 0.35.0 (Control Plane and REST API).
Not built: the pushdown of pgvector and PostGIS queries (they are answered by the complete scan); PostGIS and the other candidates of the design as packaged extensions; the table rules for the tables of a distributed schema; KE004 for the other servers at CREATE EXTENSION of the standbys, which check_cluster reports instead; and the closing review of the phase. TimescaleDB under a lock is not planned. See Status and Roadmap and Limitations and Known Issues.
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations