Hello everyone,
Quick update on the PostgreSQL proof-of-concept:
I’ve successfully ported it to Mautic 7.0.0-rc and it is running cleanly on
- PHP 8.5.0
- PostgreSQL 16.10 (tested; should work fine on 12+)
The good news: it’s actually simpler than on Mautic 4.
Key points:
- The installer now works out of the box — Doctrine handles all type conversions automatically.
-
The only remaining compatibility layer required is:
-
ISNULL() custom MySQL function
-
Custom boolean
integer comparison operators (=, <> etc.)
-
Both are added automatically via a small migration that runs on first install.
-
-
A handful of queries still use MySQL-only functions without direct PostgreSQL equivalents (e.g. TIMESTAMPDIFF). These are wrapped in ~15–20 lines of if ($this->db->getDatabasePlatform() instanceof PostgreSQLPlatform) checks.
-
Index naming had to be adjusted globally (PostgreSQL requires unique index names across the entire database, not just per table like MySQL). This is now handled during installation.
-
Total added/changed code: 17 files in core & (+ ≈250 lines) and + ≈150-line compatibility layer (mostly the migration that creates the functions/operators).
On branch master
Your branch is up to date with ‘origin/master’.Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git restore …” to discard changes in working directory)
modified: app/bundles/CampaignBundle/Entity/Lead.php
modified: app/bundles/CampaignBundle/Entity/LeadEventLog.php
modified: app/bundles/CoreBundle/Helper/Chart/ChartQuery.php
modified: app/bundles/CoreBundle/Loader/ParameterLoader.php
modified: app/bundles/EmailBundle/EventListener/GeneratedColumnSubscriber.php
modified: app/bundles/EmailBundle/Model/EmailModel.php
modified: app/bundles/InstallBundle/Configurator/Step/DoctrineStep.php
modified: app/bundles/InstallBundle/Helper/SchemaHelper.php
modified: app/bundles/InstallBundle/Install/InstallService.php
modified: app/bundles/IntegrationsBundle/Entity/ObjectMapping.php
modified: app/bundles/LeadBundle/Entity/LeadListRepository.php
modified: app/bundles/LeadBundle/EventListener/ReportSubscriber.php
modified: app/bundles/LeadBundle/Report/DncReportService.php
modified: app/bundles/PageBundle/EventListener/ReportSubscriber.php
modified: app/config/config.php
modified: plugins/MauticFocusBundle/Entity/Stat.php
modified: plugins/MauticSocialBundle/Entity/TweetStat.phpUntracked files:
(use “git add …” to include in what will be committed)
app/migrations/Version202511210600000_AddBooleanIntegerOperators.php
Result: Mautic 7 runs end-to-end on PostgreSQL with minimal core changes, no manual query rewrites, and a fully functional installer.
This is still a proof-of-concept — not production-ready and definitely not PR-quality yet — but it clearly shows that official PostgreSQL support is achievable with very little effort now that Doctrine and Symfony do most of the heavy lifting.
Once 7.0 stable is released I’ll clean it up further and open a discussion about bringing PostgreSQL back as an officially supported database.
The current diff and compatibility migration are available on request (DM me) for anyone who wants to test or review it. I’m not publishing it publicly yet while it’s still rough POC code.
Happy to answer questions.
Thanks,
Wieslaw Golec


