Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT pg_current_xlog_insert_location();
pg_current_xlog_insert_location
---------------------------------
0/18C01E8
CHECKPOINT;
CREATE TABLE replication_example(id SERIAL PRIMARY KEY, somedata int, text varchar(120));
begin;
INSERT INTO replication_example(somedata, text) VALUES (1, 1);
INSERT INTO replication_example(somedata, text) VALUES (1, 2);
commit;
ALTER TABLE replication_example ADD COLUMN bar int;
INSERT INTO replication_example(somedata, text, bar) VALUES (2, 1, 4);
BEGIN;
INSERT INTO replication_example(somedata, text, bar) VALUES (2, 2, 4);
INSERT INTO replication_example(somedata, text, bar) VALUES (2, 3, 4);
commit;
ALTER TABLE replication_example DROP COLUMN bar;
INSERT INTO replication_example(somedata, text) VALUES (3, 1);
BEGIN;
INSERT INTO replication_example(somedata, text) VALUES (3, 2);
INSERT INTO replication_example(somedata, text) VALUES (3, 3);
commit;
SELECT pg_current_xlog_insert_location();
postgres=# SELECT pg_current_xlog_insert_location();
pg_current_xlog_insert_location
---------------------------------
0/18E14B0
(1 row)
SELECT decode_xlog('0/18C01E8', '0/18E14B0');
WARNING: tuple is: id:1 somedata:1 text:1
WARNING: tuple is: id:2 somedata:1 text:2
WARNING: tuple is: id:3 somedata:2 text:1 bar:4
WARNING: tuple is: id:4 somedata:2 text:2 bar:4
WARNING: tuple is: id:5 somedata:2 text:3 bar:4
WARNING: tuple is: id:6 somedata:3 text:1
WARNING: tuple is: id:7 somedata:3 text:2
WARNING: tuple is: id:8 somedata:3 text:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.