mysqlcompat
mysqlcompat · MySQL compatibility functions, aggregates, operators, and casts for PostgreSQL porting.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101253 | mysqlcompat | mysqlcompat | 0.0.7 | SIM | Unknown | SQL |
PostgreSQL · 15, 16, 17, 18, 19
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
- mysqlcompat 0.0.7 README on PGXN
- Official upstream README
- Version 0.0.7 build manifest
- Aggregate SQL entry point
mysqlcompat 0.0.7 is a pure SQL/PLpgSQL collection of MySQL-like functions, aggregates, operators, and casts intended to reduce application-porting work. It provides selected compatibility helpers; it does not change PostgreSQL grammar or make PostgreSQL behave exactly like MySQL.
Core Workflow
The PGXS build assembles the extension from topic files under sql_bits. Major groups include aggregate, bit, cast, control-flow, date/time, information, mathematical, miscellaneous, operator, and string helpers. Names beginning with _ are implementation helpers and should not be called directly.
Compatibility Boundaries
- Upstream reports tests only on PostgreSQL 8.2 through 9.5. Validate installation, overload resolution, casts, and results on every modern target major.
- Named MySQL operators
XOR,DIV, andMODcannot be reproduced as grammar; upstream suggests PostgreSQL#, integer division, and%alternatives. - PostgreSQL strings remain case-sensitive by default, unlike many MySQL collations.
- Several MySQL time-like values are represented as PostgreSQL
interval, and MySQL interval syntax must be rewritten with quoted PostgreSQL interval literals. - Overloaded functions may require explicit casts, as the
ADDTIMEexample shows.
The extension creates many broadly named objects in its target schema. Install it in an isolated schema when possible, control search_path, and inventory conflicts with core or application functions before exposing it. Ported code still needs semantic tests for NULL handling, overflow, collation, date arithmetic, aggregate behavior, and implicit casts; successful object creation is not proof of MySQL compatibility.