How PostgreSQL supports HIPAA access and audit controls
A covered entity or business associate storing ePHI in PostgreSQL must show that only authorized people and software reach that data and that access is recorded. Several PostgreSQL features can support the access control standard in 45 CFR 164.312(a)(1) and the audit controls standard in 164.312(b), including unique database roles, row security policies and the pgAudit extension for session and object logging. The Security Rule does not require certification, so the evidence you assemble is what your organization will show HHS Office for Civil Rights if it reviews a complaint or audit. The database is one component of a wider compliance program. Policy, risk analysis, workforce training, physical safeguards and vendor agreements sit around it, and the database settings only count when they match what those documents say.
Start with the unique user identification implementation specification, which is required. Give each person and each service its own database role rather than sharing an application login, and make sure your identity provider and database roles map one to one. Then decide how you will handle the emergency access procedure, which is also required, and document who can use it and how it is logged. Automatic logoff and encryption are addressable, so each needs a written assessment of whether it is reasonable and appropriate, with a documented alternative if you decline it. Confirm with your security and compliance teams which settings they expect to see in that assessment.
Row security policies answer a different question: which rows a given role can read or change. When row security is enabled on a table and no policy exists, PostgreSQL returns no rows to non-owner roles, so policies must be written and tested before the table goes live. pgAudit records statements and object access through the standard PostgreSQL logging facility, so decide which classes of activity to capture, where the logs are shipped and who can read or alter them. Test these controls with negative cases, such as a user from a different care team querying another patient's records, and keep the results as evidence. The HHS guidance on the Security Rule explains why certification claims carry no weight.
Mapping 45 CFR 164.312 requirements to PostgreSQL features
This table maps each 45 CFR 164.312 standard and implementation specification to the PostgreSQL feature that supports it, the configuration it needs, and whether the specification is required or addressable. Read it as a starting point for design: an addressable specification still needs a documented decision, and no database setting alone satisfies the Security Rule.
| Requirement | Status under the Security Rule | PostgreSQL configuration | What to confirm |
|---|---|---|---|
| Access control (164.312(a)(1)): unique user identification | Required | One login role per person or service, no shared accounts, membership in group roles for privileges, and authentication through SCRAM or an external directory | Your identity provider issues the account and removes it when access ends, and shared application accounts are documented with an owner |
| Access control: emergency access procedure | Required | A documented break-glass role or account kept disabled until used, with its use logged and reviewed | Who can activate it, how activation is approved, and how the account is reset afterward |
| Access control: automatic logoff | Addressable | Session timeouts such as idle_session_timeout and client-side timeouts in the application connection pool | Whether the timeout length is reasonable for clinical and administrative use, and the reason recorded if it is not applied |
| Access control: encryption and decryption | Addressable | TLS for client connections, and encryption at rest at the storage or volume layer, since PostgreSQL does not encrypt data files itself | Key custody, who can access keys, and whether backups and replicas are encrypted too |
| Row-level access to ePHI | Supports the access control standard | Row security policies on patient tables, with row security enabled so queries return no rows when no policy matches | Policies are tested per role, and table owners and superusers are understood to bypass policies unless forced |
| Audit controls (164.312(b)) | Required | pgAudit logging of read, write and DDL activity on ePHI tables through the standard logging facility | Which roles and objects are logged, log destination and retention, and who reviews the records and how often |
Evidence a PostgreSQL configuration produces for auditors
A HIPAA assessment asks whether access to ePHI is limited and whether activity is recorded and reviewed. The artifacts below are the settings and records that show those controls exist, and each one should be kept in version control so your own assessors can trace what changed and when.
Role inventory and privilege grants
Export the list of database roles, their members and every grant on schemas, tables and functions that hold ePHI. Each login should map to one named person or to a documented service account, which supports the unique user identification specification. Review the export on a schedule your organization sets and record who approved each change. Confirm that no shared application login can reach ePHI tables directly.
Row security docspg_hba.conf authentication rules
The pg_hba.conf file records which hosts, networks and users may connect and which authentication method each connection must use. Keep it in version control with a review record for every change, and confirm that MD5 password entries are absent in favor of SCRAM. Ask your assessors which evidence they expect for remote administrative access, since that path is often where findings appear.
Row security policy definitions
Where row-level security protects ePHI, export each policy definition and the tables it covers, including whether row security is enabled on each table. Because a table with row security enabled and no matching policy returns no rows to ordinary users, test each policy with a role that should see a subset of data. Store the definitions and the test results together so the access rule and its proof stay linked.
pgAudit log output and retention
Keep a sample of pgAudit session and object entries showing reads and changes to ePHI tables, along with the logging settings that produced them. Record where logs are shipped, who can read them and how long they are kept, since the Security Rule requires mechanisms that record and examine activity. Confirm that database administrators cannot alter or delete entries without leaving a trace. Your organization sets the retention period, so document it and the reason for it.
Documented decisions for addressable specifications
For each addressable specification, such as automatic logoff or encryption, keep a written decision that states whether it is reasonable and appropriate for your environment. If you decline one, record the reason and the equivalent measure you put in place. Tie each decision to the database settings it affects, so an auditor can compare the policy with the configuration. Review these records when the database or the threat picture changes.
164.312 textVersion control and independent review
Store every artifact above in a Git repository with change history, pull request approvals and dated exports taken from the running system. DeployOpen can prepare these controls and evidence, but your own compliance and security teams own the records, and your assessors decide whether they are sufficient. Confirm with your assessors how long they want history kept and in what format.
Configuration sequence for ePHI databases
This sequence turns a PostgreSQL database that holds ePHI into one where access rights, activity records, authentication, encryption and design decisions can each be shown to an assessor. Each step builds on the one before, so the controls can be tested in the order they depend on each other.
Inventory ePHI tables and their consumers
The data owner and database administrator list every database, schema and table that creates, receives, maintains or transmits ePHI, along with the applications, reporting jobs and people that read or write them. Backups, replicas, staging copies and extracts are included because the Security Rule applies to ePHI wherever it sits. The output is a signed inventory that every later step references, and it is complete when no ePHI location is missing from it.
Define unique database roles and group grants
The team creates one login role per person and per service account, with no shared credentials, and places privileges on NOLOGIN group roles such as clinical_read or billing_write. Grants are issued to groups, and application roles are kept separate from administrator roles. The check is a query against pg_roles and information_schema privileges that matches the approved access matrix, with emergency access accounts documented and tested separately.
Enable row security with explicit policies
For tables where access should depend on the user, the database owner enables row level security and writes explicit policies that tie visible rows to the user or group, such as a care team or facility. Table owners and superusers bypass policies, so the team confirms that application roles do not own the tables and that FORCE ROW LEVEL SECURITY is used where owners connect. The output is a policy test script showing that out-of-scope rows are not returned or modified.
Configure pgAudit classes and log destinations
The database engineer loads pgAudit, selects the audit classes that match the inventory, such as reads and writes on ePHI tables, DDL and role changes, and sets the object-level rules that log access to named tables. Log destinations are set so entries leave the database host and are retained under the organization's policy. Verification is a controlled test session whose reads, writes and privilege changes appear in the central log with the user, role and statement recorded.
Set authentication methods and TLS
The administrator restricts pg_hba.conf so that only approved networks and identity methods can connect, uses SCRAM password authentication where passwords remain, and considers certificate, GSSAPI, LDAP or OAuth 2.0 methods that tie logins to the organization's directory. TLS is enabled for client and replication connections with certificates from the internal authority. The check is a connection test from each permitted and denied source, with results saved as evidence.
Decide encryption at rest
The security lead and database owner choose how ePHI is encrypted at rest, such as storage-level encryption on the volume, file system encryption or column-level encryption for selected fields, and record which key management system holds the keys. Backups and archived WAL files are covered by the same decision. Because the Security Rule classes encryption as addressable, the decision and its rationale go into the documentation in the next step, and the team confirms that the chosen method is applied to every copy in the inventory.
Document addressable decisions
For each addressable specification, including automatic logoff and encryption, the compliance lead records whether it is reasonable and appropriate, what was implemented, and any equivalent alternative chosen if it was not adopted. The record cites the configuration key, role or policy that carries out the decision. Assessment of reasonableness is a business judgment, so it is signed by the accountable owner rather than left to the engineers who built the control.
Test each control before audit
Before any assessor or auditor review, the team runs a test for each control: a role privilege check, a row policy test by user, a pgAudit trace of a known read, a failed login from a disallowed network and a restore of an encrypted backup. Results are kept with dates, the tester's name and the configuration version. Any failed test reopens the step that owns it, and the sequence is complete when every control has a passing, dated result that matches the documentation.
Why unique roles and row security must be designed together
Unique user identification in the database depends on the identity model upstream of it. The Security Rule's unique user identification specification under 164.312(a)(2)(i) is required, so every person who touches ePHI needs an identity that the database can tell apart from everyone else. If the application connects with one shared service account, PostgreSQL only sees that account, and the audit trail cannot say which clinician or support agent ran a query. Decide first whether each person authenticates to PostgreSQL with their own role, or whether the application passes a user identifier that pgAudit and application logs can record. Confirm which approach your auditor and your application team accept, and confirm how the database role mapping to your identity provider is maintained when people join, move teams or leave.
Row-level security default-deny behavior can block legitimate access when policies are missing. Once row security is enabled on a table and no policy exists, PostgreSQL returns no rows to ordinary users, so a care team that should see a patient's record may suddenly see nothing. The fix is not to disable row security but to write policies that express the documented need to know, such as membership in a care team or a treating relationship, and to test every role against them. Treat policy design as part of the access model, not an afterthought, and keep the policy definitions under version control so changes are reviewable.
Test that care team access matches documented need to know before go-live. Build a matrix that lists each role, the patient populations it should reach and the operations it should perform, then run queries as each role against seeded test data. Include negative cases, such as a clinician outside the care team and a support role with no treatment purpose, and confirm that both return zero rows. Repeat the matrix after every schema or policy change. The matrix and its results become evidence for your access control review, and the same results show whether a row-level policy is too narrow or too broad.
How access and audit controls flow through the database
The diagram starts at an application or user session that presents a database role over TLS. The client network and the database server are separated by a trust boundary, and pg_hba.conf decides whether the connection is accepted before any query runs. Row security policies then filter which rows the role can read or change, while pgAudit writes activity records into the PostgreSQL log. Check that the log leaves the database server for a separate store with its own retention, so that an administrator on the database host cannot quietly alter the record.
Request path from a named role through TLS, row filtering and pgAudit to a separate log store.
Questions buyers ask about HIPAA and PostgreSQL
What drives the cost and effort of configuring PostgreSQL for HIPAA access and audit controls?
The main drivers are how many databases hold ePHI, how many distinct roles and access paths exist today, and how much of the access model is already written down. Effort rises when applications share one database login, when row-level rules must follow clinical or care-team relationships, and when audit records have to reach a central log platform. Costs fall into one-time design and build work (role model, row-level policies, pgAudit settings, log routing, test evidence) and recurring work (access reviews, log review, pgAudit and PostgreSQL upgrades). When requesting a quote, ask the provider to list each database in scope, each role and policy to be built, where logs will be stored and reviewed, and who keeps the evidence current. No public price applies, so the written scope is the basis for any figure.
How long does a HIPAA-oriented PostgreSQL configuration take, and what affects the schedule?
No duration is fixed by the regulation or by PostgreSQL, so the schedule depends on the environment and the scope agreed in writing. The main dependencies are how quickly the ePHI inventory is confirmed, whether the identity provider can issue individual accounts to database administrators and application owners, and whether the security and compliance teams can review the role design before it is built. Testing also takes time: row-level policies need queries run as each role to confirm that users see only the rows they should, and pgAudit output needs to be checked against the events the organization decided to record. Ask for milestones that show when each dependency is needed so that delays are visible early.
What must our team provide before a PostgreSQL access control project starts?
The team needs to provide three inputs at minimum:
- An ePHI inventory listing each database, schema and table that creates, receives, maintains or transmits electronic protected health information, with the owning application and its data flows.
- An access model that states which job functions need which data, which clinical or care relationships limit row visibility, and who approves access.
- An identity provider that can supply named accounts, group membership and multifactor authentication for administrators, along with a way to deprovision users.
The ePHI inventory determines where the controls apply under 45 CFR 164.312(a)(1). The access model is the input row-level security cannot work without, because the policies encode it. The identity provider supports the unique user identification requirement, so shared logins must be retired before the build can meet it.
Can an internal team configure PostgreSQL for HIPAA audit and access controls alone?
An internal team with strong PostgreSQL and security skills can build this work alone if it has time, clear decision rights and a reviewer who understands the Security Rule. The hard parts are less about commands than about decisions: which accounts map to which people, which rows a role may see, what pgAudit should record without flooding logs, and how the evidence will be kept. Under 45 CFR 164.306(d), each addressable specification needs a documented assessment, so the decisions must be recorded as well as implemented. Many teams find it useful to have an outside party test the result, because independent testing shows whether the controls behave as the design says. DeployOpen can plan and implement the configuration in your infrastructure and prepare the evidence, but it does not issue compliance attestations.
Is there a HIPAA certification for PostgreSQL or for our organization?
No. HIPAA has no certification. HHS states in its 2003 FAQ that no Security Rule standard requires an entity to certify compliance, that HHS does not endorse or recognize private organizations' certifications, and that such certifications do not prevent HHS from later finding a violation. Be wary of any vendor or consultant who sells a HIPAA certification or badge. What exists instead is an entity's own documented risk analysis, controls and evidence, which the HHS Office for Civil Rights can review through complaints, compliance reviews and audits. For a PostgreSQL deployment, the useful question is what evidence the database team can show for each access and audit control, not which certificate it holds.
What penalty range applies to HIPAA Security Rule violations?
For penalties assessed on or after January 28, 2026, the inflation-adjusted HIPAA civil money penalty under 45 CFR 102.3 (91 FR 3666) ranges from $145 per violation where the entity had no knowledge, up to $2,190,294 per violation for uncorrected willful neglect. The calendar-year cap is also $2,190,294. The amount in any case depends on the level of culpability and on how quickly the violation was corrected. Access and audit weaknesses are the kind of gap OCR examines, so the technical controls described here reduce exposure, but they do not replace a documented risk analysis or a policy program. Confirm the current figures in the eCFR before relying on them, since the amounts are adjusted for inflation.
Does the HIPAA Security Rule require encryption of PostgreSQL data at rest?
Under the current rule, encryption and decryption under 45 CFR 164.312(a)(2)(iv) is an addressable implementation specification, which means the entity must assess whether it is reasonable and appropriate and document the result. If it is not implemented, the entity must document why and adopt an equivalent measure where reasonable. A January 2025 proposed update would require encryption of all ePHI at rest and in transit with limited exceptions, but that rule was proposed and is not final as of October 2026. Plan the encryption decision now and record it. Confirm the choice of storage encryption, TLS and key management with your security team and the vendor of your storage platform.
What is the difference between row-level security and pgAudit for HIPAA?
Row-level security limits which rows a database role can read or change, which supports the access control standard in 45 CFR 164.312(a)(1). PostgreSQL's row security policies default to deny when row security is enabled and no policy exists, so the policies must be written and tested for each role. pgAudit records detailed session and object activity through PostgreSQL's standard logging, which supports the audit controls standard in 45 CFR 164.312(b). The two work together: row-level rules decide what a user can see, and audit records show what was done. Neither one alone covers both standards, and both need an identity model that gives each person a unique account.
How DeployOpen scopes HIPAA database controls
DeployOpen plans, implements, hardens, documents and supports self-hosted PostgreSQL inside your own infrastructure, including the access control and audit logging settings that a HIPAA Security Rule review will ask about. We agree the scope in writing first, then build and test the controls, and hand over the configuration and evidence so your compliance and security teams can review them.
How we scope
- Inventory which databases hold ePHI, which applications and people reach them, and which copies sit in replicas and backups
- Agree in writing which unique role model, row-level security policies and pgAudit settings are in scope
- Record encryption decisions for data at rest and in transit, and the reasons behind each addressable choice
- Confirm the PostgreSQL version, hosting model and identity provider before any build work starts
How we build
- Configure authentication, pg_hba.conf rules and unique database roles that map to named individuals or service accounts
- Build row-level security policies and test that default-deny behavior blocks access outside each role's need to know
- Enable pgAudit with logging settings agreed in scope, and route entries to your log platform with retention applied
- Test emergency access and automatic logoff procedures against the running database, with results recorded
How we hand over
- Deliver configuration, role and policy definitions, and the audit logging setup as version-controlled files
- Provide a control-by-control mapping to 45 CFR 164.312 and the matching Appendix A entries, written for your reviewers
- Document operating procedures for access reviews, log review and key handling, with named owners
- Walk your administrators and reviewers through the evidence so they can reproduce the checks
How we support
- Engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as a retainer
- Retest controls after PostgreSQL minor updates, major upgrades or changes to roles and policies
- Keep the evidence current for your own assessments, while independent auditors and HHS make the compliance determination
- Ask for a written quote that lists the controls, environments and deliverables before work begins

