PostgreSQL and GDPR: erasure, minimization and pseudonymization

Erasure in PostgreSQL has to reach replicas, WAL archives and backups, not only the primary table. This page shows which GDPR obligations the platform helps you evidence and which decisions remain yours.

On this page

Which GDPR obligations self-hosted PostgreSQL helps you evidence

PostgreSQL provides features that support GDPR obligations, but deletion, minimization and pseudonymization are decisions your organization makes and operates. As a controller or processor holding personal data in PostgreSQL, you will need to answer erasure requests, keep personal data out of test environments and show that Article 32 security measures are in place. The database can enforce authentication through methods such as SCRAM and certificate login, encrypt connections with TLS, replicate data for availability, and recover it with point-in-time recovery and logical replication. None of these features decides which rows must be deleted, how long a copy may live, or who is allowed to see a column. Those choices belong in your retention schedule, data inventory and access model, and they should be written down before the database is configured.

The GDPR requires no audit, attestation or certificate. Certification under Article 42 is voluntary, is issued for at most three years by accredited bodies or supervisory authorities, and does not reduce the responsibility of the controller or processor for compliance. DeployOpen does not issue audit reports, attestations or certifications. What we can prepare is the configuration, the records and the test evidence that your compliance team and any independent assessor will ask to see, such as role inventories, TLS settings, backup and restore results and access logs. Ask any partner, including us, to state in writing which of those artifacts they will produce and which remain your responsibility.

Start by confirming the legal basis for each dataset and the retention period your organization has set, because the technical design follows from those answers. Check with your legal and privacy team which systems are in scope for erasure, whether backups and replicas count as copies you must address, and whether any processor or remote access path could move data to a third country. The GDPR text on EUR-Lex is the primary reference for Articles 25, 32 and 17, and it is the right starting point before you map controls to your own environment.

Mapping GDPR obligations to PostgreSQL capabilities and configuration

This table pairs each GDPR obligation touching PostgreSQL with the database capability that supports it and the configuration your team should confirm. Read each row as a starting checklist for your own design, not as proof of compliance. The main takeaway is that PostgreSQL supplies controls for security of processing and recovery, but erasure and minimization remain design and process work your team owns.

GDPR requirementPostgreSQL capabilityConfiguration to confirm
Article 32 security of processing (access and authentication)SCRAM password authentication, certificate authentication, and external methods such as LDAP, GSSAPI or OAuth 2.0 on PostgreSQL 18Disable MD5 password entries, use named roles per person or service, and review pg_hba.conf rules so only approved networks and methods match
Article 32 security of processing (encryption in transit)TLS for client and replication connectionsRequire hostssl or certificate methods in pg_hba.conf, and confirm TLS settings on standbys and backup tooling
Articles 33 and 34 breach notification (detecting and scoping an incident)Server logs and external audit extensions record connections and statements; the database alone does not produce a breach reportConfirm log retention, which roles and statements are logged, and that your team can reconstruct which personal data tables an intrusion touched
Article 32 resilience (recovery of personal data)Point-in-time recovery from a base backup plus archived WAL files; incremental backups via pg_basebackup and pg_combinebackupConfirm backup and WAL archive locations, encryption of copies, and that restores are tested in your environment
Article 32 availability (replicas)Hot standby servers and synchronous or asynchronous replication; PostgreSQL does not detect failure or fail over by itselfConfirm replica locations, access roles on standbys, and which external failover tool your team operates
Chapter V transfers (Article 44)Logical and streaming replication, backups and standbys can all place copies of personal data in new locationsMap every replica, backup target and support access path to a country, including remote administration from outside the EEA
Erasure and minimization (Articles 5 and 17, to be confirmed)PostgreSQL has no built-in erasure workflow; deletion must be designed in schemas, jobs and retention rules, and copies in backups and replicas persist until expiredConfirm article references against the regulation text on EUR-Lex, then define deletion jobs, backup expiry and replica treatment with your legal and data owners
Article 83 exposure (fines)Not a database feature; fine tiers depend on the infringement category and the turnover of the undertakingConfirm with counsel which obligations apply to your processing and document the controls you rely on for each

Where one personal data record lives after a single delete

The trace starts at the application, which writes a personal data row to the primary PostgreSQL server. From there, WAL streams to hot standbys and possibly a logical replica, and WAL archives and base or incremental backups copy the same data again. Restores can produce test copies. Check each box for where the copy physically sits and who can reach it. A delete on the primary does not remove copies already held in archives, backups or test restores, so each one needs its own erasure or expiry rule. Copies stored or accessed from outside the EEA may engage Chapter V.

Copies of one personal data row across replicas, backups and test restores, with trust boundaries marked.

Why deleting a row on the primary does not finish erasure

A DELETE on the primary removes the row from live tables, but the same personal data can persist in standbys, archives, backups, subscribers, restored copies and logs. Each copy needs a retention decision, an access decision and a check against your own backup tooling before an erasure request can be called complete.

Hot standby and replica copies

A hot standby replays every committed change from the primary, so a deleted row disappears from the standby only after replay catches up. Replicas do not hold a separate deletion log, so the copy follows the primary's timing and the primary's data. Confirm whether your replicas serve read-only analytics or application traffic, who can query them, and whether erasure is verified on each standby, not only on the primary.

PostgreSQL high availability docs

WAL archives for point-in-time recovery

Point-in-time recovery replays archived WAL files on top of a base backup, so an archived change can bring a deleted row back when the archive is restored to an earlier moment. The decision is how long WAL archives are kept and whether restores can stop before a deletion. Confirm your archive retention in your archive tool and whether a restore to a point before the erasure is ever permitted.

Continuous archiving docs

Base and incremental backups

Base backups and incremental backups hold full or partial copies of table data as it stood at the backup time. Incremental backups reconstructed with pg_combinebackup can recreate rows that were deleted after the earlier backup. Decide how long each backup set is kept, who can restore it, and whether erased data can be removed selectively or only by expiring whole sets. Confirm the behavior with your backup software.

Continuous archiving docs

Logical replication subscribers

A logical replication subscriber receives row changes as its own table copy. A DELETE on the publisher is sent to the subscriber, but a subscriber that is paused, lagging, or built with a separate initial copy may still hold rows, and subscribers outside your control can keep data indefinitely. Confirm which subscribers exist, how deletes reach each one, and who operates them.

Restored test and analytics copies

Staging databases, analytics extracts and restored copies used for support or testing often contain full production rows that no one tracks after creation. These copies sit outside the erasure workflow unless they are inventoried. Decide whether test data is masked on creation, how long restored copies live, and who can read them. Confirm that your restore procedures record where each copy went.

Application and database logs

Statement logs, application logs and audit records can capture personal data in query text, parameters or error messages. Log files are rotated and shipped to log stores, so a row deleted from a table may still appear in logs. Decide what is logged, how long logs are kept, and who can search them. Confirm your log settings, shipping destinations and retention in your logging platform.

How to run an erasure request through primary, replicas and backups

This sequence turns an erasure or pseudonymization request into a traceable set of database actions that reach the primary, every replica and the backup estate, with evidence kept at each stage. It works only when the data map is current and the steps have been rehearsed on a restored copy.

  1. Locate the data subject's rows from the data map

    The privacy or data engineering owner starts from the documented data map, which lists each table, column and file that holds personal data and the key that links it to the data subject. Run the lookup against every database in scope, including reporting schemas, audit tables, exports and any extension-created storage, and record the table names, row counts and identifiers found. The step is done when the lookup has been run against each listed location and the results are saved with the request. Any table missing from the map is a finding that goes back to the data map owner before the request closes.

  2. Delete or pseudonymize on the primary in transactions

    The database administrator applies the decided action, either deletion or pseudonymization, inside explicit transactions on the primary, with statements ordered so that child rows and linked records change together. Pseudonymization replaces direct identifiers with values that cannot be traced back without a key held elsewhere, and the team should confirm which fields the controller considers identifying. Commit only after the affected row counts match the lookup results. The step is done when the commit is recorded and the transaction log entry, the executing role and the change ticket are stored with the request.

  3. Confirm replicas have replayed the change

    The operator checks each hot standby and any logical subscriber to confirm that it has replayed the commit from the primary, using replication status views and the position of the commit in the write-ahead log. Do not rely on the primary's commit alone, because a standby that lags or is detached will still hold the original values. Where a replica is intentionally excluded from a copy process, document why it holds no personal data in scope. The step is done when every replica in the data map shows replay past the commit position, and that check is saved with the request.

  4. Record which backup sets still hold the data

    The backup owner lists each base backup, incremental backup and archived WAL set that covers the period when the data existed, and records which of them still contain the personal data. Erasure on the live system does not remove data from these copies, so the reader must decide the retention rule in advance and document it, including whether the data is deleted at expiry, removed on restore, or both. The reader sets these retention and restore rules, not DeployOpen or the database software. The step is done when a register lists each backup set, its coverage period and the expiry or restore-time action assigned to it.

  5. Apply re-deletion rules to restored copies

    When a backup is restored for recovery or testing, the restore runbook includes a step that re-runs the erasure statements for every request recorded against the period covered by that backup before the copy is used or released. The operator uses the request register from the previous step to build the list of statements. The step is done when the restore log shows the re-deletion ran, the row checks passed and the outcome was added to the request record. This step is what keeps erased data from returning through a restore.

  6. Verify deletion with queries

    The operator runs the same lookup queries used in the first step against the primary, each replica and a restored test copy, expecting zero matches for deleted values and the expected pseudonymized values for pseudonymized fields. Also search statistics views, staging extracts and any analytics copies that were refreshed from the database. Save the query text, the timestamp and the result of each check. The step is done when every location returns the expected result, and any mismatch reopens the request.

  7. Log the request outcome and retain the evidence

    The privacy owner writes a closing record that lists the request identifier, the actions taken, the locations checked, the replica positions, the backup sets flagged, the re-deletion schedule and the verification results. Store the record where the controller can produce it for a supervisory authority or an internal review, and set its retention according to the controller's own policy. The record shows what was done, but it does not itself prove compliance with the GDPR. The step is done when the record is approved and linked to the original request.

  8. Rehearse the sequence on a restored copy

    Before the sequence is relied on for live requests, the team restores a recent backup to an isolated environment, runs a sample erasure through every step and checks that the verification queries return the expected results after a restore. Include a test where a backup from before the erasure is restored and the re-deletion step is applied. Record the time each step took and any gaps in the data map. The rehearsal is complete when the team signs off the runbook and the gaps have owners. Repeat it when the schema, the replication topology or the backup tooling changes.

Masking test copies with PostgreSQL Anonymizer

Copying production data into development, test or analytics databases is one of the most common ways personal data leaves its controlled environment under GDPR. A test database usually has weaker access control, more people with administrative rights, and fewer logs than production, yet it holds the same names, addresses and account details. PostgreSQL Anonymizer is an open-source extension intended to replace identifying values with masked or generated values in a copy, so that developers and testers work with data that keeps its shape without exposing the original records. Whether it fits your estate depends on confirming the extension's documentation for your chosen PostgreSQL major version, the extension version you plan to pin, and the masking functions your data types require.

The first design decision is where masking happens. Static masking rewrites the data during export or copy, so the masked dataset is the only thing that leaves production and the raw values never reach the test environment. Dynamic masking keeps the full data in place and shows masked values to particular roles at query time. Dynamic masking suits roles that must query live data under restriction, but it does not stop the raw values from being stored in a copy, so it should not be used to justify moving production dumps into test systems. For test copies, plan for static masking and treat dynamic masking as a separate access control that needs its own testing. Keep the masking rules in version control alongside the schema migrations, with review on change, so that a new personal data column added in production cannot silently reach a test copy unmasked.

Masking is only effective if the raw values never leak through the path that produced the copy. Check the dump and restore pipeline end to end: confirm that intermediate dump files, temporary tables and staging volumes are either masked or deleted, that pg_dump or replication output from production is not written to shared storage, and that server logs and extension logs do not record raw values from statements run during masking. Test this with a canary row containing an identifiable value, run the full pipeline, and search the output, logs and backups for it. Ask your team to document the result as evidence for Article 32 measures, and retest after every extension upgrade or PostgreSQL major upgrade.

Which Article 32 controls PostgreSQL configuration covers

Article 32 asks controllers and processors to limit access to personal data to what each role needs. In PostgreSQL, most of that work happens in roles, authentication methods and privilege grants, so the configuration starts with identity rather than with server settings.

  • Unique database roles: Give each person and each service account its own login role, with no shared accounts, so that log entries can be tied to a named person or workload.
  • SCRAM password storage: Set password_encryption to scram-sha-256 and use the scram-sha-256 method in pg_hba.conf. PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM, so remove any remaining MD5 rules.
  • Directory and certificate login: The PostgreSQL authentication methods list certificate, LDAP, GSSAPI, SSPI and OAuth 2.0 (new in PostgreSQL 18). Confirm which ones your identity provider supports and how directory groups map to database roles.
  • Narrow privilege grants: Grant table and column privileges only to the application roles that need personal data, and confirm who holds superuser or role-creation rights.

Confirm that every pg_hba.conf line names the method you intend, and that your access review covers both human and service roles.

Evidence to keep for a data protection review

A data protection review asks the controller to show what personal data is held, who can reach it, where copies live and how requests were handled. The records below answer those questions from the PostgreSQL side, and each one is most useful when it is produced by a routine rather than assembled for the review.

Data map and erasure procedure

A written inventory of the tables, columns and extensions that hold personal data, with the lawful owner of each field and the steps that erase a subject's rows from primary tables, replicas, archives and backups. Keep it in version control next to the schema migrations, so every new column that holds personal data prompts an update. The data protection lead signs off each change, and the database owner checks that the erasure steps still match the current table layout.

Role and pg_hba.conf exports

Scheduled exports of role memberships, grants and the pg_hba.conf rules, stored under version control so each change has an author and a reason. These show which accounts can read personal data columns and from which networks they connect. The database owner reviews the diff each quarter, and the security team confirms that no shared or unnamed accounts appear in the export.

PostgreSQL auth methods

TLS and certificate inventory

A list of every server and client certificate used for PostgreSQL connections, including issuer, subject, expiry date and the systems that trust each one. It shows whether personal data travels encrypted between the application, the database and replicas. The platform team updates it when certificates rotate, and the security reviewer checks for expired or unknown certificates before the review.

Backup and restore test records

For each restore test, record the backup set used, the restore point, the row counts for the personal data tables and the result of the erasure check run against the restored copy. This shows whether a subject erased from production stays erased after a restore, which is a common gap in erasure programs. The backup owner runs the test and the data protection lead reviews any erased record that reappears.

Replication status and lag logs

Periodic captures of replica state, including replay lag and the standby list, kept alongside the erasure log. Erasure statements reach standbys through replication, but a lagging or detached replica can hold stale personal data for longer than expected. The operations team reviews lag records weekly and confirms each replica that holds personal data is included in the erasure procedure.

Masking rules and erasure request logs

Version-controlled masking rule files for each test copy, paired with a log of erasure and access requests that records the timestamp, the request source, the systems actioned and the person who confirmed completion. The rules show that test environments hold pseudonymized or anonymized data, and the log shows that requests were handled within the controller's deadlines. The privacy office reviews both each month and before any external assessment.

What PostgreSQL and this work do not settle for GDPR

PostgreSQL gives you tools for erasure, minimization and pseudonymization, but it does not give you a right-to-erasure workflow or a retention engine. Nothing in the database decides which rows are still necessary, which data subjects have asked for deletion, or when a record has outlived its purpose. Those decisions belong to your controller obligations and to a process your team owns, with the DELETE statements, retention jobs and backup expiry rules written down and tested. The GDPR also contains no technical standard that a PostgreSQL configuration can certify. A correct pg_hba.conf or a TLS setting supports your Article 32 analysis, but it does not show compliance on its own, and Article 42 certification, where it exists, does not remove your responsibility for compliance. Confirm with your data protection officer or counsel exactly which controls you rely on and how you document them.

Transfer questions are the part this work cannot answer for you. Under Article 44 and the EDPB's Guidelines 05/2021, remote access from a third country, even only displaying data for support, and storage in a cloud outside the EEA, count as transfers. Your exposure depends on where the hosting provider, the support staff with access and the backup copies physically sit, and on which law those providers answer to. The EU-US Data Privacy Framework adequacy decision is under appeal as Case C-703/25 P, and the Schrems II judgment shows that adequacy findings can be overturned. Map every location and every access path, then have legal counsel assess them before you choose a hosting or backup provider. Encryption alone may not close the gap if the provider can be compelled to access data in the clear.

Breach notification under Articles 33 and 34 depends on detection that reaches beyond the database. PostgreSQL logging and pgAudit can record who read or changed personal data, but someone must review those records, send them to a central store and alert on unusual access. Confirm that your logs leave the database host, that the retention period covers the time you need to establish what happened, and that your on-call process can meet the 72-hour window from awareness described in Article 33. Also confirm the status of legal change: as of October 2026 the GDPR text has not been amended, and the Omnibus IV and Digital Omnibus proposals are still moving through the legislative process. Plan around the current text and review your controls when either proposal is adopted.

Questions buyers ask before hiring help with GDPR and PostgreSQL

How much does a GDPR data mapping and erasure design cost?

No price can be stated here, and DeployOpen does not publish a price list. The cost follows from a written scope, and the main drivers are the number of databases, the categories of data subjects whose records sit in them, the number of replicas and backup sets that a deletion must reach, and the number and size of test copies that need masking. Each database cluster and each backup chain adds analysis and verification work, so ask for the quote to list those items separately. Ask whether the quote is one-time work, whether any retention or monitoring is recurring, and which parts depend on your legal team's decisions, since those decisions are paid for by you and not by the engineering work.

How long does a PostgreSQL GDPR assessment take?

The duration depends on how many systems hold personal data, how well those systems are documented, and how many backup and replica paths exist. A single database with a clear schema and one backup chain is usually far shorter than a fleet with ad hoc reporting copies, external exports and several retention policies. Access to staff who know the data flows and the retention rules is often the slowest input, so plan for that before the start date. Ask for a timeline in the written scope with the dependencies named, including when your legal review is expected to finish.

What do we need to provide for a GDPR engagement on PostgreSQL?

The work needs four kinds of input from your side. Engineers need database access, ideally read-only for discovery and a controlled account for changes to schemas, jobs and backup configuration. Backup owners must explain retention schedules, storage locations, replication topology and how restores are performed. Data owners or the privacy team must confirm which records are personal data, what retention periods apply and which legal grounds justify keeping them. Legal review is needed for retention periods, exceptions to erasure and any transfers outside the EEA, because those are policy decisions that a technical team cannot settle alone. Agree on who signs off each of these before the work starts.

Can our internal team handle GDPR erasure in PostgreSQL alone?

A capable internal team can do much of the work, particularly if it already runs PostgreSQL in production and has clear ownership of its backups. The areas where internal teams most often stall are the complete inventory of personal data, deletion that reaches backups and replicas without breaking recovery, and masking test copies consistently across tables that reference each other. Before deciding, check whether the team has time for the discovery pass, whether anyone can test a restore that still honors deletions, and whether privacy and legal staff can take part. A partner can cover some of these gaps, but the internal team still owns retention decisions and day-to-day operation.

Can a GDPR certificate be issued for our PostgreSQL setup?

No certificate is required by the GDPR, and the regulation does not provide for an audit or attestation of your database. Article 42 certification is voluntary, is issued for at most three years by accredited certification bodies or supervisory authorities, and does not reduce your responsibility for compliance. DeployOpen does not issue certificates or audit reports. It prepares the systems, controls and evidence that your privacy team and any independent certification body may review, such as data inventories, retention configuration, erasure procedures and access logs. Ask any partner to describe its evidence in writing, and be wary of anyone who offers a certificate as part of the engagement.

What changes if our PostgreSQL database or offsite backups sit in a third country?

A third-country location changes the legal analysis more than the database work. Under Chapter V, a transfer includes remote access from a third country, even for support, and storage in a cloud outside the EEA, so offsite backups and support sessions both need to be mapped. Where the destination's public authorities can reach data in the clear beyond what is necessary and proportionate, the EDPB has said it cannot envision an effective technical supplementary measure, so legal review must come before the design is locked. Engineering changes include documenting every copy, controlling who can access it remotely, and making deletion reach those copies. Ask your counsel to confirm the transfer mechanism, and treat the EU-US Data Privacy Framework as applicable only to organizations on the Data Privacy Framework List.

How do we ask a partner for a written GDPR scope?

Ask for a scope document before any work starts, listing the systems in scope, the personal data categories and data subject groups, the deliverables, the testing and verification steps, and the responsibilities of each party. The document should state what is excluded, such as legal opinions or retention decisions, and which inputs must be ready on which dates. Ask how deletion will be verified against backups and replicas, what evidence will be delivered, and how changes to scope are priced. DeployOpen agrees scope, deliverables and timelines in writing before work starts, and provides a quote that follows from that written scope. Compare quotes on the same scope items rather than on headline totals.

How DeployOpen works on this

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure. For PostgreSQL and GDPR, we start from a written inventory of where personal data sits, then configure erasure, minimization and pseudonymization controls and the evidence your compliance team needs for Article 32.

How we scope

  • We inventory which PostgreSQL databases, schemas and replicas hold personal data, and which systems copy them.
  • The written scope names the erasure paths, backup and replica handling, masked test copies and logging controls included.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we build

  • We configure deletion and retention procedures and test that erased records do not reappear in replicas or restored backups.
  • We set up PostgreSQL Anonymizer for test copies and confirm masked data cannot be reversed by the people who use it.
  • We configure encryption, role-based access and access logging, then test them against the scope before handover.

How we hand over

  • You receive configuration records, runbooks for erasure requests and restore tests, and the masking and logging settings.
  • Documentation maps each control to the GDPR obligation it supports, so your DPO and security team can review it.
  • We state what evidence we prepared. Independent auditors or certification bodies, not DeployOpen, assess compliance.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers for changes to schemas and data flows.
  • We can retest erasure and masking controls after upgrades, new replicas or new data sources are added.
  • Ask us to confirm which GDPR questions your legal and privacy teams will still own after handover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.