Skip to content

pgokf

Transactional Open Knowledge Format catalog with lexical and optional semantic search.

pgokf · Transactional Open Knowledge Format catalog with lexical and optional semantic search.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101945pgokfpgokf0.7.0RAGAGPL-3.0-onlyRust

PostgreSQL · 15, 16, 17, 18, 19

Usage

Sources:

pgokf materializes Open Knowledge Format bundles into a transactional PostgreSQL catalog with full-text search, a link graph, provenance, optional semantic search, and tenant isolation.

Enablement and Roles

Release 0.7.0 distributes PostgreSQL 15–18 builds and tests PostgreSQL 19 GA separately; PG19 packages are not published. Install the exact-major build and create the non-relocatable extension as a superuser:

CREATE EXTENSION pgokf;
GRANT pgokf_writer TO app_user;

No preload is required. The extension creates pgokf_reader, pgokf_writer, and pgokf_admin roles; grant the least-capable role needed.

Register and Search a Bundle

The filesystem path is resolved by the PostgreSQL server and must be absolute and server-readable.

SELECT *
FROM pgokf.register_bundle('/srv/okf/runbooks');

SELECT concept_id, title, rank
FROM pgokf.concept_search(
  'postgres failover',
  concept_type => 'runbook'
);

SELECT *
FROM pgokf.concept_neighbors('runbooks/database-failover', 2);

The bundle remains the portable source of truth; use catalog_stats, health, search_index_status, and the sync log to operate the materialized projection.

Optional Search Backends and Boundaries

Core lexical search works without dependencies. Optional vector enables semantic/hybrid functions, pg_textsearch or pg_search enables BM25, and pg_cron enables scheduled refresh. Their absence degrades or errors as documented rather than blocking base installation.

Registration reads server-side files, and some administration functions use SECURITY DEFINER; restrict writer/admin membership and review path containment. Version 0.4.0 is pre-1.0, so read its upgrade scripts and changelog before changing minor versions. Companion ingest/embed/MCP binaries run outside PostgreSQL and are not required by the core extension.

Generations, Freshness and Upgrades

Catalog generations, a durable change-event outbox and typed relationships let producers reconcile derived knowledge. concept_search_fresh exposes freshness filtering; mark_reconciling and mark_fresh provide guarded producer transitions. Semantic ranking requires matching file, model and embedding-contract provenance plus effective freshness. Legacy bundles become stale during the 0.3 upgrade, and old embeddings must be regenerated before they can rank.

Back up the database and install the 0.4.0 files before updating:

ALTER EXTENSION pgokf UPDATE TO '0.4.0';
SELECT extversion FROM pg_extension WHERE extname = 'pgokf';

The supplied chain covers earlier 0.1, 0.2, 0.3 and development versions. It reconciles superseded search overloads only when their exact definitions, grants and dependencies match the expected old catalog; an unexpected shape aborts the update. Do not force-drop dependent objects to bypass that guard. The declared older web-table column ordering is retained. SQL catalog changes and the separately deployed MCP/web companions must be upgraded according to their own contracts.

Version 0.5.0 companions and upgrade

Version 0.5.0 leaves catalog objects and data unchanged from 0.4.0; its supplied update script advances the extension version. After installing matching server files, use the ordinary upgrade path:

ALTER EXTENSION pgokf UPDATE TO '0.5.0';

The separate pgokf-confluence companion previews a complete Confluence Cloud space and writes a dedicated bundle only with --apply. It records producer provenance, uses a durable checkpoint and requires --allow-deletions for reviewed page removals. It is for a shared audience: Confluence page restrictions are not copied into PostgreSQL permissions. Keep its token in a private file or CONFLUENCE_API_TOKEN. Companion --tls / OKF_PG_TLS now enforces at least sslmode=require, refusing a server that declines TLS instead of silently falling back to plaintext; use stricter certificate verification when needed. These companion changes do not run Confluence ingestion or external embedding inside the extension backend.

0.6.0 companion release

The 0.5.0-to-0.6.0 SQL edge updates the extension receipt without changing catalog objects or data; use ALTER EXTENSION pgokf UPDATE TO '0.6.0' after installing matching files. The new private Confluence Forge application and pgokf-confluence-events receiver validate delivery identity and write deduplicable JSON-line events. They do not automatically record those events in the PostgreSQL catalog. Configure and operate these companions separately. The 0.6.0 distribution covered PostgreSQL 15–18 and tested PostgreSQL 19 RC2 separately.

0.7.0 Companion Connections

The catalog objects and data are unchanged from 0.6.0. After installing matching files, ALTER EXTENSION pgokf UPDATE TO '0.7.0' advances the extension receipt. The separate MCP, web and Confluence companions share a pooled connection lifecycle; pgokf-mcp replaces dropped connections instead of exiting. These changes require updating the relevant companion binaries separately from the database extension.

Table reader