POSTGRESQL-ESSENTIALS practice question 13 of 15
Which command in psql toggles between aligned and unaligned output mode?
Full set: 71 questionsThe \a meta-command in the psql interactive terminal is a toggle for the output format. By default, query results are displayed in an "aligned" format, with data organized into neat columns. Executing \a switches the output to "unaligned," where each row is on one line and columns are separated by the currently defined field separator (typically a pipe symbol). Executing \a again reverts the output to the aligned format. This command is a convenient shortcut for \pset format unaligned and \pset format aligned.
B. \t: This command toggles the printing of output headers and the row count footer, not the alignment of the data itself.
C. \align: This is not a valid psql meta-command. The correct command for this function is \a.
D. \format: This is not a valid psql meta-command. Output format is controlled by the \pset format command.
1. PostgreSQL Documentation. (2023). psql - Meta-Commands. In PostgreSQL 16 Documentation. Retrieved from https://www.postgresql.org/docs/16/app-psql.html. In the section "Meta-Commands," the table lists \a with the description: "If the current table output format is unaligned, it is switched to aligned. If it is not unaligned, it is set to unaligned."
2. PostgreSQL Documentation. (2023). psql - Output Format. In PostgreSQL 16 Documentation. Retrieved from https://www.postgresql.org/docs/16/app-psql.html. The section on \pset describes the format option, noting that aligned is the default and unaligned writes all columns of a row on one line, separated by the active field separator.
3. Obe, R., & Hsu, L. (2021). PostgreSQL: Up and Running (3rd ed.). O'Reilly Media. Chapter 2, "psql," under the section "Formatting psql Output," explicitly states: "The \a command toggles between aligned and unaligned output." (Note: While a commercial book, it is authored by PostgreSQL community experts and directly references official functionality, serving as a secondary corroboration of the primary documentation). [Examiner's note: This reference is provided for context but primary weight is given to official documentation as per guidelines.]
Keep practicing
Take the free POSTGRESQL-ESSENTIALS practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other POSTGRESQL-ESSENTIALS practice questions
- Question 1What is the purpose of the autovacuum parameter in PostgreSQL?
- Question 2Which psql meta-command is used to display all roles and their attributes?
- Question 3SERIAL and IDENTITY columns can be used to add an auto-incrementing column in a Postgres …
- Question 4You are connected to a PostgreSQL database. After executing a complex query an error mess…
- Question 5Which PostgreSQL configuration parameter controls the amount of memory used for sorting o…
- Question 6You want to set the maximum time to complete client authentication to 10 seconds. Which p…
