| 1 |
-- Test old extension version entry points. |
| 2 |
CREATE EXTENSION pg_walinspect WITH VERSION '1.0'; |
| 3 |
-- Mask DETAIL messages as these could refer to current LSN positions. |
| 4 |
\set VERBOSITY terse |
| 5 |
-- List what version 1.0 contains, using a locale-independent sorting. |
| 6 |
SELECT pg_describe_object(classid, objid, 0) AS obj |
| 7 |
FROM pg_depend |
| 8 |
WHERE refclassid = 'pg_extension'::regclass AND |
| 9 |
refobjid = (SELECT oid FROM pg_extension |
| 10 |
WHERE extname = 'pg_walinspect') AND deptype = 'e' |
| 11 |
ORDER BY pg_describe_object(classid, objid, 0) COLLATE "C"; |
| 12 |
obj |
| 13 |
----------------------------------------------------------- |
| 14 |
function pg_get_wal_record_info(pg_lsn) |
| 15 |
function pg_get_wal_records_info(pg_lsn,pg_lsn) |
| 16 |
function pg_get_wal_records_info_till_end_of_wal(pg_lsn) |
| 17 |
function pg_get_wal_stats(pg_lsn,pg_lsn,boolean) |
| 18 |
function pg_get_wal_stats_till_end_of_wal(pg_lsn,boolean) |
| 19 |
(5 rows) |
| 20 |
|
| 21 |
-- Make sure checkpoints don't interfere with the test. |
| 22 |
SELECT 'init' FROM pg_create_physical_replication_slot('regress_pg_walinspect_slot', true, false); |
| 23 |
?column? |
| 24 |
---------- |
| 25 |
init |
| 26 |
(1 row) |
| 27 |
|
| 28 |
CREATE TABLE sample_tbl(col1 int, col2 int); |
| 29 |
SELECT pg_current_wal_lsn() AS wal_lsn1 \gset |
| 30 |
INSERT INTO sample_tbl SELECT * FROM generate_series(1, 2); |
| 31 |
-- Tests for the past functions. |
| 32 |
SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_records_info_till_end_of_wal(:'wal_lsn1'); |
| 33 |
ok |
| 34 |
---- |
| 35 |
t |
| 36 |
(1 row) |
| 37 |
|
| 38 |
SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_stats_till_end_of_wal(:'wal_lsn1'); |
| 39 |
ok |
| 40 |
---- |
| 41 |
t |
| 42 |
(1 row) |
| 43 |
|
| 44 |
-- Failures with start LSNs. |
| 45 |
SELECT * FROM pg_get_wal_records_info_till_end_of_wal('FFFFFFFF/FFFFFFFF'); |
| 46 |
ERROR: WAL start LSN must be less than current LSN |
| 47 |
SELECT * FROM pg_get_wal_stats_till_end_of_wal('FFFFFFFF/FFFFFFFF'); |
| 48 |
ERROR: WAL start LSN must be less than current LSN |
| 49 |
-- Move to new version 1.1. |
| 50 |
ALTER EXTENSION pg_walinspect UPDATE TO '1.1'; |
| 51 |
-- List what version 1.1 contains. |
| 52 |
\dx+ pg_walinspect |
| 53 |
Objects in extension "pg_walinspect" |
| 54 |
Object description |
| 55 |
------------------------------------------------------- |
| 56 |
function pg_get_wal_block_info(pg_lsn,pg_lsn,boolean) |
| 57 |
function pg_get_wal_record_info(pg_lsn) |
| 58 |
function pg_get_wal_records_info(pg_lsn,pg_lsn) |
| 59 |
function pg_get_wal_stats(pg_lsn,pg_lsn,boolean) |
| 60 |
(4 rows) |
| 61 |
|
| 62 |
SELECT pg_drop_replication_slot('regress_pg_walinspect_slot'); |
| 63 |
pg_drop_replication_slot |
| 64 |
-------------------------- |
| 65 |
|
| 66 |
(1 row) |
| 67 |
|
| 68 |
DROP TABLE sample_tbl; |
| 69 |
DROP EXTENSION pg_walinspect; |