~ubuntu-branches/debian/sid/wal2json/sid

« back to all changes in this revision

Viewing changes to sql/delete4.sql

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2018-04-17 10:16:35 UTC
  • Revision ID: package-import@ubuntu.com-20180417101635-3zfd417g9aigarwo
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\set VERBOSITY terse
 
2
 
 
3
-- predictability
 
4
SET synchronous_commit = on;
 
5
 
 
6
DROP TABLE IF EXISTS table_with_unique;
 
7
 
 
8
CREATE TABLE table_with_unique (
 
9
a       smallserial,
 
10
b       smallint,
 
11
c       int,
 
12
d       bigint,
 
13
e       numeric(5,3) not null,
 
14
f       real not null,
 
15
g       double precision not null,
 
16
h       char(10),
 
17
i       varchar(30),
 
18
j       text,
 
19
k       bit varying(20),
 
20
l       timestamp,
 
21
m       date,
 
22
n       boolean not null,
 
23
o       json,
 
24
p       tsvector,
 
25
UNIQUE(g, n)
 
26
);
 
27
 
 
28
-- INSERT
 
29
INSERT INTO table_with_unique (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) VALUES(1, 2, 3, 3.54, 876.563452345, 1.23, 'teste', 'testando', 'um texto longo', B'001110010101010', '2013-11-02 17:30:52', '2013-02-04', false, '{ "a": 123 }', 'Old Old Parr'::tsvector);
 
30
INSERT INTO table_with_unique (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) VALUES(4, 5, 6, 3.54, 876.563452345, 4.56, 'teste', 'testando', 'um texto longo', B'001110010101010', '2013-11-02 17:30:52', '2013-02-04', true, '{ "a": 123 }', 'Old Old Parr'::tsvector);
 
31
 
 
32
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'wal2json');
 
33
 
 
34
-- DELETE: REPLICA IDENTITY INDEX
 
35
ALTER TABLE table_with_unique REPLICA IDENTITY USING INDEX table_with_unique_g_n_key;
 
36
DELETE FROM table_with_unique WHERE b = 1;
 
37
DELETE FROM table_with_unique WHERE n = true;
 
38
ALTER TABLE table_with_unique REPLICA IDENTITY DEFAULT;
 
39
 
 
40
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
 
41
SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');