POSTGRESQL-ESSENTIALS practice question 8 of 15
Which pg_dump option allows you to dump only the data without schema definitions?
Full set: 71 questionsThe pgdump utility is used for creating backups of a PostgreSQL database. To create a dump that contains only the data and excludes the schema definitions (like CREATE TABLE statements), the --data-only option is used. Its short-form equivalent is -a. This is particularly useful when the target database already has the required schema structure, and only the data needs to be restored or transferred. The resulting dump file will primarily contain COPY statements to load the data into the existing tables.
A. -d: This option, or its long form --dbname, is used to specify the name of the database to connect to, not to control the dump content.
C. -D: This is not a valid option for the pgdump utility. It is used by other PostgreSQL tools like initdb to specify the data directory location.
D. --no-schema: This is not a valid pgdump option. The correct and officially supported option to achieve this outcome is --data-only.
1. PostgreSQL 16 Documentation, pgdump:
Section: Options -> Options Controlling the Output Content
Reference: The documentation explicitly states: "--data-only / -a Dump only the data, not the schema (data definitions). Table data, large objects, and sequence values are dumped."
Reference: The documentation also lists: "-d dbname / --dbname=dbname Specifies the name of the database to connect to." This confirms option A's purpose.
2. University of California, Berkeley, CS186: Introduction to Database Systems, Lecture 21: Practicalities: SQL in the Real World:
Section: Backup and Recovery
Reference: Course materials discuss database administration utilities, noting that pgdump provides flags to separate schema and data. The --data-only flag is cited as the standard method for extracting only table data for migration or archival purposes, distinct from schema-only dumps (-s).
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…
