chore(postgres): expand on replication features

This commit is contained in:
Michele Cereda
2026-03-03 21:38:00 +01:00
parent 9c48ee9c98
commit cf23d1d2d2
2 changed files with 64 additions and 2 deletions

View File

@@ -142,7 +142,7 @@ ALTER USER joel WITH NOSUPERUSER;
ALTER USER mark CREATEDB REPLICATION;
ALTER ROLE miriam CREATEROLE CREATEDB;
-- Change passwords
-- Change (/reset) passwords
ALTER USER mike WITH PASSWORD NULL;
ALTER USER jonathan WITH PASSWORD 'seagull5-pantomime-Resting';
ALTER ROLE samantha WITH PASSWORD 'Wing5+Trunks3+Relic2' VALID UNTIL 'August 4 12:00:00 2024 +1';
@@ -251,6 +251,28 @@ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO bar;
SELECT rolpassword from pg_authid where rolname = 'admin';
-- Check replication slots' state.
SELECT slot_name, plugin, active, pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS retained_wal
FROM pg_replication_slots;
-- Get the size of the `pg_wal` directory.
SELECT pg_size_pretty(sum(size)) FROM pg_ls_waldir();
-- Drop replication slots.
SELECT pg_drop_replication_slot('peerflow_slot_some_db_pg');
-- Show existing publications.
SELECT * FROM pg_publication;
-- Create publications.
CREATE PUBLICATION peerflow_slot_some_db_pg FOR ALL TABLES;
CREATE PUBLICATION peerflow_slot_some_db_pg FOR TABLE public.reports;
-- Drop publications.
DROP PUBLICATION peerflow_slot_some_db_pg;
-- Show available extensions
SELECT name FROM pg_available_extensions ORDER BY name;