Skip to content

This is the multi-page printable view of this section.

Return to the regular view of this page

Blog

Design notes, research results and release news from the Mimus project.

These articles cover the versions under study when they were written, including the earlier PG18 and OrioleDB experiments. For the current kernel, extensions and release status, see Mimus 19.0.1 verification .

1 - One kernel, many protocols

What a week of porting and merging PostgreSQL forks taught us about a multi-protocol PostgreSQL, and why Mimus ships in two steps.

Several PostgreSQL forks each teach PostgreSQL one foreign language: openHalo speaks MySQL, Babelfish speaks SQL Server, IvorySQL speaks Oracle. Each is a separate kernel with its own release cycle, its own extension builds and its own users. Mimus asks a simpler question: can one PostgreSQL kernel carry these languages as loadable parts, on the same data, without becoming another fork that nothing else runs on?

In the first week of November 2026 we tried it.

MySQL no longer needs a fork

openHalo 1.0 implemented MySQL compatibility by changing about 320 files of PostgreSQL 14. Porting it to PostgreSQL 18, we moved everything MySQL-specific into one extension, aux_mysql, and kept a small generic kernel patch: 12 files that let an extension listen on another port and drive a regular backend. The patch knows nothing about MySQL. It changes no catalog, no parse node and no function signature, and stock PGDG builds of PostGIS, pgvector, Citus, TimescaleDB and pg_cron load unchanged. The same patch applied to PostgreSQL 19rc1 with one conflict.

That result became OpenHalo 18 . An adversarial review then found real defects in the ported code, so it is a development preview, not a release. The architecture held up; the details need work.

Not every protocol belongs in the kernel

MySQL and SQL Server are session protocols: one connection, one session, one backend process. Redis, etcd and S3 are different. Their clients open thousands of connections and keep watches and subscriptions open. PostgreSQL’s process-per-connection model is the wrong place to terminate them. pgredis, pgetcd and pgsilo therefore put the data model in an extension or schema and terminate the protocol in a gateway that multiplexes connections. They run on stock PostgreSQL, and they join Mimus through packaging, configuration and shared operations, not kernel changes.

So the kernel opens exactly one door, for session protocols. See Architecture .

The hard part is ABI, not code

We merged Percona’s storage patches, OrioleDB and Babelfish onto one PostgreSQL 18.6 tree and loaded MySQL, TDS, OrioleDB and pg_tde in one instance. Every suite passed. Running is not the problem.

Binary compatibility is. Babelfish changes parse-node layouts and renumbers node tags; OrioleDB reorders the table access method interface. With either in the kernel, stock extension packages crash or fail, and every extension has to be rebuilt for Mimus. That turns Mimus into a separate major version in every build matrix.

Hence the plan in the roadmap :

  • Mimus 1 keeps PostgreSQL’s ABI: the protocol hook plus Percona’s storage patches. MySQL, Redis, etcd and S3, with the existing extension packages.
  • Mimus 2 adds SQL Server and accepts its own ABI and build matrix.
  • OrioleDB stays a separate flavor until upstream PostgreSQL offers the interfaces it needs.

What we have not proven

The promise of Mimus is that a MySQL or SQL Server client can use what PostgreSQL extensions provide: PostGIS geometry, pgvector search, Citus distribution. Nobody has tested that yet. Unified authentication across five credential schemes, behaviour during failover, and the cost of the protocol hook are open too. Verification status keeps the list.

This site collects what exists and marks what does not. Each protocol section says where its source project stands.

2 - Merging four PostgreSQL forks into one kernel

Why merging Percona pg_tde, OrioleDB, Babelfish and OpenHalo onto PostgreSQL 18.6 was easy to run, what broke at runtime, and why ABI compatibility forced a two-tier roadmap.

Several PostgreSQL forks add major server capabilities: Percona Server for PostgreSQL adds storage hooks for pg_tde encryption, OrioleDB adds an index-organized storage engine with undo MVCC, Babelfish adds SQL Server wire and T-SQL support, OpenHalo 18 adds MySQL compatibility, and IvorySQL adds Oracle compatibility. Maintaining a separate kernel binary and extension matrix for each fork multiplies packaging and operational work.

On 2026-11-07, we tested a direct question on PostgreSQL 18.6 (REL_18_6, commit 724edf9b, EL9 aarch64, --enable-debug --enable-cassert): can one PG 18.6 kernel carry all of these patches at once, behave like stock PostgreSQL when nothing is preloaded, and load any combination of extensions on demand?

The experiment gave a sharp answer: getting four of the five forks to compile and run together in one instance was straightforward; keeping binary compatibility (ABI) with the PostgreSQL extension ecosystem was not. That distinction between “it runs” and “it preserves the ABI” is why Mimus ships in two tiers (Unified base research , ABI compatibility ).

Which forks fit into a shared kernel, and why IvorySQL does not

We first profiled each fork’s non-test src/ diff against PG 18.6 (REL_18_6, 2026-08-11):

Fork / patch setRevision on PG 18.6Non-test src/ diffNew hooksStructsSignatures¹Catalog / formatGated²
Protocol hookc4b3cbe12 files, +357/−180 (registry)1 (ClientSocket)0None88%
Percona (pg_tde 2.2.1)release-18.6.1 (19c3033d)41 files, +689/−2680 (registries)1 (SMgrRelationData)2 (mdcreate, heap_create)None (WAL encrypted when on)76%
OrioleDB (1.10.2 / b4f9683)patches18 (cc8c1483)212 files, +5,901/−1,50431232524-byte xl_running_xacts tail; new TOAST vartag60%
Babelfish 6.2BABEL_6_2_STABLE__PG_18_6 (6ba0d062)268 files, +14,000/−7211433110None (2 kernel GUCs)78%
IvorySQL 5.6IvorySQL_5.6 (74c405c9)672 files, +122,216/−3,4381149 + catalogs1+Alters pg_attribute, pg_class, pg_proc, pg_control; 3 tables; 22 GUCs38%

¹ Parameter-count changes across headers and .c definitions. ² Upper-bound share of added hunks guarded by a hook pointer or dialect switch.

The first four forks keep their bulk in loadable extensions (orioledb ~139k lines, babelfish_extensions ~218k lines, pg_tde ~12k lines, aux_mysql ~83k lines of C/SQL) and do not change catversion or system catalog layouts.

IvorySQL 5.6 is a true kernel fork: it adds columns to pg_attribute (attisinvisible), pg_class (relhasrowid) and pg_proc (3 columns), adds three system tables (pg_package, pg_package_body, pg_force_view), alters pg_control (dbmode, casemode), compiles PL/iSQL (47,750 lines) into the core tree, and scatters 314 compatible_mode / DB_ORACLE branches across 67 kernel files (428 existing files modified). Merging IvorySQL onto the unified tree produced 71 text conflicts across 45 files and would force every cluster into IvorySQL’s catalog format. Mimus keeps IvorySQL as a separate flavor (our 12-file protocol hook applies with 2 context conflicts) and uses orafce for Oracle functions.

Merging the code: 23 text conflicts vs 11 hidden runtime conflicts

Three-way text merge

Merging Percona release-18.6.1, OrioleDB patches18 and Babelfish 6.2 onto PG 18.6 (git merge-tree --merge-base=REL_18_6) produced 23 conflict blocks across 22 files:

  • 10 adjacent additions: independent hooks, declarations or struct fields at the same line (heapam_visibility.c, xact.c, elog.c, transam.h).
  • 7 expression merges: e.g., OrioleDB passing buffer by value in heapam.c while Babelfish added relation to HeapTupleSatisfiesUpdate(); Percona calling RelationCreateStoragePercona() while Babelfish passed !IsTsqlTableVariable(rel).
  • 2 constant collisions: OrioleDB’s PERFORM_DELETION_OF_RELATION and Babelfish’s PERFORM_DELETION_SKIP_ENR both used 0x0040 in dependency.h (Babelfish moved to 0x0080).
  • 2 AIO registration blocks (aio.h, aio_callback.c): Percona’s dynamic callback allocator starts at OrioleDB’s first reserved slot.

For MySQL, aux_mysql compiled against Babelfish’s ProtocolExtensionConfig plus a 2-file (+36/−5) delta adding fn_parse_query and PROTOCOL_EXTENSION_FALLTHROUGH, avoiding the 6-file overlap with our 12-file hook.

The 11 compile-time and runtime conflicts git did not see

Running one mode per instance does not avoid cross-fork bugs: all kernel patches stay active in postgres. Static analysis, compilation (--enable-debug --enable-cassert) and runtime tests found 11 hidden conflicts (+30/−10 lines in the kernel, +22/−11 in OrioleDB, +17/−10 in Babelfish’s extensions):

IDStageSymptomRoot cause and fix
H1Static scantrigger.c:6836 compile errorOrioleDB changed afterTriggerAddEvent() from 3 to 5 args; Babelfish passed 3 (NULL, NULL added)
C1Kernel build4 -Wint-conversion in trigger.c (GCC ≥ 14 error)OrioleDB changed trigger tupleid to Datum; Babelfish’s ExecIR*TriggersTSQL passed ItemPointer (updated to Datum)
C2Extension buildBabelfish forjson.c fails (-Werror)OrioleDB defined TABLE_SIZE in tableam.h, colliding with forjson.c (renamed in Babelfish)
R1Runtime (pg_tde + OrioleDB)OrioleDB CREATE TABLE fails with pg_tdepg_tde disables RelationCreateStorage(); updated 3 OrioleDB calls to RelationCreateStoragePercona()
R2Runtime (OrioleDB + Babelfish)T-SQL CREATE TABLE on orioledb fails (SI ID: -7)Babelfish’s SIMessageIsForTempTable() errored on OrioleDB (-7) and PG 18 (-6) invalidation IDs (return false)
R3Runtime (OrioleDB alone)Every OrioleDB DROP TABLE fails (missing entries in o_indices), even without BabelfishBabelfish’s RemoveRelations() called InvokeObjectDropHook early whenever object_access_hook was set, making OrioleDB delete index entries twice. Added pre_drop_relation_hook
R4Runtime (OrioleDB + Babelfish)T-SQL error cleanup hits Assert("DoLocalLockExist(&locktag)")Babelfish skips locks on ENR tables; OrioleDB’s drop hook asserted a lock on every relation (scoped to OrioleDB tables)
R5Runtime (Babelfish + non-heap)T-SQL @table and #temp fail (OID 2601 in ENR) on tde_heap or orioledbBabelfish’s ENR catalog requires heap (unfixed; keep default_table_access_method = heap in Babelfish DBs)
R6ConfigurationCREATE EXTENSION pg_tde in Babelfish DB uses information_schema_tsqlFirst schema on Babelfish’s search_path (specify SCHEMA public)
R7Runtime (aux_mysql + pg_tde)MySQL ALTER TABLE … ENCRYPTION='Y' wrote plaintext tde_heapaux_mysql used PROCESS_UTILITY_SUBCOMMAND, skipping pg_tde’s ddl_command_start trigger (switched to PROCESS_UTILITY_QUERY)
R8Configuration (TDS + MySQL)TDS login fails on scram-sha-256 HBA rulesBabelfish TDS requires md5 or password HBA rules

R3 shows why static hook-chaining checks are not enough: all four extensions chained ProcessUtility_hook, shmem_request_hook, shmem_startup_hook and object_access_hook properly, yet Babelfish changed when object_access_hook fired inside RemoveRelations(), breaking OrioleDB even without Babelfish loaded.

All four capabilities running in one instance

With those fixes applied on 2026-11-07 (EL9 aarch64, --enable-debug --enable-cassert), one instance preloading orioledb, pg_tde, babelfishpg_tds, aux_mysql listened on ports 5432, 1433 and 3306 simultaneously:

  • Regression suites: core PG passed 233/233 and isolation 123/123; pg_tde passed 14/14; OrioleDB passed 42/52 (matching the unpatched OrioleDB baseline); T-SQL AFTER and INSTEAD OF triggers passed on heap, tde_heap and orioledb; and aux_mysql passed in full.
  • Cross-feature DDL and queries: from MySQL on port 3306, CREATE TABLE ... ENGINE=OrioleDB created an OrioleDB table, and CREATE TABLE ... ENCRYPTION='Y' created an encrypted tde_heap table verified free of plaintext on disk. One SQL query joined orioledb, tde_heap and heap tables.
  • Encryption boundary (pg_tde × OrioleDB): pg_tde.wal_encrypt = on encrypted WAL records for both tde_heap and orioledb tables in pg_wal/ and recovered 6,000 rows per table after an immediate stop. Because OrioleDB bypasses smgr (o_buffers / FileWrite), files under orioledb_data/ remained in cleartext.

Why “it runs” is not enough: ABI and extension packages

Building the server and four extensions from source proves source coexistence, not binary compatibility with existing packages.

On 2026-11-07, we ran libabigail’s abidiff against stock PG 18.6 / 18.4 builds with identical configure flags, and tested precompiled PGDG and Pigsty PG 18 packages in each variant (ABI compatibility , Extension matrix ):

Kernel variantabidiff structsabidiff signaturesNodeTagStock PGDG / Pigsty PG 18 packagesSource rebuild against headers
Protocol hook1 (ClientSocket)0479All 11 C/Rust packages pass ✅Not needed
Percona 18.4.21 (SMgrRelationData)2 (heap_create, mdcreate)479All pass ✅ (TimescaleDB 18.4/18.6 diff)Rebuilds cleanly ✅
OrioleDB (patches18)2311 changed, 1 removed479pgvector, VectorChord, vchord_bm25, pg_search, Citus, TimescaleDB crash 💥pgvector passes ✅; Citus 14.3, TimescaleDB 2.31, VectorChord fail ❌
Babelfish 6.231 (FuncExpr, SelectStmt, Port)5479 → 480Citus crashes 💥; pg_search fails ❌Citus, VectorChord (pgrx 0.19.3) rebuild and pass ✅
Merged base5531 changed, 1 removed479 → 480Inherits all crashes and errors 💥Fails to compile Citus, TimescaleDB, VectorChord ❌

Two mechanisms explain the failures:

  1. Babelfish shifts parse-node numbers and Port offsets: PostgreSQL pins $last_nodetag_no = 479 in gen_node_support.pl to preserve the stable-branch ABI. Babelfish bumps it to 480, shifting T_OidList from 472 to 473. Precompiled C and Rust extensions that check node tags fail at runtime: Citus crashes on list->type == T_List, and pg_search fails with PgList does not contain oids. Babelfish also inserts protocol_config into Port (shifting 30 fields) and enlarges FuncExpr (+3 fields) and SelectStmt (+8 fields). Preloading babelfishpg_tds also alters 2 upstream role regression tests (9 when initialized).
  2. OrioleDB alters access-method structs and signatures: OrioleDB keeps $last_nodetag_no = 479, but inserts 5 callbacks into IndexAmRoutine, 6 into TableAmRoutine, and lastCommittedCSN into PGPROC. Stock index extensions allocate a smaller IndexAmRoutine and crash on amoptions != NULL. Worse, OrioleDB removes tuple_insert_speculative, alters table_tuple_delete and changes index_fetch_tuple from ItemPointer to Datum tupleid plus is_rowid—breaking compilation for Citus columnar, TimescaleDB compression and VectorChord.

Compatibility levels A and B, and the Mimus roadmap

Our ABI study defined two coexistence targets:

  • Level B (source compatible): extensions compile without source edits (existing functions and callbacks keep signatures; new features use *_ext functions and sidecar tables).
  • Level A (binary compatible): precompiled PGDG and Pigsty packages load unchanged (all of Level B, plus zero layout changes to public structs: append fields only to kernel-private structs, move new PGPROC / ReplicationSlot fields into sidecar shared-memory arrays, and keep $last_nodetag_no = 479).

Rewriting OrioleDB’s 23 struct and 11 signature changes to follow the add-only rule was roughly estimated at 2–4 person-weeks for Level B and 2–3 person-months for Level A (rough estimates for an engineer familiar with OrioleDB internals, not commitments, and not yet prototyped; see OrioleDB ). Carrying that rewrite would create a permanent fork unless upstream OrioleDB merged it.

Release cadence reinforces the split. After PG 18.6 shipped on 2026-08-11, Percona rebased in +1 day (2026-08-12), OrioleDB and IvorySQL in +22 days (2026-09-02), and Babelfish in +48 days (2026-09-28). On PG 19rc1, the protocol hook and Percona patches are already rebased, while Babelfish, OrioleDB and IvorySQL have no PG 19 branch yet (PostgreSQL 19 ).

Mimus therefore splits its kernel roadmap along the ABI boundary:

  • Mimus 1 (Level A, binary compatible): PG 18.x + the 12-file protocol hook + Percona storage patches (with add-only wrappers). It runs MySQL (aux_mysql), pg_tde, and the Redis, etcd and S3 gateways, loads stock PGDG / Pigsty packages unchanged, and ships with upstream PostgreSQL (~1–2 person-days per minor release).
  • Mimus 2 (adds SQL Server, independent ABI): adds Babelfish (using Babelfish’s protocol API + the 2-file MySQL delta) and rebuilds its extension matrix against Mimus 2 headers (~3–5 person-days per minor release after Babelfish rebases).
  • OrioleDB and IvorySQL: remain separate flavors until upstream PostgreSQL adopts the storage and catalog interfaces they require.

3 - MySQL compatibility as a PostgreSQL 18 extension

How OpenHalo 18 replaced a 320-file PostgreSQL 14 kernel fork with a 12-file protocol hook and the aux_mysql extension, preserved the PostgreSQL 18 ABI, and what an adversarial review uncovered.

openHalo 1.0 taught PostgreSQL 14 to speak the MySQL wire protocol and SQL dialect by modifying roughly 320 files inside the PostgreSQL kernel. When we brought MySQL compatibility to PostgreSQL 18.6, we took a different route: keep a small, protocol-agnostic hook in the kernel and move every line of MySQL wire handling, grammar, parse-tree rewriting and runtime semantics into a loadable extension (aux_mysql).

This note records the design and findings from the 2026-11-07 porting study and the adversarial review of OpenHalo 18 (v18.6, commit 60e7a225). For the current state of fixes and open issues, see MySQL status .

Why openHalo 1.0 could not simply rebase to PostgreSQL 18

An audit of the openHalo 1.0 tree (v1.0-pg14, commit f9aedb8, closest to upstream REL_14_13 and later merged with REL_14_18) showed why a direct rebase across four major PostgreSQL releases was impractical:

AreaopenHalo 1.0 (v1.0-pg14)Impact on porting and maintenance
Kernel diff~320 modified files (~12,000 lines changed) plus ~110,000 added lines in src/Forked copies of the PG 14 analyzer and executor (mys_gram.y ~24k lines, mys_tablecmds.c ~17k lines) had to be re-forked on every major upgrade
Extension ABIAltered DestReceiver signatures, added a column to pg_proc, set N_ACL_RIGHTS = 14Broke binary compatibility with stock PostgreSQL 14 extensions
Built-in typesHardcoded MySQL protocol branches inside bool, float, numeric, varlena and likeMixed foreign dialect rules into core execution paths
Native parserModified the core PG parser to accept backticks, "..." strings, \' escapes and DATE(text)contrib/aux_mysql (~35k lines of SQL + mysm C library) could not install on an unmodified PG parser
Legacy remnantsTrimmed from commercial Halo; kept Oracle fields (proaccess), backported MERGE and TDS tagsExtra surface area to untangle against native PG 15–18 features

Between PostgreSQL 14 and 18, MERGE landed natively, Value nodes became A_Const unions, returningList became ReturningClause, GrantRoleStmt and PartitionStrategy changed, varatt.h split out, and dozens of analyzer and executor signatures shifted. Rebasing 320 scattered kernel files would have produced another isolated fork that could not load PGDG extension packages, and the same cost would recur on PostgreSQL 19. See From openHalo 1.0 .

A 12-file protocol hook and the aux_mysql extension

OpenHalo 18 splits the system into two layers: a generic kernel patch that knows nothing about MySQL, and the aux_mysql extension (contrib/aux_mysql, named halo_mysql in the prototype) that carries all MySQL behavior.

PostgreSQL 18.6 + protocol extension hooks (12 files, +357/-18)
  postmaster: listens on 5432 (libpq) and 3306 (MySQL) -> regular backends
  backend:    start -> authenticate -> read_command -> parse_query -> execute -> DestReceiver
       |
aux_mysql (contrib/aux_mysql)
  mysql_proto.c   MySQL wire packets, text/binary result sets, SQLSTATE -> MySQL errno
  mys_auth.c      caching_sha2_password (fast-auth cache, TLS / RSA-OAEP full auth)
  mys_stmt.c      COM_STMT_PREPARE / EXECUTE / CLOSE / RESET / SEND_LONG_DATA
  mys_txn.c       autocommit, implicit commits, statement rollback via savepoints
  parser/         openHalo MySQL grammar (mys_gram.y + mys_scan.l, ~29.5k lines)
  mys_rewrite.c   raw parse-tree rewrite before pg_analyze_and_rewrite
  mys_utility.c   ProcessUtility_hook for MySQL DDL and ENGINE= / ENCRYPTION= mapping
  mysm/ + sql/    openHalo C runtime (~15.4k lines) and SQL catalog (~35k lines)

The kernel protocol hook

The protocol hook (pg18-protocol-hooks.patch, commit c4b3cbe on PostgreSQL 18.6) modifies 12 files (+357/−18 lines, including 181 lines in the new protocol_extension.c and protocol_extension.h). It intercepts only the boundary where a backend talks to its client:

  • Listener registration (postmaster.c, protocol_extension.c): RegisterProtocolExtension() and ListenServerPortForProtocol() bind port 3306 in _PG_init and pass ClientSocket.protocol_id to forked backends.
  • Startup and authentication (backend_startup.c, postinit.c): start performs the foreign handshake and sets MyBackendType = B_BACKEND; authenticate replaces ClientAuthentication() once shared catalogs are readable.
  • Command loop and client-only parser (postgres.c): read_command and process_command route COM_QUERY through exec_simple_query() and handle other COM_* packets in the extension. parse_query inside pg_parse_client_query() replaces the parser only for top-level client queries—SQL function bodies, SPI and extension scripts still use pg_parse_query().
  • Output and error reporting (dest.c, elog.c, guc.c): create_dest_receiver, end_command, null_command and send_ready_for_query encode MySQL result sets and OK/EOF packets; send_message maps SQLSTATE to MySQL error numbers; report_param_status suppresses libpq ParameterStatus packets.

Because every MySQL connection is a standard PostgreSQL backend, max_connections, pg_stat_activity, pg_hba.conf, query cancellation and secure_open_server() TLS (ssl_*, hostssl, pg_stat_ssl) work out of the box. Native libpq connections pay only a MyProtocolExtension == NULL check.

Moving MySQL semantics out of the kernel

To leave PostgreSQL’s analyzer, planner, executor and system catalogs untouched, aux_mysql combines four mechanisms (How it works ):

  1. Scripted grammar and SQL porting: tools/port_grammar.py rewrites openHalo’s ~29,500-line mys_gram.y and mys_scan.l to emit PG 18 parse nodes. tools/port_aux_sql.py translates openHalo’s 35,000-line aux_mysql SQL catalog (~1,800 functions, ~500 operators, ~180 tables/views, ~70 types) into standard PostgreSQL syntax.
  2. Raw parse-tree rewriting (mys_rewrite.c): the grammar emits out-of-core enum tags (AT_ModifyColumn, CONSTR_AUTOINC, ONCONFLICT_REPLACE). Before pg_analyze_and_rewrite(), mys_rewrite.c translates them into identity columns, ON CONFLICT clauses, @user / @@system function calls and COLLATE mysql.case_insensitive clauses.
  3. DDL utility hook (mys_utility.c): ProcessUtility_hook handles MySQL ALTER TABLE ... MODIFY / CHANGE / ADD INDEX / DROP PRIMARY KEY, SHOW, USE <schema> and ENGINE= / ENCRYPTION='Y' access-method mapping.
  4. Authentication, prepared statements and transactions (mys_auth.c, mys_stmt.c, mys_txn.c): ~3,400 lines of new C code implement MySQL 8’s default caching_sha2_password (shared-memory fast-auth cache plus TLS or RSA-OAEP full auth verified against pg_authid.rolpassword SCRAM/MD5 verifiers), COM_STMT_* binary prepared statements, autocommit, implicit DDL commits and savepoint-based statement rollback—without changing a line of the 12-file kernel patch.

ABI preservation and cross-kernel portability

Keeping dialect semantics out of the kernel preserves binary compatibility with existing extensions. On 2026-11-07 (EL9 aarch64, --enable-debug --enable-cassert), abidiff compared the protocol hook against other multi-dialect PG 18 forks:

KernelNon-test src/ diffabidiff changesNodeTagStock PG 18 packages
Protocol hook (pg18-protocol-hooks)12 files, +357/−181 internal struct (ClientSocket +8B), 0 signatures479All 11 C/Rust packages pass
Babelfish 6.2 (PG 18.6)277 files, +14,057/−73431 structs (FuncExpr, SelectStmt, Port), 5 signatures479 → 480Citus crashes; pg_search fails
IvorySQL 5.6 (PG 18.6)2,782 files, +887,695/−5,18849 structs + pg_attribute, pg_class, pg_proc columnsChangedIncompatible without rebuild
openHalo 1.0 (PG 14)~320 files + ~110k added linesDestReceiver, pg_proc, N_ACL_RIGHTS—Incompatible with stock PG 14

The protocol hook changes no parse node, no catalog table and no exported function signature. Its only structure change appends int protocol_id to ClientSocket in src/include/libpq/libpq-be.h (sizeof(ClientSocket) grows from 144 to 152 bytes), a structure passed only between postmaster.c, launch_backend.c and backend_startup.c. Stock PGDG and Pigsty PG 18 packages—PostGIS 3.6, pgvector 0.8, Citus 14.3, TimescaleDB 2.31, pg_cron, orafce, VectorChord, vchord_bm25, pg_search, pg_graphql and pgs3—loaded and passed smoke tests unchanged (ABI compatibility , Extension matrix ).

On 2026-11-07 (EL9 aarch64, --enable-debug --enable-cassert), the hook and extension also ported across five other PostgreSQL trees (On other kernels , PostgreSQL 19 ):

  • OrioleDB (patches18_4 on PG 18.6) and Percona Server for PG 18.4.2: 0 conflicts. Mapping ENGINE=OrioleDB to orioledb and ENCRYPTION='Y' to pg_tde’s tde_heap exposed a cross-extension bug: pg_tde decides whether a new file is encrypted in a ddl_command_start event trigger, whereas aux_mysql ran decomposed ALTER TABLE commands with PROCESS_UTILITY_SUBCOMMAND, skipping event triggers and writing ALTER TABLE ... ENCRYPTION='Y' files in cleartext. Switching mys_utility.c to PROCESS_UTILITY_QUERY fixed the bypass.
  • IvorySQL 5.6 (PG 18.6): 2 context conflicts. After dropping aux_mysql’s unused sys schema, keeping existing varchar → bigint casts and combining shared_preload_libraries, one instance served Oracle (1521), MySQL (3317) and PostgreSQL (5443).
  • Babelfish 6.2 (PG 18.6): adapted to Babelfish’s ProtocolExtensionConfig with a 2-file (+36/−5) delta (fn_parse_query, PROTOCOL_EXTENSION_FALLTHROUGH).
  • PostgreSQL 19rc1: 1 conflict in backend_startup.c (ProcessStartupPacket() dropped two arguments); the 19rc1 kernel passed 239/239 regression tests, while aux_mysql had 47 compile errors from PG 19 API changes.

What the adversarial review found in v18.6

On 2026-11-07, an adversarial review evaluated OpenHalo 18 tag v18.6 (60e7a225, OpenHalo layer c380da3) against stock PG 18.6 and openHalo 1.0 (v1.0-pg14 / f9aedb8) on EL9.8 aarch64 (--enable-debug --enable-cassert --with-openssl --with-icu).

While core PG make check (231/231), isolation (122/122) and the check-world SQL subset (688/688) passed and standard drivers (Connector/J 8.4.0, go-sql-driver v1.9.3, PyMySQL v1.1.1, mysql CLI, sysbench 1.0.20) connected, the review rejected v18.6 as a stable release baseline, identifying 11 Category A product blockers and 3 verification/documentation gates:

IDFinding in v18.6 (60e7a225)Origin vs 1.0 (f9aedb8)
F01ALTER TABLE ... AUTO_INCREMENT on a partitioned parent table triggers SIGSEGV in table_is_empty and resets all sessions18 crash regression (1.0 did not crash, though start value had no effect)
F02AUTO_INCREMENT high-water mark moves backwards when is_called=false or via UPDATE-only mysql.setval()18 regression (1.0 generated 100 and kept last_value = 100)
F03Concurrent nextval + explicit ID inserts deadlock (1213) when sequence_advance upgrades to ExclusiveLock18 regression (1.0 committed both transactions)
F04aDefault aux_mysql setup worker races with pg_dump restores and perturbs pg_visibility TAP tests18 new integration defect (1.0 installed manually)
F05CREATE TABLE ... LIKE omits the AUTO_INCREMENT sync trigger, causing duplicate keys after explicit inserts18 regression
F06aSHOW CREATE TABLE emits literal \n and omits AUTO_INCREMENT (SHOW COLUMNS omits Extra)18 regression
F07UNSIGNED AUTO_INCREMENT drops the unsigned domain without a non-negative CHECK, accepting -118 regression (1.0 rejected -1)
F09aALTER TABLE ... ADD COLUMN without COLLATE forces table_ci = true on binary tables18 regression
F11BLOB / VARBINARY binary parameters (0x00, 0x80, 0xff) fail UTF-8 validation18 regression
F13COM_STMT_EXECUTE reports decimals = 0 for DATETIME(3) and DATETIME(6), truncating fractional seconds18 new protocol defect (1.0 failed during Prepare)
N01COM_RESET_CONNECTION returns OK without rolling back open transactions or clearing @user variables18 regression on rollback and user variables
G01–G03tests/run.sh ignores errors in m1–m4 and sysbench; docs overstate “zero ABI change” (ClientSocket 144 → 152B); check-world times out (RC=124)18 verification and doc gates

Comparison against openHalo 1.0 also separated Category B findings: 18 regressions in single-statement ALTER auto-increment start values (F08), missing ENUM/SET (F10), CHAR(n) trailing spaces (F12), negative TIME (N02), FLOAT wire type 5 (N03) and missing SHOW WARNINGS (N04); new 18 integration gaps in Meson builds (F14) and mysql.max_allowed_packet (F16a); and issues inherited from 1.0 (NO_BACKSLASH_ESCAPES status bit F15, SHOW CREATE omitting ON UPDATE F06b, and 1.0.14.18 version string blocking pg_upgrade N05).

In external suites on v18.6, go-sql-driver v1.9.3 passed 49/72 server tests (21 failed, 2 skipped), PyMySQL v1.1.1 passed 123/175 (39 failed, 12 skipped, 1 xfail), and sysbench 1.0.20 ignored 42 and 264 errors in read-write and write-only runs. Clearing the Category A blockers and gates was roughly estimated at 20–35 person-days (rough estimate, not a commitment).

Takeaways

The 2026-11-07 study and review established two conclusions:

  1. The architectural boundary holds. MySQL compatibility does not need a 320-file kernel fork; a 12-file protocol hook runs the MySQL protocol, parser and runtime inside an extension while keeping PostgreSQL 18’s extension ABI intact.
  2. OpenHalo 18 v18.6 is a development preview. Replacing forked kernel code with parse-tree rewrites, triggers and new wire protocol routines introduced defects in sequence monotonicity, DDL round-trips, binary parameters and connection reset.

Local commits have since addressed the Category A blockers and several Category B gaps. Follow the current status in MySQL status and MySQL compatibility .

4 - The kernel patches pg_tde needs and their upstream prospects

A breakdown of the 650-line Percona kernel patch set behind pg_tde, its upstream Commitfest and mailing-list history, and what that means for Mimus across PostgreSQL 18, 19 and 20.

Percona’s pg_tde extension implements transparent data encryption (TDE) for PostgreSQL heap tables, indexes and WAL. An early community mode (tde_heap_basic, which left indexes in cleartext) was deprecated in March 2025 and removed from pg_tde 2.2.x. Running pg_tde on PostgreSQL 18 therefore requires the kernel patch set in Percona Server for PostgreSQL (PSP_REL_18_STABLE).

On 2026-11-07, we audited that patch set against stock PG 18.4, PG 19rc1 and PG 20 master, and traced every related thread on pgsql-hackers and the Commitfest. This post records our findings and conclusions for Mimus (Storage patches for pg_tde ).

Fact vs inference convention

Statements below are sourced facts (with commit hashes or links) unless labeled Inference. Items searched for in archives and Commitfests without finding a primary source are labeled Not found.

The 650-line patch set in four parts

Comparing Percona Server for PostgreSQL release-18.4.2 (commit be009d6) against stock PG 18.4—and cross-checking the 20 Percona commits on PSP_REL_18_STABLE (release-18.6.1, commit 19c3033d) and PSP_REL_19_STABLE (rebased onto 19rc1 on 2026-10-14)—shows that the kernel changes under src/ touch 35 files (+650/−252 lines), plus build files, 6 contrib modules and test outputs. (src/include/libpq/libpq-be.h is not touched by Percona; that 1-line change belongs to the Mimus protocol hook .)

PartKernel changes in src/How pg_tde 2.2.2 uses itStock ABI effect (abidiff)Percona commits (PSP_REL_18_STABLE)
1. Extensible smgr registryMoves f_smgr to storage/smgr.h with name; replaces static smgrsw[] with smgr_register(const f_smgr *, Size); adds SMgrId (uint8) and storage_manager_id; moves md_num_open_segs and md_seg_fds from SMgrRelationData into MdSMgrRelationData; calls register_builtin_dynamic_managers()Registers tde (RegisterStorageMgr) and overrides storage_manager_id globally, wrapping md in extend, writev, readv, startreadv, create and unlink. Singleton only (FATAL if another custom smgr exists)1 struct layout change: SMgrRelationData drops trailing md fields and narrows smgr_which to uint8 (pincount and node shift; earlier fields keep offsets)6469142723, c8317c82a1, 937fca1f3c, b476c8b8af
2. Encryption context on createAdds old_rlocator to mdcreate(), f_smgr.smgr_create and heap_create(); adds smgrcreate_percona(), RelationCreateStoragePercona() and index_create_percona(); updates ~20 callers; guards RelationCreateStorage(), smgrcreate() and index_create() with percona_allow_upstream_smgr_apitde_mdcreate() sets ENCRYPT or PLAIN inside DDL captured by pg_tde’s ProcessUtility_hook and ddl_command_start event trigger, or RETAIN (inheriting from old_rlocator) during VACUUM FULL, CLUSTER, TRUNCATE, SET TABLESPACE and REINDEX CONCURRENTLY. Sets percona_allow_upstream_smgr_api = false2 signature changes: heap_create() and mdcreate(). Runtime behavior: when pg_tde is loaded, legacy wrapper callers fail with ERROR (TimescaleDB, Citus columnar, unpatched OrioleDB)c204e46359, 9bd71a588a, 9c0ac6d6cf (PERCONA_API_VERSION = 3)
3. Extensible AIO callbacksMakes aio_handle_cbs[] writable with PGAIO_HCB_MAX = 15 (4 built-in, 11 extension); adds pgaio_io_register_callback_entry(); drops const from aio_md_readv_cb; exports md_readv_complete()PG 18 routes most reads through AIO (smgr_startreadv). tde_mdstartreadv() stores the key by I/O handle and registers PGAIO_HCB_TDE_READV; tde_readv_complete() decrypts pages between md and bufmgr callbacksZero struct or signature changes (aio_md_readv_cb drops const)2324a66872, 2a839c1a45
4. WAL segment I/O (XLogSmgr)Adds access/xlog_smgr.h (XLogSmgr { seg_read, seg_write }, xlog_smgr, SetXLogSmgr()); routes XLogWrite, XLogFileCopy, WALRead, XLogPageRead and XLogWalRcvWrite through xlog_smgrpg_tde_xlog_smgr.c calls SetXLogSmgr() to encrypt/decrypt WAL segments page by page (plus archive/restore helpers). Key-event WAL records use PG 15’s standard RegisterCustomRmgr() (5c279a6d35), needing no patchPure addition9f59910142
5. Version guard and contribAdds PERCONA_API_VERSION and check_percona_api_version(); updates 6 contrib modules (amcheck, pageinspect, pg_surgery, pgrowlocks, pgstattuple) to check rd_tableam == GetHeapamTableAmRoutine()Refuses mismatched kernels and lets diagnostic tools inspect tde_heap tablesPure addition6a7608d7ca, e10d4168c6, 85dbb5d11d, 03d9d932f7, 1d44de57fe, 19c3033dc4

How Percona’s branch relates to Commitfest #5616

Upstream Commitfest #5616: Extensible storage manager API (v6 posted on 2026-02-04 by Percona’s Zsolt Parragi) contains 6 patches: 0001 (f_smgr exposure and global override), 0002 (checkpoint_create_hook), 0003 (fsync_checker test module), 0004 (mdcreate old RelFileLocator), 0005 (smgr_chain GUC) and 0006 (extensible AIO callbacks).

Inference (from matching patch filenames and commit subjects, without a line-by-line diff of v6): parts 1, 3 and the mdcreate portion of part 2 share the same origin as CF #5616, whereas the ~20-caller heap_create / index_create plumbing, PERCONA_API_VERSION = 3 wrappers and XLogSmgr exist only in Percona’s repository and have never been submitted upstream. Conversely, v6’s smgr_chain GUC and checkpoint_create_hook are not in Percona’s branch.

Ten years of upstream TDE and extensible smgr discussions

Upstream PostgreSQL has debated two approaches to encryption: building TDE into core, or opening storage hooks for extensions.

In-core TDE attempts (2016–2025)

  • 2016–2019: Ants Aasma (Cybertec) posted the first cluster-level AES-XTS patch in 2016 (thread ). Moon Insung (NTT) and Masahiko Sawada proposed table-level TDE and KMS in May 2018 (thread ), followed in 2019 by buffer-encryption prototypes from Sawada and Antonin Houska (patch , wiki ).
  • December 2020 KMS commit and revert: Bruce Momjian committed internal KMS on 2020-12-25 (978f869b99 ) and reverted it two days later (3187ef7c46 ) after Tom Lane and Michael Paquier reported issues and missing tests (thread ). In January 2021, Momjian noted the lack of consensus and stopped work (thread ); only RelationIsPermanent() landed in PG 14 (95d77149c5 ).
  • 2021–2025: Robert Haas proposed storing a page nonce in May 2021 (thread ). David Christensen (Crunchy Data) and Stephen Frost revived the KMS/TDE series in October 2022 (thread ): CF #3985 was returned with feedback in February 2024 after Andres Freund asked to split the heap-encryption patch, and post-special page storage (CF #3986 ) stalled in Waiting on Author in January 2025.

Extensible smgr proposals (2021–2026)

  • 2021–2024: Anastasia Lubennikova proposed smgr hooks in June 2021 (CF #3216 , thread ), closed in March 2022 after 6 months of inactivity. In June 2023, Matthias van de Meent (Neon) posted “SMGR hook Redux” (CF #4428 , thread ), which closed in October 2024 after six Commitfests.
  • 2025–2026 (CF #5616 ): Andreas Karlsson (Percona) posted v3 and v4 in February–March 2025, and Zsolt Parragi posted v5 and v6 in January–February 2026 (v6 email ), adding extensible AIO callbacks and pg_smgrstat . As of 2026-11-07, #5616 remains in the closed PG19-Final Commitfest in Needs review, with no committer, CFBot red since 2026-03-09, and not moved into any PG 20 Commitfest.

The late-2025 and 2026 shift toward unified in-core TDE

  • December 2025 I/O hooks RFC: When Henson Choi proposed five I/O hooks and 5 reserved pd_flags bits (thread ), Zsolt Parragi replied on 2025-12-30 that Neon, Nile and Percona had run the smgr patch in production since 2023, while Percona had held back its WAL hook because it was unsure the design belonged in core.
  • May 2026 PGConf.dev: Percona, EDB and Cybertec held a joint session (“Stop Debating, Start Implementing: Unifying TDE Efforts for Postgres”; Highgo recap , IvorySQL recap ) on authenticated encryption, WAL design, key management and LSN-as-IV concerns.
  • July 2026 WAL encryption benchmarks: On 2026-07-16 (follow-up 2026-07-20 ), Zsolt Parragi showed that AES-CTR-256 page-level WAL encryption inside the WAL write lock critical section was up to ~20% slower on write-heavy workloads (plus ~20% higher recovery CPU), whereas record-level encryption matched master. He announced plans to submit an in-core record-level TDE proposal within weeks. Not found: as of 2026-11-07, no such proposal appeared on pgsql-hackers or in PG20-3 / PG20-4.

Inference: Percona’s upstream strategy shifted in mid-2026 from purely seeking extension hooks to co-designing in-core TDE (at least for WAL). If in-core WAL encryption succeeds, pg_tde’s XLogSmgr hook will be superseded by a core feature rather than merged as an extension API.

Committer feedback and upstream preconditions

Across all threads examined on 2026-11-07, direct committer feedback on extensible storage and TDE includes:

  • Andres Freund: Gave the only direct committer review on the smgr registration thread on 2023-07-01 : register in BaseInit() rather than PostmasterMain(); avoid extra indirection on smgrsw[] by using a fixed-limit static table; question pg_compiler_barrier(); and explain why smgrrelation_size was stored per entry. In the PG 18 AIO commits (da7226993f , 50cb7505b3 ), he noted in aio.h that extensible callback IDs work if every process re-registers callbacks in the same order under EXEC_BACKEND, and that completion callbacks must not allocate memory or start new I/O.
  • Tomas Vondra: On 2025-12-28 and 12-30 , opposed reserving pd_flags bits for extensions, questioned ad-hoc I/O hooks that must be maintained forever, and argued that smgr itself should be improved if needed.
  • Bruce Momjian, Tom Lane and Robert Haas: Momjian noted in April 2026 that pg_tde requires a patched fork. Not found: any direct messages from Heikki Linnakangas, Robert Haas or Tom Lane on the two extensible smgr threads, or primary verification of a 2020 export-control remark attributed to Tom Lane in pgEdge’s May 2026 article .

Inference: For extensible smgr (#5616 ) to land upstream, six preconditions must align: (1) a storage/AIO committer claiming the patch; (2) addressing Freund’s fixed-size table and BaseInit() points; (3) a clean redo story (v6 sidesteps per-relation lookup during recovery via global override / smgr_chain); (4) multiple consumers beyond TDE (Neon, Nile, Percona, pg_smgrstat); (5) strict compliance with the AIO + EXEC_BACKEND contract; and (6) an active rebase with green CI.

Outlook for PostgreSQL 19, 20 and 21+, and what Mimus will do

Upstream outlook by release

  • PostgreSQL 19 (fact: absent): 19rc1 shipped on 2026-10-15 and PG19-Final closed in April 2026. In 19rc1, smgr.h, md.h, catalog/storage.h, catalog/heap.h and storage/aio.h differ from 18.4 only in copyright years, smgrsw[] is still static const, xlog.c still calls pg_pwrite() directly, and release-19.sgml contains only two AIO tuning commits (a9ee668817 , d1c01b79d4 ). See PostgreSQL 19 .
  • PostgreSQL 20 (inference: low overall likelihood before the April 2027 freeze): As of 2026-11-04, master has no extensible smgr or AIO callback commits, and neither PG20-3 nor PG20-4 lists an smgr or TDE entry (only the adjacent CF #6689: Extensible sync handler registration in sync.c).
ComponentPG 20 likelihood (Inference)Basis
1. smgr registration (#5616 0001)LowUnmerged after 5 years and 3 CF entries; no committer; CFBot red for 7+ months; not in PG 20 CF
3. AIO callback registration (v6-0006)Low to mediumSmall (~20 lines) and anticipated in aio.h, but tied to part 1
2. Old RelFileLocator on create (v6-0004 + #156)LowTDE-specific rewrite context; touches heap_create / index_create
4. XLogSmgr WAL segment hookVery lowNever submitted; Percona’s July 2026 benchmark favors in-core record-level WAL encryption
In-core TDEVery low (for PG 20)No patch posted as of 2026-11-07; multi-vendor consensus takes multiple cycles
  • PostgreSQL 21+ (inference): Either the community pursues in-core TDE (replacing XLogSmgr with core record-level WAL encryption and requiring data migration from pg_tde) or it merges extensible storage points (#5616 , shrinking Mimus’s patch set). Neither path will settle before 2027.

How Mimus carries the patches

Carrying Percona’s ~650-line patch set costs a rough estimate of 1–2 person-days per minor release (rough estimate, not a commitment) and merges with the Mimus protocol hook with 0 conflicts. Mimus 1 therefore includes the storage patches in PostgreSQL 18 and 19, split into four patch files (smgr-registry, smgr-create-context, aio-callback-registry, wal-io-hook) so each piece can be retired independently.

Based on source analysis on 2026-11-07 (Inference / design judgment, not yet prototyped), Mimus 1 can also rewrite Percona’s 3 abidiff changes into zero ABI changes so precompiled PGDG packages stay 100% binary-compatible (Storage patches for pg_tde , ABI compatibility ):

  1. SMgrRelationData: keep the md fields and int smgr_which in place and append custom smgr private fields at the end.
  2. mdcreate() and heap_create(): restore stock mdcreate() and heap_create() signatures as wrappers and add mdcreate_ext() and heap_create_ext() with old_rlocator (matching index_create_percona()).
  3. *_percona symbols and version guard: keep RelationCreateStoragePercona, smgrcreate_percona, index_create_percona and percona_api_version exported for pg_tde, and document the runtime guard (percona_allow_upstream_smgr_api) when pg_tde is loaded.