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.
5 -- List what version 1.0 contains, using a locale-independent sorting.
6 SELECT pg_describe_object(classid, objid, 0) AS obj
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";
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)
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);
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');
38 SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_stats_till_end_of_wal(:'wal_lsn1');
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.
53 Objects in extension "pg_walinspect"
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)
62 SELECT pg_drop_replication_slot('regress_pg_walinspect_slot');
63 pg_drop_replication_slot
64 --------------------------
68 DROP TABLE sample_tbl;
69 DROP EXTENSION pg_walinspect;