File: create_publication.sql

package info (click to toggle)
sqlfluff 3.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,000 kB
  • sloc: python: 106,131; sql: 34,188; makefile: 52; sh: 8
file content (56 lines) | stat: -rw-r--r-- 1,594 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
CREATE PUBLICATION abc;

CREATE PUBLICATION abc FOR ALL TABLES;

CREATE PUBLICATION abc FOR TABLE def;

CREATE PUBLICATION abc FOR TABLE def, sch.ghi;

CREATE PUBLICATION abc FOR TABLE def, TABLE sch.ghi;

CREATE PUBLICATION abc FOR TABLE def*;

CREATE PUBLICATION abc FOR
    TABLE a,
    TABLE aa, ab, ac,
    TABLE ONLY b,
    TABLE c*,
    TABLE ca*, cb*,
    TABLE ONLY (d),
    TABLE e (col1),
    TABLE f (col2, col3),
    TABLE g* (col4, col5),
    TABLE h WHERE (col6 > col7),
    TABLE i (col8, col9) WHERE (col10 > col11),
    TABLES IN SCHEMA j,
    TABLES IN SCHEMA k,
    TABLES IN SCHEMA CURRENT_SCHEMA, l, m,
    TABLES IN SCHEMA n, o, p;

CREATE PUBLICATION abc FOR TABLE a, b
    WITH (publish = 'insert,update', publish_via_partition_root = TRUE);

CREATE PUBLICATION abc FOR TABLE a, b
    WITH (publish_via_partition_root = TRUE);

CREATE PUBLICATION abc FOR TABLE a, b
    WITH (publish = 'insert,update');

CREATE PUBLICATION abc WITH (publish = 'insert,update');

-- examples from https://www.postgresql.org/docs/15/sql-createpublication.html

CREATE PUBLICATION mypublication FOR TABLE users, departments;

CREATE PUBLICATION active_departments FOR TABLE departments WHERE (active IS TRUE);

CREATE PUBLICATION alltables FOR ALL TABLES;

CREATE PUBLICATION insert_only FOR TABLE mydata
    WITH (publish = 'insert');

CREATE PUBLICATION production_publication FOR TABLE users, departments, TABLES IN SCHEMA production;

CREATE PUBLICATION sales_publication FOR TABLES IN SCHEMA marketing, sales;

CREATE PUBLICATION users_filtered FOR TABLE users (user_id, firstname);