Here are some examples on Pg::Snapshots usage:

Summary
-------
1-Complete Refresh
1.1-PostgreSQL <-> PostgreSQL (Local)
1.2-PostgreSQL <-> PostgreSQL (Remote)
1.3-PostgreSQL <-> Oracle
1.4-PostgreSQL <-> ODBC
1.5-PostgreSQL <-> Sybase
1.6-PostgreSQL <-> MySQL
1.7-PostgreSQL <-> Firebird
2-Fast Refresh
2.1-PostgreSQL <-> PostgreSQL (Local)
2.2-PostgreSQL <-> PostgreSQL (Remote)
2.3-PostgreSQL <-> Oracle


1-Complete Refresh

-------------------------------------------------------------------------
1.1-PostgreSQL <-> PostgreSQL (Local)

CREATE TABLE public.test_table (
pk int,
name varchar,
address varchar,
constraint test_table_pk primary key (pk));

INSERT INTO public.test_table VALUES (1, 'albert', '101 Wall Street');
INSERT INTO public.test_table VALUES (2, 'rachel', '1021 10th Street');
INSERT INTO public.test_table VALUES (3, 'chris', '220 20th Street');
INSERT INTO public.test_table VALUES (4, 'joe', '501 Rosewell Street');
INSERT INTO public.test_table VALUES (5, 'john', '321 Lake Street');
INSERT INTO public.test_table VALUES (6, 'linda', '212 Cuba Street');
INSERT INTO public.test_table VALUES (7, 'megan', '56 1st Street');
INSERT INTO public.test_table VALUES (8, 'sarah', '88 Dodgers Street');
INSERT INTO public.test_table VALUES (9, 'anthony', '99 Daemon Av');

select create_snapshot('public', 'test_table_snapshot', 'select * from public.test_table where name ilike ''a%''', null, 'complete', null);
select refresh_snapshot('public', 'test_table_snapshot');
select * from test_table_snapshot;
Result:
 pk |  name   |     address
----+---------+-----------------
  1 | albert  | 101 Wall Street
  9 | anthony | 99 Daemon Av

-------------------------------------------------------------------------
1.2-PostgreSQL <-> PostgreSQL (Remote)

Supposing you have two PostgreSQL servers:

SERVER 1: IP 172.16.0.1
SERVER 2: IP 172.16.0.20

---> On server 1:
CREATE ROLE server1_link LOGIN PASSWORD 'abcdefg';
CREATE TABLE public.source (
	id INT,
	name TEXT,
	CONSTRAINT source_pk PRIMARY KEY (id)
);
GRANT SELECT ON public.source TO server1_link;
INSERT INTO public.source(id, name) VALUES (1,'John Smith');
INSERT INTO public.source(id, name) VALUES(2,'Rob Tomson');
INSERT INTO public.source(id, name) VALUES(3,'Jane Fonda');
INSERT INTO public.source(id, name) VALUES(4,'Albert Einstein');
INSERT INTO public.source(id, name) VALUES(5,'Arnold Swartz');
INSERT INTO public.source(id, name) VALUES(6,'Claire Lindon');
INSERT INTO public.source(id, name) VALUES(7,'Matt Druppal');

SELECT snapshot_do('123456', 'ALLOW', 'public', 'source', '172.16.0.20');

---> On server 2:
SELECT create_dblink('server1', 'dbi:Pg:dbname=snaptest;host=172.16.0.1', 'server1_link', 'abcdefg', '{AutoCommit => 0}');
SELECT create_snapshot('public', 'source_at_target', 'select * from public.source', 'server1', 'complete', null);
SELECT refresh_snapshot('public', 'source_at_target');

-------------------------------------------------------------------------
1.3-PostgreSQL <-> Oracle
connect scott/tiger@DB

CREATE TABLE test_table (
pk number(8),
name varchar2(100),
address varchar(100),
constraint test_table_pk primary key (pk));

INSERT INTO test_table VALUES (1, 'albert', '101 Wall Street');
INSERT INTO test_table VALUES (2, 'rachel', '1021 10th Street');
INSERT INTO test_table VALUES (3, 'chris', '220 20th Street');
INSERT INTO test_table VALUES (4, 'joe', '501 Rosewell Street');
INSERT INTO test_table VALUES (5, 'john', '321 Lake Street');
INSERT INTO test_table VALUES (6, 'linda', '212 Cuba Street');
INSERT INTO test_table VALUES (7, 'megan', '56 1st Street');
INSERT INTO test_table VALUES (8, 'sarah', '88 Dodgers Street');
INSERT INTO test_table VALUES (9, 'anthony', '99 Daemon Av');

select create_dblink('my_oracle_link', 'dbi:Oracle:DB', 'scott', 'tiger', '');
select create_snapshot('public', 'test_table_snapshot', 'select * from scott.test_table where name like ''a%''', 'my_oracle_link', 'complete', null);
select refresh_snapshot('public', 'test_table_snapshot');
select * from test_table_snapshot;
Result:
 pk |  name   |     address
----+---------+-----------------
  1 | albert  | 101 Wall Street
  9 | anthony | 99 Daemon Av

-------------------------------------------------------------------------
1.4-PostgreSQL <-> ODBC

-------------------------------------------------------------------------
1.5-PostgreSQL <-> Sybase

-------------------------------------------------------------------------
1.6-PostgreSQL <-> MySQL

-------------------------------------------------------------------------
1.7-PostgreSQL <-> Firebird


2-Fast Refresh

-------------------------------------------------------------------------
2.1-PostgreSQL <-> PostgreSQL (Local)

-------------------------------------------------------------------------
2.2-PostgreSQL <-> PostgreSQL (Remote)

Supposing you have two PostgreSQL servers:

SERVER 1: IP 172.16.0.1
SERVER 2: IP 172.16.0.20

---> On server 1:
CREATE ROLE server1_link LOGIN PASSWORD 'abcdefg';
CREATE TABLE public.source (
	id INT,
	name TEXT,
	CONSTRAINT source_pk PRIMARY KEY (id)
);
GRANT SELECT ON public.source TO server1_link;
INSERT INTO public.source(id, name) VALUES (1,'John Smith');
INSERT INTO public.source(id, name) VALUES(2,'Rob Tomson');
INSERT INTO public.source(id, name) VALUES(3,'Jane Fonda');
INSERT INTO public.source(id, name) VALUES(4,'Albert Einstein');
INSERT INTO public.source(id, name) VALUES(5,'Arnold Swartz');
INSERT INTO public.source(id, name) VALUES(6,'Claire Lindon');
INSERT INTO public.source(id, name) VALUES(7,'Matt Druppal');

SELECT snapshot_do('123456', 'ALLOW', 'public', 'source', '172.16.0.20');
SELECT create_snapshot_log('public', 'source', 'PRIMARY KEY');

---> On server 2:
SELECT create_dblink('server1', 'dbi:Pg:dbname=snaptest;host=172.16.0.1', 'server1_link', 'abcdefg', '{AutoCommit => 0}');
SELECT create_snapshot('public', 'source_at_target', 'select * from public.source', 'server1', 'fast', null);
SELECT refresh_snapshot('public', 'source_at_target');

-------------------------------------------------------------------------
2.3-PostgreSQL <-> Oracle

-------------------------------------------------------------------------
