Kdb gateway v0.0.13 vs pg17 pgdump

kdb-gateway v0.0.13 vs pg_dump v17 — Coverage Diff

Status: draft (20260511) · Ticket: infra/data/kdb#339 · Spec: pg-dump-v17.kmd · Captures: captures/ · kdb surface: infra/data/kdb/crates/kdb-pgwire/src/handler/pg_catalog_tables.rs

This is the *ap analysis*between the queries pg_dump --version 17 issues (captured in captures/pg-dump-v17-queries-*.sql) and the pg_catalog rows + functions that kdb-pgwire v0.0.13 currently exposes. Each row is mapped to a follow-up ticket in infra/data/kdb#341 (the implementation umbrella).

Severity legend:

  • *-CRITICAL*— pg_dump aborts the dump if missing.
  • *-IMPORTANT*— pg_dump skips the affected object class (e.g. no

    sequences in the dump) but the overall dump succeeds.

  • *COSMETIC*— pg_dump produces a slightly lessrich dump (missing

    COMMENT ON, missing privilege grants, etc.) but the schema is recoverable.

  • *-OK*— kdb already covers; included for inventory completeness.

1. Relations

Relation kdb v0.0.13 pg_dump v17 needs Severity Follow-up
pg_roles ✅ present oid, rolname R-OK
pg_extension ✅ present full row R-OK
pg_depend ✅ present full row R-OK
pg_namespace ✅ present nspacl + acldefault R-OK
pg_class ⚠ partial relispartition, relrowsecurity, relforcerowsecurity, relminmxid, relfrozenxid R-CRITICAL #341classrows
pg_proc ✅ present full row, filter prokind <> 'a' R-OK
pg_type ✅ present typacl, typtype, typrelkind R-OK
pg_language ✅ present lanispl filter R-OK
pg_attribute ⚠ partial attcompression, attmissingval, attstattarget, attstorage (must be "char"), attgenerated, attidentity R-CRITICAL #341attributev17
pg_constraint ✅ present confupdtype, confdeltype, confmatchtype, convalidated R-IMPORTANT #341constraintv17
pg_index ✅ present indcollation, indclass, indoption, indpred, indexprs R-IMPORTANT #341indexv17
pg_inherits ✅ present inhseqno R-OK
pg_description ✅ present full row R-OK
pg_publication ✅ present full row, empty OK R-OK
pg_settings ✅ present restrict_nonsystem_relation_kind row R-OK
pg_foreign_table ✅ present empty OK R-OK
pg_cast ❌ missing full row, empty OK R-IMPORTANT #341pgcast
pg_collation ❌ missing full row, empty OK R-IMPORTANT #341pgcollation
pg_conversion ❌ missing full row, empty OK R-IMPORTANT #341pgconversion
pg_default_acl ❌ missing full row, empty OK R-IMPORTANT #341pgdefault-acl
pg_event_trigger ❌ missing full row, empty OK R-COSMETIC #341pgevent-trigger
pg_init_privs ❌ missing full row, empty OK R-COSMETIC #341pginit-privs
pg_opclass ❌ missing opcname, opcfamily, opcintype, opcdefault R-IMPORTANT #341pgopclass
pg_operator ❌ missing full row, empty OK R-IMPORTANT #341pgoperator
pg_opfamily ❌ missing opfname, opfmethod, opfnamespace, opfowner R-IMPORTANT #341pgopfamily
pg_publication_namespace ❌ missing full row, empty OK R-COSMETIC #341pgpublication-namespace
pg_range ❌ missing full row, empty OK R-COSMETIC #341pgrange
pg_rewrite ❌ missing ev_class, rulename, ev_type, ev_qual, ev_action R-CRITICAL (views) #341pgrewrite
pg_seclabels ❌ missing full row, empty OK R-COSMETIC #341pgseclabels
pg_sequence ❌ missing seqstart, seqincrement, seqmax, seqmin, seqcache, seqcycle R-CRITICAL (sequences) #341pgsequence
pg_statistic_ext ❌ missing full row, empty OK R-COSMETIC #341pgstatistic-ext
pg_tablespace ❌ missing full row, empty OK R-IMPORTANT #341pgtablespace
pg_transform ❌ missing full row, empty OK R-COSMETIC #341pgtransform
pg_ts_* ❌ missing full row, empty OK R-COSMETIC #341pgts

2. Functions

Function kdb v0.0.13 Severity Follow-up
pg_is_in_recovery() ✅ present R-OK
pg_get_viewdef(oid) ⚠ stub returns "" R-CRITICAL (views) #341e
pg_get_indexdef(oid) ⚠ stub returns "" R-IMPORTANT #341fnpggetindexdef
pg_get_constraintdef(oid) ⚠ stub returns "" R-CRITICAL (constraints) #341f
pg_get_triggerdef(oid) ⚠ stub returns "" R-COSMETIC #341fnpggettriggerdef
pg_get_expr(node, relid) ⚠ stub returns "" R-IMPORTANT (defaults / partial idx) #341fnpggetexpr
pg_get_serial_sequence(table, col) ⚠ stub returns "" R-CRITICAL (SERIAL / IDENTITY) #341g
pg_options_to_table(text[]) ❌ missing R-COSMETIC (FDW) #341fnpgoptionsto_table
acldefault(char, oid) ❌ missing R-IMPORTANT (every ACL query embeds it) #341fnacldefault
array_remove(any[], any) ✅ present (fn_array_remove em kdb-planner/src/functions.rs:3516) R-OK — (#341h closed 20260511)

Note: array_remove is reachable by the same pg_class mega-query that drives the object loop; a stub that returns the input unchanged is enough for pg_dump to proceed (the rewrite values check_option=local|cascaded only matter for views with WITH CHECK OPTION and are nullable).

3. Session GUCs

GUC kdb behavior Severity Follow-up
search_path ✅ accepts SET R-OK
DATESTYLE = ISO ✅ accepts SET R-OK
INTERVALSTYLE = POSTGRES ✅ accepts SET R-OK
extra_float_digits = 3 ✅ accepts SET R-OK
synchronize_seqscans = off ✅ accepts SET R-OK
statement_timeout = 0 ✅ accepts SET R-OK
lock_timeout = 0 ✅ accepts SET R-OK
idle_in_transaction_session_timeout = 0 R-OK
transaction_timeout = 0 ⚠ unknown R-COSMETIC #341guctransaction_timeout
row_security = off ✅ accepts SET R-OK
restrict_nonsystem_relation_kind ❌ absent R-COSMETIC (PG 17 hardening flag) #341gucrestrict-nsk

4. Wire-protocol features

Feature kdb v0.0.13 Severity Follow-up
BEGIN; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY ✅ present R-OK
LOCK TABLE … IN ACCESS SHARE MODE ⚠ partial (parsed, may be no-op) R-IMPORTANT #341locktableasnoop
COPY <table> TO STDOUT ✅ shipped in v0.0.14 (#340) R-OK
CopyOutResponse + CommandComplete("COPY n") framing R-OK

5. Summary

Bucket Count
R-CRITICAL gaps 6 (was 7; -1 = array_remove already present)
R-IMPORTANT gaps 13
R-COSMETIC gaps 12
R-OK 24 (was 23; +1 = array_remove)

Closed since the diff was first written (20260511):

  • *341a*✅ — pg_class PG 17 columns landed (commit 6056a33bbe).
  • *341b*✅ — pg_attribute PG 17 row shape landed (commit 4f1aa7c334).
  • *341h*✅ — array_remove discovered to already be present

    (kdb-planner/src/functions.rs:3516); diff entry corrected.

Remaining R-CRITICAL: pgrewrite, pgsequence, pggetviewdef, pggetconstraintdef, pggetserialsequence (5). The pgget_*def functions exist as stubs that return "" — they need real implementations, not new registrations.

To make pg_dump --schema-only --no-owner --no-acl against kdbgateway succeed endto-end on the audit schema, the * critical items*above MUST land in infra/data/kdb#341:

  1. pg_class extra columns (relispartition, RLS bools, relminmxid,

    relfrozenxid).

  2. pg_attribute v17 row shape (attcompression, attmissingval,

    attstattarget, attstorage as "char", attgenerated, attidentity).

  3. pg_rewrite table (drives view body materialization).
  4. pg_sequence table (sequence parameters).
  5. pg_get_viewdef(oid) function.
  6. pg_get_constraintdef(oid) function.
  7. pg_get_serial_sequence(table, col) function.
  8. array_remove(any[], any) function (stub returning input

    unchanged is enough).

R-IMPORTANT items unblock specific object classes (operator classes, collations, tablespaces, …) and should be tackled in priority order of how often each object class appears in real-world Postgres schemas — but none of them block the smoke-test schema in the audit.

RCOSMETIC items only matter for highfidelity dumps and can be implemented opportunistically.

Source: ../home/koder/dev/koder/meta/docs/stack/specs/postgres-compat/kdb-gateway-v0.0.13-vs-pg17-pgdump.md