# Proof of Concept: Restoring PostgreSQL Support for Mautic

**URL:** <https://forum.mautic.org/t/proof-of-concept-restoring-postgresql-support-for-mautic/36313>\
**Category:** General Discussion\
**Tags:** discussion, development, mautic-4\
**Created:** [August 13, 2025, 4:23am UTC](https://forum.mautic.org/t/proof-of-concept-restoring-postgresql-support-for-mautic/36313 "2025-08-13T04:23:44Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![esio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/esio/32/14631_2.png) [@esio](https://forum.mautic.org/u/esio)\
**Post date:** [November 21, 2025, 7:40am UTC](https://forum.mautic.org/t/proof-of-concept-restoring-postgresql-support-for-mautic/36313/13 "2025-11-21T07:40:43Z")

</div>

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**

 ![mautic 7 PHP8.5](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0ac7fde18a16457bc58bd7fc18dd172e8d8dd715.png)

- **PostgreSQL 16.10** (tested; should work fine on 12+)

 ![Mautic7 PostgreSQL](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/b/b6187c974655eccdc2bd0d8a054cc572f065ce80.png)

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.

 ![PGSQL Experimental](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/c6dfac794752c46bfe2882d3fe673051504c5ef6.png)

- The only remaining compatibility layer required is:

- 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.php
> 
> Untracked 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

---

_[View the full topic](https://forum.mautic.org/t/proof-of-concept-restoring-postgresql-support-for-mautic/36313)._
