All quizzesHard
RLS, Partitioning & FDW
Preview — 3 of 10 questions
What is the correct way to enable Row-Level Security and create a policy allowing users to see only their own rows?
AALTER TABLE users ENABLE ROW LEVEL SECURITY; CREATE POLICY user_isolation ON users USING (user_id = current_setting('app.user_id')::uuid);
BCREATE CONSTRAINT users_rls ON users FOR SELECT USING (id = current_user_id());
CSET row_security = ON; GRANT SELECT ON users TO app_role WHERE user_id = SESSION_USER;
DRow-Level Security is configured in pg_hba.conf, not in SQL
Which pair of commands sets up logical replication from a primary to a subscriber in PostgreSQL?
ACREATE REPLICATION SLOT on primary; pg_basebackup on replica
BCREATE PUBLICATION pub FOR TABLE orders on primary; CREATE SUBSCRIPTION sub CONNECTION '...' PUBLICATION pub on subscriber
CSET wal_level = logical on replica; SUBSCRIBE TO primary on replica
Dpg_logical_start_replication() on both servers simultaneously
What must be done to enable pg_stat_statements in PostgreSQL?
AAdd pg_stat_statements to shared_preload_libraries in postgresql.conf, restart PostgreSQL, then run CREATE EXTENSION pg_stat_statements in the target database
BIt is enabled by default in PostgreSQL 14+; no configuration needed
CRun CREATE EXTENSION pg_stat_statements without any restart requirement
DSet track_activity_query_size = pg_stat_statements in postgresql.conf
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.