Skip to content

pgquerynarrative

SQL integration with the external PgQueryNarrative investigation service

pgquerynarrative · SQL integration with the external PgQueryNarrative investigation service

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102020pgquerynarrativepgquerynarrative1.1FEATMITSQL

PostgreSQL · 16, 17, 18

Relationships
Requiresplpgsql

Usage

Sources:

pgquerynarrative 1.1 calls a running PgQueryNarrative service from SQL. It is separate from the in-database investigation extension pqn.

Core Workflow

As a superuser, install the HTTP dependency before the wrapper and grant access to an existing role. Configure a reachable, trusted service endpoint.

CREATE EXTENSION http;
CREATE EXTENSION pgquerynarrative;
SELECT pgquerynarrative_set_api_url('http://localhost:8080');
SELECT pgquerynarrative_grant_access('app_reader');

API and Boundaries

pgquerynarrative_set_api_key sets each caller’s session credential. pgquerynarrative_run_query runs a read-only query through the service; pgquerynarrative_generate_report requests a report, and pgquerynarrative_list_saved lists saved queries. pgquerynarrative_revoke_access removes access.

Without http at install time, the extension creates pending-response functions rather than real HTTP calls. Adding the dependency later does not rewrite those functions automatically. Version 1.1 revokes function execution from PUBLIC; the owner controls the stored API URL. Statements containing API-key literals may enter query logs, and SQL is transmitted to the service. The server’s authorization and result limits still apply. PostgreSQL 16–18 is the documented service range; no preload is needed for these SQL wrappers.

Table reader