Given a PostgreSQL table products partitioned by LIST on the category column, what will be the output of the following query?
INSERT INTO products (id, name, category) VALUES (1, 'Apple', 'Fruit') RETURNING *;
Assume partitions exist for categories 'Fruit' and 'Vegetable'.
CREATE TABLE products (id INT, name TEXT, category TEXT) PARTITION BY LIST (category); CREATE TABLE products_fruit PARTITION OF products FOR VALUES IN ('Fruit'); CREATE TABLE products_vegetable PARTITION OF products FOR VALUES IN ('Vegetable');
Check if the partition for the category exists before inserting.
Since a partition for 'Fruit' exists, the row is inserted successfully and returned.
Which statement best describes how PostgreSQL routes data when using LIST partitioning by category?
Think about how LIST partitioning differs from RANGE partitioning.
LIST partitioning routes rows to partitions where the partition key matches one of the listed values exactly.
Which of the following SQL statements correctly creates a table orders partitioned by LIST on the order_type column with partitions for 'Online' and 'InStore'?
Check the partitioning method and the syntax for partition value lists.
Option A correctly uses LIST partitioning and defines partitions with FOR VALUES IN (value).
You have a large sales table partitioned by LIST on region. Which query will most efficiently use partition pruning to scan only the 'North' region partition?
Partition pruning works best with exact matches on the partition key.
Only the query with an exact equality condition on the partition key allows pruning to scan just the 'North' partition.
Given a table employees partitioned by LIST on department with partitions for 'HR' and 'IT', the following insert fails:
INSERT INTO employees (id, name, department) VALUES (10, 'John Doe', 'Finance');
What is the most likely cause of this error?
Check if a partition exists for the inserted category value.
In LIST partitioning, inserting a value not covered by any partition causes an error.