PostgreSQL Professional Database Security Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Attempts: 11 | Questions: 20 | Updated: Aug 15, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. What is the maximum length of a password hash that PostgreSQL stores with SCRAM-SHA-256?

Explanation

PostgreSQL stores SCRAM-SHA-256 passwords as verifier strings containing the iteration count, salt, and derived keys. Because the iteration count is represented as text and can vary, the verifier’s length is not a single fixed number; it may vary with the configured iteration count.

Submit
Please wait...
About This Quiz
PostgreSQL Professional Database Security Quiz - Quiz

This quiz evaluates your understanding of PostgreSQL security best practices and authentication mechanisms. It covers role-based access control, encryption, connection security, and data protection strategies essential for professional database administrators. Master these concepts to secure production PostgreSQL environments effectively.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. True or False: Column-level privileges can be granted using the GRANT command in PostgreSQL.

Explanation

PostgreSQL supports column-level privileges through `GRANT`. For example, `GRANT SELECT (name) ON employees TO analyst;` lets the role read only the specified column, rather than granting access to every column in the table. Column-level grants are available for privileges such as `SELECT`, `INSERT`, `UPDATE`, and `REFERENCES`.

Submit

3. Which command creates a new role with login privileges in PostgreSQL?

Explanation

`CREATE USER` creates a PostgreSQL role with the `LOGIN` privilege, allowing it to connect to the database. It is effectively a shorthand for `CREATE ROLE` with `LOGIN` enabled. `CREATE LOGIN` and `CREATE ACCOUNT` are not valid PostgreSQL commands.

Submit

4. What is the purpose of a PostgreSQL certificate in SSL connections?

Explanation

A PostgreSQL server certificate presents its identity during an SSL/TLS connection. The client checks its signature and validity, often against a trusted certificate authority, to confirm it is communicating with the intended server rather than an impostor. This supports authentication; encryption protects data in transit, while the certificate itself does not encrypt backups, hash passwords, or control roles.

Submit

5. Which postgresql.conf parameter restricts connections by IP address when pg_hba.conf is not available?

Explanation

`listen_addresses` controls the network interfaces and IP addresses on which PostgreSQL listens for connections. Restricting it limits which server addresses clients can reach, though it does not provide per-client IP filtering; that is normally handled by `pg_hba.conf`. The other options do not control the server’s listening addresses.

Submit

6. True or False: MD5 authentication is recommended for production PostgreSQL servers.

Explanation

MD5 authentication is not recommended for production PostgreSQL because its password handling is comparatively weak and lacks the stronger protections of modern methods. SCRAM-SHA-256 is generally preferred when clients support it. Production deployments should also use TLS and sound access controls to help protect credentials and connections.

Submit

7. What does the password_encryption parameter control?

Explanation

The `password_encryption` parameter determines the hashing method PostgreSQL uses when creating or changing a database user’s password, such as SCRAM-SHA-256 or MD5. It does not encrypt SSL certificates, backups, or connection strings.

Submit

8. Which PostgreSQL feature logs all database activity for audit compliance?

Explanation

pgAudit is a PostgreSQL extension designed to provide detailed audit logging for compliance and security reviews. It can record configured database activity, including statements and object access, through PostgreSQL’s logging system. Unlike general statement logging, it offers audit-focused options for controlling what is recorded.

Submit

9. True or False: The SUPERUSER role can bypass row-level security policies.

Explanation

In PostgreSQL, superusers bypass row-level security checks, so policies do not restrict which rows they can access or modify. RLS is designed to control access for ordinary roles, not to constrain highly privileged administrators. A role with the `BYPASSRLS` attribute can also bypass these policies.

Submit

10. Which parameter in postgresql.conf controls password validity duration?

Explanation

`VALID UNTIL` sets the date and time after which a PostgreSQL role’s password is no longer valid. It is specified with `CREATE ROLE` or `ALTER ROLE`, not as a parameter in `postgresql.conf`.

Submit

11. Which authentication method in PostgreSQL uses Kerberos for single sign-on?

Explanation

PostgreSQL’s `gss` authentication method uses the Generic Security Services API (GSSAPI), commonly backed by Kerberos, to authenticate users. This enables single sign-on when clients and servers are configured with Kerberos credentials. `md5` and `password` use password-based authentication, while `trust` allows access without verifying a password.

Submit

12. Which function encrypts data using a password in pgcrypto?

Explanation

`pgp_sym_encrypt` encrypts data using a symmetric key derived from a password. It is part of PostgreSQL’s `pgcrypto` extension and is commonly used with `pgp_sym_decrypt` to recover the encrypted data using the same password.

Submit

13. Row-level security (RLS) in PostgreSQL restricts access at which level?

Explanation

PostgreSQL row-level security controls which rows a user can view or modify within a table. Policies are applied to queries and operations, allowing access to specific records based on user identity or other conditions.

Submit

14. What does ssl=on in postgresql.conf enable?

Explanation

Setting `ssl = on` in `postgresql.conf` enables PostgreSQL to accept encrypted connections using SSL/TLS. This helps protect data exchanged between clients and the server while it travels over the network. Server certificates and keys must also be configured for clients to establish secure connections.

Submit

15. Which PostgreSQL extension provides transparent data encryption?

Explanation

pgcrypto provides PostgreSQL with cryptographic functions, including encryption and decryption, that can protect stored data. However, it requires explicit use in queries or applications; it does not provide automatic, transparent encryption of the database.

Submit

16. What is the purpose of the REVOKE command in PostgreSQL?

Explanation

In PostgreSQL, the `REVOKE` command withdraws privileges that were previously granted to a user or role on database objects, such as tables or schemas. It can remove permissions like `SELECT`, `INSERT`, or `UPDATE`. It does not delete accounts, lock connections, or encrypt data.

Submit

17. Which command grants all privileges on a table to a specific user?

Explanation

The `GRANT` command assigns privileges in SQL. Using `GRANT ALL ON TABLE` followed by `TO user` gives the specified user all available privileges on that table.

Submit

18. What does the SCRAM-SHA-256 authentication method provide that md5 does not?

Explanation

SCRAM-SHA-256 derives a stored password verifier using a unique salt and repeated hashing, making precomputed rainbow tables ineffective and brute-force attacks more costly. MD5-based authentication offers weaker protection and is more vulnerable to password-cracking techniques. SCRAM also uses a challenge-response exchange, so the password itself is not sent over the connection.

Submit

19. Which PostgreSQL role attribute prevents a user from logging in?

Explanation

The `NOLOGIN` attribute prevents a PostgreSQL role from connecting to the database. It is commonly used for roles intended to hold privileges or own database objects, rather than serve as accounts for direct user login.

Submit

20. What is the default pg_hba.conf authentication method for local connections?

Explanation

The `peer` method is the default authentication method for local connections in many PostgreSQL configurations. It checks the operating system username of the process making the connection and compares it with the requested PostgreSQL username. This allows matching users to connect without providing a password, though configuration defaults can vary across distributions and installations.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What is the maximum length of a password hash that PostgreSQL stores...
True or False: Column-level privileges can be granted using the GRANT...
Which command creates a new role with login privileges in PostgreSQL?
What is the purpose of a PostgreSQL certificate in SSL connections?
Which postgresql.conf parameter restricts connections by IP address...
True or False: MD5 authentication is recommended for production...
What does the password_encryption parameter control?
Which PostgreSQL feature logs all database activity for audit...
True or False: The SUPERUSER role can bypass row-level security...
Which parameter in postgresql.conf controls password validity...
Which authentication method in PostgreSQL uses Kerberos for single...
Which function encrypts data using a password in pgcrypto?
Row-level security (RLS) in PostgreSQL restricts access at which...
What does ssl=on in postgresql.conf enable?
Which PostgreSQL extension provides transparent data encryption?
What is the purpose of the REVOKE command in PostgreSQL?
Which command grants all privileges on a table to a specific user?
What does the SCRAM-SHA-256 authentication method provide that md5...
Which PostgreSQL role attribute prevents a user from logging in?
What is the default pg_hba.conf authentication method for local...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!