Sample Exam Questions

From the objective of OSS-DB Exam Silver
- Operation and Management - Basic operation management task (system information function)

Sample Question


An error occurs when the following statement is executed from psql trying to get the name of user who is currently executing the session.

SELECT current_user ();

What is the cause of the error?

  1. You must use session_user (), not current_user (). 
  2. You must use user () instead of current_user ().
  3. The table information is stored in pg_class, and the column information is stored in pg_attribute.
  4. Parentheses are not required, we have to call SELECT current_user;
  5. Since the command itself is correct, it is safe to assume that an abnormality has occurred in the server

※This sample exam is different from those that appear in the actual OSS-DB Exam.

Answer and Explanation

To check which users  are running sessions, such as a psql session, use the system information functions current_user, session_user, or user.  Normally, the results from these are the same, but you can change the result of current_user or user by executing SET ROLE. 

Although they are functions, they are treated differently and may be used without parentheses (parentheses are an error). 

Therefore, the correct answer is D.