# Protocol, dialect and origins

> Follow a connection into PostgreSQL and identify the matching kernel, extension and original authors.

---

LLMS index: [llms.txt](/llms.txt)

---

## From TCP connection to table {#flow}

Patch 300 imports the OpenHalo server hooks. At startup the preloaded extension registers a TCP listener. On connection, a PostgreSQL backend exchanges a MySQL handshake, chooses the native database configured in `mysql.database` and authenticates the PostgreSQL role. It checks for the extension in that database before accepting application SQL. The database name sent by the client selects a schema inside it. [300/301 kernel patches](/docs/patches/mysql/)

## Parsing and execution {#translation}

The extension implements the MySQL grammar, rewrites supported DDL and DML, implements compatibility types and functions, and encodes results in MySQL packets. PostgreSQL plans and executes the query and stores its rows. Patch 301 integrates dialect-specific coercions, managed collation callbacks, foreign-key checks and startup requirements. A native client uses the PostgreSQL protocol and parser against the same catalogs. [SQL behavior at each endpoint](/docs/mysql/compatibility/)
{#extension-design}

### Names in the native database {#schemas}

The example MySQL database `app` maps to schema `app`. The extension installs its own schemas too: `mysql` for compatibility objects, `mys_informa_schema` for information-schema compatibility, `performance_schema` and `mys_sys`. Export application objects separately so the target installer can create the extension-owned objects.
{#mapping}

## Identify this build {#identity}

| Component | 19.0.1-r4 identity |
|---|---|
| Native kernel | `pgsty/mimus` at `0d8a551aa121`, tree `07fbb73680de`. This integrates the nine patches on PostgreSQL `REL_19_0`. |
| OpenHalo kernel input | `pgsty/openhalo` at `a7e6d509db7f` for the upstream part of 300. 301 carries the Mimus adaptations. |
| Standalone extension | `pgsty/pg_mysql` at `1e631f9802c5`, tree `53dd9be3e87b`. Build this commit directly with the matching kernel’s `pg_config`. `pg_extension.extversion` and `pg_get_loaded_modules()` report `1.0`. |
| MySQL protocol | The handshake, `VERSION()` and `@@version` return `mysql.compat_version`, which defaults to `5.7.32-log`. `@@version_comment` returns `mimus`. |

## Origins and license {#openhalo-1}

The grammar, original SQL definitions and compatibility routines descend from Halo Tech's PostgreSQL 14 work. PGSTY ported the work to PostgreSQL 18/19 and extracted the standalone `pg_mysql` from OpenHalo's `aux_mysql`. Ruohang Feng maintains the extension at PGSTY PTE. LTD. Earlier cross-kernel experiments belong to the OpenHalo 18 porting history. [OpenHalo source](https://github.com/pgsty/openhalo/tree/a7e6d509db7fb3149c92ddc109ef9478fb107447) · [History of the earlier port](/blog/mysql-as-a-postgresql-18-extension/#abi-and-portability)

The standalone extension carries GPL-3.0-or-later and retains the original Halo Tech Co., Ltd. and openHalo.org notices, copyright 2019–2026. The parser retains Jet C.X. ZHANG's credit. The source also credits PGSTY PTE. LTD. (2026), the PostgreSQL Global Development Group (1996–2026) and the Regents of the University of California (1994). PostgreSQL-derived portions and keyword tools retain the PostgreSQL License. The distributed `LICENSE`, `COPYRIGHT` and `3party-legal-notices` contain the full notices. [Original Halo Tech copyright notice](https://github.com/HaloTech-Co-Ltd/openHalo/blob/90fc8d777c3f111d4c8d236625bb15b5d4b19d7c/COPYRIGHT)

### Other kernels {#matrix}

The examples here require Mimus 19.0.1's matching server callbacks and module. The old experiments with IvorySQL and Babelfish used different kernels and extension identities. For SQL Server access on this Mimus kernel, use its paired Babelfish extensions. [SQL Server manual](/docs/mssql/) · [Encrypted table access methods](/docs/mysql/operations/#storage-options)
{#comparison}

---

Backlinks:

- [MySQL compatibility as a PostgreSQL 18 extension](/blog/mysql-as-a-postgresql-18-extension/)
- [MySQL](/docs/mysql/)
- [Install and connect](/docs/mysql/quickstart/)
- [Server configuration and authentication](/docs/mysql/reference/)
