PostgreSQL Source Code  git master
pg_publication.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_publication.h
4  * definition of the "publication" system catalog (pg_publication)
5  *
6  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/catalog/pg_publication.h
10  *
11  * NOTES
12  * The Catalog.pm module reads this file and derives schema
13  * information.
14  *
15  *-------------------------------------------------------------------------
16  */
17 #ifndef PG_PUBLICATION_H
18 #define PG_PUBLICATION_H
19 
20 #include "catalog/genbki.h"
21 #include "catalog/objectaddress.h"
22 #include "catalog/pg_publication_d.h"
23 
24 /* ----------------
25  * pg_publication definition. cpp turns this into
26  * typedef struct FormData_pg_publication
27  * ----------------
28  */
29 CATALOG(pg_publication,6104,PublicationRelationId)
30 {
31  Oid oid; /* oid */
32 
33  NameData pubname; /* name of the publication */
34 
35  Oid pubowner; /* publication owner */
36 
37  /*
38  * indicates that this is special publication which should encompass all
39  * tables in the database (except for the unlogged and temp ones)
40  */
41  bool puballtables;
42 
43  /* true if inserts are published */
44  bool pubinsert;
45 
46  /* true if updates are published */
47  bool pubupdate;
48 
49  /* true if deletes are published */
50  bool pubdelete;
51 
52  /* true if truncates are published */
53  bool pubtruncate;
54 
55  /* true if partition changes are published using root schema */
56  bool pubviaroot;
58 
59 /* ----------------
60  * Form_pg_publication corresponds to a pointer to a tuple with
61  * the format of pg_publication relation.
62  * ----------------
63  */
65 
66 typedef struct PublicationActions
67 {
68  bool pubinsert;
69  bool pubupdate;
70  bool pubdelete;
73 
74 typedef struct Publication
75 {
77  char *name;
78  bool alltables;
79  bool pubviaroot;
81 } Publication;
82 
83 extern Publication *GetPublication(Oid pubid);
84 extern Publication *GetPublicationByName(const char *pubname, bool missing_ok);
85 extern List *GetRelationPublications(Oid relid);
86 
87 /*---------
88  * Expected values for pub_partopt parameter of GetRelationPublications(),
89  * which allows callers to specify which partitions of partitioned tables
90  * mentioned in the publication they expect to see.
91  *
92  * ROOT: only the table explicitly mentioned in the publication
93  * LEAF: only leaf partitions in given tree
94  * ALL: all partitions in given tree
95  */
96 typedef enum PublicationPartOpt
97 {
102 
103 extern List *GetPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt);
104 extern List *GetAllTablesPublications(void);
105 extern List *GetAllTablesPublicationRelations(bool pubviaroot);
106 
107 extern bool is_publishable_relation(Relation rel);
108 extern ObjectAddress publication_add_relation(Oid pubid, Relation targetrel,
109  bool if_not_exists);
110 
111 extern Oid get_publication_oid(const char *pubname, bool missing_ok);
112 extern char *get_publication_name(Oid pubid, bool missing_ok);
113 
114 
115 #endif /* PG_PUBLICATION_H */
PublicationActions pubactions
Oid get_publication_oid(const char *pubname, bool missing_ok)
ObjectAddress publication_add_relation(Oid pubid, Relation targetrel, bool if_not_exists)
List * GetAllTablesPublicationRelations(bool pubviaroot)
List * GetAllTablesPublications(void)
PublicationPartOpt
struct Publication Publication
bool is_publishable_relation(Relation rel)
unsigned int Oid
Definition: postgres_ext.h:31
FormData_pg_publication
Definition: c.h:617
List * GetRelationPublications(Oid relid)
struct PublicationActions PublicationActions
Publication * GetPublicationByName(const char *pubname, bool missing_ok)
CATALOG(pg_publication, 6104, PublicationRelationId)
List * GetPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt)
char * get_publication_name(Oid pubid, bool missing_ok)
FormData_pg_publication * Form_pg_publication
Definition: pg_list.h:50
Publication * GetPublication(Oid pubid)