This post covers four things: what masking does and how static and dynamic approaches differ, the options available in community PostgreSQL, what an enterprise distribution provides natively, and how to choose between them.

What data masking does in PostgreSQL
Data masking replaces sensitive values with realistic substitutes, so the data stays usable while the real values stay protected. Community PostgreSQL does not include native masking, but multiple masking approaches are available through extensions and architecture choices, including a dedicated extension, a view-based design, or an enterprise distribution with masking built in.
The fork that determines everything downstream is static versus dynamic.
- Static masking rewrites the stored data irreversibly.
The original values are gone from that copy, which is what makes it suited to protecting data that leaves production. - Dynamic data masking leaves stored values intact and rewrites query results according to who is asking.
The real data remains in the table, and the protection sits at the point of access.
Masking is also distinct from encryption, which is reversible by design and protects data at rest rather than governing what a given role sees on screen. Our earlier overview of how data masking protects sensitive data sets out that distinction in more detail. Both sit inside the same data privacy program that regulations such as GDPR and HIPAA push organizations toward when personally identifiable information (PII) is handled outside its original context.
Choosing between static and dynamic masking
Most masking guidance assumes dynamic masking is the goal, which skips the question that actually matters. The right approach follows from what the data is for and where it travels, not from which technique is more sophisticated.
| Use case | Fits | Why |
| Refreshing a test or development environment from production | Static masking | The copy leaves production, so the real values should not travel with it |
| Support staff querying live customer records | Dynamic data masking | Production data must stay intact and accurate for the people authorized to see it |
| Analytics on a reporting copy | Static masking, often with generalization | Aggregate accuracy survives, individual values do not need to |
| A shared schema where some roles need real values and others do not | Dynamic data masking | The decision is per role at query time, not per copy |
| Handing data to a third party or an external auditor | Static masking or an anonymous dump | Once the data leaves your control, reversibility is a liability |
Table: matching static and dynamic masking to common enterprise use cases.
Many organizations need both. A production database governed by dynamic masking and a non-production refresh pipeline governed by static masking is a common and defensible pairing, and the two do not compete for the same job.
The three masking methods at a glance
Whichever approach you choose, masking changes values in one of three general ways. The table below shows each method and how it transforms a value, using the implementations available in Fujitsu Enterprise Postgres as the example.
| Method | What it does | Example input | Example result |
| Full | Replaces the entire value with the configured masking value | 5000.00 | 0 |
| Partial | Preserves selected characters while masking others | 012-3456-7890 | 012-- |
| Regexp | Transforms matching parts of a value using a regular expression | name@example.com | xxx@example.com |
Table: full, partial, and regexp masking methods with example transformations.
Full masking suits values with no business need for partial visibility, such as salary. Partial masking suits values a support agent needs to recognize without reading in full, such as a phone number. Regexp masking suits structured values where one component matters and another does not, such as preserving an email domain while hiding the local part.
Masking options in community PostgreSQL
Three approaches cover most of what teams do on community PostgreSQL, and they differ less in what they can transform than in where the rules live and who maintains them.
PostgreSQL Anonymizer
PostgreSQL Anonymizer is an extension that takes a declarative approach: masking rules are declared inside the schema itself using security labels, as part of the data definition language rather than in an external tool. It supports static masking, dynamic masking, and anonymous dumps, with a library of masking functions covering substitution, shuffling, randomization, faking, partial scrambling, generalization, sampling, and adding noise.
Two constraints matter at decision time. The project's own documentation notes that the dynamic masking engine works with one schema at a time, while static masking and anonymous dumps work across multiple schemas. Static masking also destroys the original values in the database it runs against, which is correct behavior for a non-production copy and unacceptable in production.
Masking views
The no-extension approach is a view. A security-barrier view presents transformed values using ordinary SQL expressions, direct access to the underlying table is revoked, and roles are granted access only to the view. Nothing needs installing, which is why this is often the fastest containment measure available. The cost is maintenance: the view inventory grows with every variation in what different roles should see, and every schema change ripples through it.
Anonymous dumps for non-production environments
The most common cause of sensitive data exposure is not a masking policy that failed, but a production copy that was never masked at all. An anonymous dump applies the masking rules during export, producing a pg_dump output that carries substituted values rather than real ones. The practical shift is that test environments are seeded from a masked export rather than from a production copy someone intended to scrub later, which also removes a copy of regulated data from environments where data residency and sovereignty obligations are harder to evidence.
Common data masking pitfalls
Masking tends to fail in ways that are invisible until someone looks closely, which is why these are worth checking at design time rather than after deployment.
- Broken referential integrity.
Masking a customer ID in one table and not its foreign keys in another breaks the joins, and the test data that results is useless for the teams it was produced for. Masking has to be applied consistently across related columns, with the same input producing the same output wherever it appears. - Re-identification through indirect identifiers.
A masked name column does not protect an individual when the postcode, date of birth, and job title remain in the row. Those indirect identifiers combine to single someone out, and in small populations very few of them are needed. The security practices expected in regulated environments treat this combination as the unit of risk, not the obvious identifier alone. - The original value surviving elsewhere.
A column is not masked if the real value still sits in an index, a query log, or a backup taken before the rule was applied. Masking governs a path to the data, not every copy of it. - Columns the masking implementation cannot target.
Every masking mechanism has supported data types, and a column can hold character data and still fall outside them. In Fujitsu Enterprise Postgres, masking targets must sit inside the documented masking matrix, so bounded character types such as varchar(n) and char(n) are eligible while text and bytea are not. A policy against an unsupported column is rejected, and the fix is either aligning the column with a supported type or protecting it another way. The usual sequence is to contain access first with a security-barrier view and revoked privileges, then decide whether the column type should change or whether privilege-based controls become the permanent design. Columns with no business need to be visible at all are often best omitted from the view entirely.
Mask by role, not by user
Naming individual users in a masking policy creates an administrative burden that grows with headcount and fails quietly when someone changes teams. The maintainable design puts authorized users in a dedicated role and masks by default for everyone else, so the policy evaluates role membership rather than identity.
In Fujitsu Enterprise Postgres, the policy expression carries that check directly:
expression := 'NOT pg_has_role(session_user, ''dm_authorized'', ''MEMBER'')'
Members of the authorized role see the stored values and everyone else receives the masked representation, with no policy change required when personnel move. A single policy covers multiple columns, each with the masking method appropriate to its sensitivity, so phone, salary, and timestamp columns can carry partial, full, and partial masking respectively under one definition. Policies should always be tested from the perspective of each role that will query the table, including the nested role structures and connection pooling patterns in use, since those determine which account the policy actually evaluates. This is the same default-deny reasoning that authorization and cybersecurity framework alignment asks for across the rest of the stack.
Choosing between extension-based and built-in masking
The deciding factor is rarely the technique list. It is who carries the operational risk when a masking rule behaves unexpectedly in production.
| Consideration | Extension-based (PostgreSQL Anonymizer) | Built-in (Fujitsu Enterprise Postgres) |
| Where rules live | Security labels declared in the schema | Policy objects defined per table |
| Static masking | Supported | Not provided; masking applies at query time |
| Dynamic masking | Supported, one schema at a time | Supported, role-aware, across the database |
| Technique range | Wide: substitution, shuffling, faking, noise, generalization, sampling and more | Three methods: full, partial, and regexp |
| Operational ownership | Your team installs, upgrades, and validates the extension | Maintained as part of the supported distribution |
| Support model | Community, with commercial support available from the maintainer | Covered by the platform's enterprise support agreement |
| When something breaks in production | Your team diagnoses it | Raised through the vendor support channel |
Table: comparing extension-based and built-in masking across rule location, capability, and operational ownership.
Neither column is universally right. The extension route is flexible, free to adopt, and has by far the wider technique library, which matters most to teams building anonymization pipelines for data science or test-data generation. The built-in route offers fewer techniques but arrives documented, supported, and integrated with the platform's other security controls, which matters most where an audit asks who is accountable for a control rather than how it was implemented.
That integration is the substance of the Fujitsu Enterprise Postgres case. Data Masking is policy-based and role-aware, and it sits alongside Transparent Data Encryption and Dedicated Audit Log as part of one enterprise data security model rather than three separate projects. The layering is worth stating plainly, because the three controls answer different questions. Masking governs what a role sees, encryption protects the data at rest, and audit logging evidences who saw what. Regulated organizations generally need all three, which is why they appear together in our list of enterprise database features regulated industries should prioritize and in the broader security practices for enterprise PostgreSQL databases.
Choosing an approach you can defend
Start from the use case rather than the feature list. Decide whether the data is leaving production or staying in it, because that answers static versus dynamic before any tool is considered. Then check the specific columns against the supported data types of whichever mechanism you choose, and look at the indirect identifiers sitting beside them.
Effective protection does not come from masking alone. It comes from appropriate data types, well-defined access controls, and a clear understanding of what the platform can and cannot do, with masking applied as one layer among several. Try policy-based data masking against your own schema with a free trial of Fujitsu Enterprise Postgres, and see which of your columns the documented masking matrix already covers.
Frequently asked questions about Postgres data masking
Does PostgreSQL have built-in data masking?
Community PostgreSQL does not include a native masking feature. Masking comes from an extension such as PostgreSQL Anonymizer, a view-based design, or an enterprise distribution that provides it natively.
What is the difference between static and dynamic data masking?
Static masking rewrites the stored values irreversibly, so the original data no longer exists in that copy. Dynamic masking leaves stored values intact and transforms query results based on the role making the request.
How do I choose between static and dynamic data masking?
Choose static masking when the data leaves production, such as a test environment refresh or an export to a third party. Choose dynamic masking when the real values must stay in the database and access should vary by role.
Is data masking the same as encryption?
No. Encryption is reversible with the correct key and protects data at rest, while masking replaces values with substitutes that are not intended to be reversed. Most regulated environments use both.
Can masked data still be used for testing?
Yes, provided masking preserves format and referential integrity so that joins and application logic still behave correctly. Masking that ignores foreign keys produces data that fails in testing.
Does data masking satisfy GDPR requirements?
Masking supports GDPR obligations around limiting exposure of personal data, but it does not satisfy the regulation on its own. Data that can still be re-identified through indirect identifiers remains personal data under GDPR.




