1/*-------------------------------------------------------------------------
2 *
3 * pg_publication.h
4 * definition of the "publication" system catalog (pg_publication)
5 *
6 * Portions Copyright (c) 1996-2019, 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/pg_publication_d.h"
22
23#include "catalog/objectaddress.h"
24
25/* ----------------
26 * pg_publication definition. cpp turns this into
27 * typedef struct FormData_pg_publication
28 * ----------------
29 */
30CATALOG(pg_publication,6104,PublicationRelationId)
31{
32 Oid oid; /* oid */
33
34 NameData pubname; /* name of the publication */
35
36 Oid pubowner; /* publication owner */
37
38 /*
39 * indicates that this is special publication which should encompass all
40 * tables in the database (except for the unlogged and temp ones)
41 */
42 bool puballtables;
43
44 /* true if inserts are published */
45 bool pubinsert;
46
47 /* true if updates are published */
48 bool pubupdate;
49
50 /* true if deletes are published */
51 bool pubdelete;
52
53 /* true if truncates are published */
54 bool pubtruncate;
55
56} FormData_pg_publication;
57
58/* ----------------
59 * Form_pg_publication corresponds to a pointer to a tuple with
60 * the format of pg_publication relation.
61 * ----------------
62 */
63typedef FormData_pg_publication *Form_pg_publication;
64
65typedef struct PublicationActions
66{
67 bool pubinsert;
68 bool pubupdate;
69 bool pubdelete;
70 bool pubtruncate;
71} PublicationActions;
72
73typedef struct Publication
74{
75 Oid oid;
76 char *name;
77 bool alltables;
78 PublicationActions pubactions;
79} Publication;
80
81extern Publication *GetPublication(Oid pubid);
82extern Publication *GetPublicationByName(const char *pubname, bool missing_ok);
83extern List *GetRelationPublications(Oid relid);
84extern List *GetPublicationRelations(Oid pubid);
85extern List *GetAllTablesPublications(void);
86extern List *GetAllTablesPublicationRelations(void);
87
88extern bool is_publishable_relation(Relation rel);
89extern ObjectAddress publication_add_relation(Oid pubid, Relation targetrel,
90 bool if_not_exists);
91
92extern Oid get_publication_oid(const char *pubname, bool missing_ok);
93extern char *get_publication_name(Oid pubid, bool missing_ok);
94
95extern Datum pg_get_publication_tables(PG_FUNCTION_ARGS);
96
97#endif /* PG_PUBLICATION_H */
98