Skip to main content

Cookie settings

We use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can configure and accept the use of the cookies, and modify your consent options, at any time.

Essential

Preferences

Analytics and statistics

Marketing

Official PostgreSQL support in Mautic 7+ via minimal compatibility layer

Avatar: Wieslaw Golec Wieslaw Golec

Has your proposal been discussed on the Mautic Forums already?

Yes – full discussion thread: https://forum.mautic.org/t/proof-of-concept-restoring-postgresql-support-for-mautic/36313

Is your feature request related to a problem? Please describe.

Lot companies and users cannot use Mautic today because they run PostgreSQL in production (enterprise policy, existing infrastructure, managed platforms such as Supabase, AWS Aurora PostgreSQL, Azure PostgreSQL, etc.). Mautic has been MySQL/MariaDB-only since 2017 (when PostgreSQL support was effectively removed), which blocks adoption in many organisations and forces people to maintain private forks or give up on Mautic entirely.

Describe the solution you'd like

Add first-class, officially supported PostgreSQL support starting with Mautic 7 (or 8 if 7 is too late) using the proven and widely accepted “minimal compatibility layer” approach:

  1. During installation/upgrade, a Doctrine migration (executed only on PostgreSQL) creates few well-known MySQL compatibility functions and operators that Mautic already uses and boolean ↔ integer operators (legacy tinyint ↔ boolean compare)

  2. A very small number of queries that cannot be polyfilled 100 % (a few hand-written raw SQL fragments) are rewritten with tiny platform-specific alternatives or native PostgreSQL equivalents. → This introduces only a handful of if platform checks – far fewer than 50 lines in total.

  3. No requirement for root access or C extensions – everything works with normal CREATE FUNCTION / CREATE OPERATOR privileges, which are granted by all self-hosted setups and the vast majority of managed PostgreSQL providers.

This is a proven strategy used by many large PHP projects (e.g., Laravel apps, Symfony-based systems) and similar to GitLab's native PG migration, minimizing maintenance while enabling multi-DB support.

Some of these functions & operators (if not all) can probably be removed in the future, when Mautic continues to refactor code and make it more multi-database oriented, not strictly MySQL.

Describe alternatives or workarounds you've considered

  • Fully native rewrite (hundreds of platform checks scattered everywhere) → rejected by core team in the past because of huge maintenance burden.

  • C extension that adds MySQL functions → perfect performance but requires root/compile access → not acceptable for 95 % of users.

  • Keeping PostgreSQL support only in community forks → works for a few power users but never becomes official and creates fragmentation.

Additional context

Proof-of-Concept (fully working installer + core functionality on PostgreSQL 14–17): https://github.com/wieslawgolec/mautic/tree/7.x-postgresql (latest commit 924eb50c14 – contains the temporary compatibility layer and all current adjustments)

What the PoC already proves today:

  • Installer works and lets you choose PostgreSQL

  • All unit tests are unchanged

  • Installation and basic scenarios pass

  • Only minimal platform-specific code is present (will be further reduced once the real migration exists)

The remaining work is small code-refactoring & cleaning, splitting into proper PRs, deeper plugin testing, and writing the final migration – all straightforward once the direction is officially approved.

Does this issue could impact on users private data?

No – it only adds database functions and tiny query adjustments. No change to authentication, encryption, or any sensitive flow.

Funded by

Currently unfunded – this is a volunteer effort, but several companies (including mine) are ready to support completion and long-term maintenance once the approach is officially accepted.

Category
Mautic 7 (preferred) / Mautic 8 (fallback)

#Mautic #Mautic #MauticFeatures
Comment

Confirm

Please log in

You can access with your Mautic Forums account or create an account here.

Share