PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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"
22#include "catalog/pg_publication_d.h" /* IWYU pragma: export */
23
24/* ----------------
25 * pg_publication definition. cpp turns this into
26 * typedef struct FormData_pg_publication
27 * ----------------
28 */
30
32{
33 Oid oid; /* oid */
34
35 NameData pubname; /* name of the publication */
36
37 Oid pubowner BKI_LOOKUP(pg_authid); /* publication owner */
38
39 /*
40 * indicates that this is special publication which should encompass all
41 * tables in the database (except for the unlogged and temp ones)
42 */
43 bool puballtables;
44
45 /*
46 * indicates that this is special publication which should encompass all
47 * sequences in the database (except for the unlogged and temp ones)
48 */
49 bool puballsequences;
50
51 /* true if inserts are published */
52 bool pubinsert;
53
54 /* true if updates are published */
55 bool pubupdate;
56
57 /* true if deletes are published */
58 bool pubdelete;
59
60 /* true if truncates are published */
61 bool pubtruncate;
62
63 /* true if partition changes are published using root schema */
64 bool pubviaroot;
65
66 /*
67 * 'n'(none) if generated column data should not be published. 's'(stored)
68 * if stored generated column data should be published.
69 */
70 char pubgencols;
72
74
75/* ----------------
76 * Form_pg_publication corresponds to a pointer to a tuple with
77 * the format of pg_publication relation.
78 * ----------------
79 */
81
84
87
95
96typedef struct PublicationDesc
97{
99
100 /*
101 * true if the columns referenced in row filters which are used for UPDATE
102 * or DELETE are part of the replica identity or the publication actions
103 * do not include UPDATE or DELETE.
104 */
107
108 /*
109 * true if the columns are part of the replica identity or the publication
110 * actions do not include UPDATE or DELETE.
111 */
114
115 /*
116 * true if all generated columns that are part of replica identity are
117 * published or the publication actions do not include UPDATE or DELETE.
118 */
122
123#ifdef EXPOSE_TO_CLIENT_CODE
124
125typedef enum PublishGencolsType
126{
127 /* Generated columns present should not be replicated. */
129
130 /* Generated columns present should be replicated. */
132
134
135#endif /* EXPOSE_TO_CLIENT_CODE */
136
147
155
156extern Publication *GetPublication(Oid pubid);
157extern Publication *GetPublicationByName(const char *pubname, bool missing_ok);
160
161/*---------
162 * Expected values for pub_partopt parameter of
163 * GetIncludedPublicationRelations(), which allows callers to specify which
164 * partitions of partitioned tables mentioned in the publication they expect to
165 * see.
166 *
167 * ROOT: only the table explicitly mentioned in the publication
168 * LEAF: only leaf partitions in given tree
169 * ALL: all partitions in given tree
170 */
177
182extern List *GetAllTablesPublications(void);
183extern List *GetAllPublicationRelations(Oid pubid, char relkind, bool pubviaroot);
184extern List *GetPublicationSchemas(Oid pubid);
192 Oid relid);
194 int *ancestor_level);
195
196extern bool is_publishable_relation(Relation rel);
197extern bool is_schema_publication(Oid pubid);
198extern bool check_and_fetch_column_list(Publication *pub, Oid relid,
199 MemoryContext mcxt, Bitmapset **cols);
201 bool if_not_exists);
204 bool if_not_exists);
205
207 MemoryContext mcxt);
208extern Bitmapset *pub_form_cols_map(Relation relation,
209 PublishGencolsType include_gencols_type);
210
211#endif /* PG_PUBLICATION_H */
#define BEGIN_CATALOG_STRUCT
Definition genbki.h:37
#define DECLARE_UNIQUE_INDEX_PKEY(name, oid, oidmacro, tblname, decl)
Definition genbki.h:105
#define BKI_LOOKUP(catalog)
Definition genbki.h:65
#define END_CATALOG_STRUCT
Definition genbki.h:38
#define DECLARE_UNIQUE_INDEX(name, oid, oidmacro, tblname, decl)
Definition genbki.h:104
#define CATALOG(name, oid, oidmacro)
Definition genbki.h:42
#define MAKE_SYSCACHE(name, idxname, nbuckets)
Definition genbki.h:146
Bitmapset * pub_collist_validate(Relation targetrel, List *columns)
List * GetPubPartitionOptionRelations(List *result, PublicationPartOpt pub_partopt, Oid relid)
bool is_schema_publication(Oid pubid)
END_CATALOG_STRUCT typedef FormData_pg_publication * Form_pg_publication
ObjectAddress publication_add_schema(Oid pubid, Oid schemaid, bool if_not_exists)
List * GetPublicationSchemas(Oid pubid)
FormData_pg_publication
ObjectAddress publication_add_relation(Oid pubid, PublicationRelInfo *pri, bool if_not_exists)
List * GetAllTablesPublications(void)
List * GetAllSchemaPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt)
List * GetRelationIncludedPublications(Oid relid)
Publication * GetPublicationByName(const char *pubname, bool missing_ok)
List * GetSchemaPublications(Oid schemaid)
Oid GetTopMostAncestorInPublication(Oid puboid, List *ancestors, int *ancestor_level)
List * GetSchemaPublicationRelations(Oid schemaid, PublicationPartOpt pub_partopt)
List * GetIncludedPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt)
List * GetRelationExcludedPublications(Oid relid)
Bitmapset * pub_form_cols_map(Relation relation, PublishGencolsType include_gencols_type)
Publication * GetPublication(Oid pubid)
bool check_and_fetch_column_list(Publication *pub, Oid relid, MemoryContext mcxt, Bitmapset **cols)
List * GetAllPublicationRelations(Oid pubid, char relkind, bool pubviaroot)
Bitmapset * pub_collist_to_bitmapset(Bitmapset *columns, Datum pubcols, MemoryContext mcxt)
bool is_publishable_relation(Relation rel)
List * GetExcludedPublicationTables(Oid pubid, PublicationPartOpt pub_partopt)
PublicationPartOpt
@ PUBLICATION_PART_LEAF
@ PUBLICATION_PART_ROOT
@ PUBLICATION_PART_ALL
uint64_t Datum
Definition postgres.h:70
unsigned int Oid
static int fb(int x)
Definition pg_list.h:54
Definition nodes.h:135
PublicationActions pubactions
PublishGencolsType pubgencols_type
PublicationActions pubactions
Definition c.h:802