1 /* ------------------------------------------------------------------------- 2 * 3 * pg_subscription.h 4 * definition of the "subscription" system catalog (pg_subscription) 5 * 6 * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group 7 * Portions Copyright (c) 1994, Regents of the University of California 8 * 9 * src/include/catalog/pg_subscription.h 10 * 11 * NOTES 12 * The Catalog.pm module reads this file and derives schema 13 * information. 14 * 15 * ------------------------------------------------------------------------- 16 */ 17 #ifndef PG_SUBSCRIPTION_H 18 #define PG_SUBSCRIPTION_H 19 20 #include "catalog/genbki.h" 21 #include "catalog/pg_subscription_d.h" 22 23 #include "nodes/pg_list.h" 24 25 /* ---------------- 26 * pg_subscription definition. cpp turns this into 27 * typedef struct FormData_pg_subscription 28 * ---------------- 29 */ 30 31 /* 32 * Technically, the subscriptions live inside the database, so a shared catalog 33 * seems weird, but the replication launcher process needs to access all of 34 * them to be able to start the workers, so we have to put them in a shared, 35 * nailed catalog. 36 * 37 * NOTE: When adding a column, also update system_views.sql. 38 */ 39 CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO 40 { 41 Oid subdbid; /* Database the subscription is in. */ 42 NameData subname; /* Name of the subscription */ 43 44 Oid subowner; /* Owner of the subscription */ 45 46 bool subenabled; /* True if the subscription is enabled (the 47 * worker should be running) */ 48 49 #ifdef CATALOG_VARLEN /* variable-length fields start here */ 50 /* Connection string to the publisher */ 51 text subconninfo BKI_FORCE_NOT_NULL; 52 53 /* Slot name on publisher */ 54 NameData subslotname; 55 56 /* Synchronous commit setting for worker */ 57 text subsynccommit BKI_FORCE_NOT_NULL; 58 59 /* List of publications subscribed to */ 60 text subpublications[1] BKI_FORCE_NOT_NULL; 61 #endif 62 } FormData_pg_subscription; 63 64 typedef FormData_pg_subscription *Form_pg_subscription; 65 66 typedef struct Subscription 67 { 68 Oid oid; /* Oid of the subscription */ 69 Oid dbid; /* Oid of the database which subscription is 70 * in */ 71 char *name; /* Name of the subscription */ 72 Oid owner; /* Oid of the subscription owner */ 73 bool enabled; /* Indicates if the subscription is enabled */ 74 char *conninfo; /* Connection string to the publisher */ 75 char *slotname; /* Name of the replication slot */ 76 char *synccommit; /* Synchronous commit setting for worker */ 77 List *publications; /* List of publication names to subscribe to */ 78 } Subscription; 79 80 extern Subscription *GetSubscription(Oid subid, bool missing_ok); 81 extern void FreeSubscription(Subscription *sub); 82 extern Oid get_subscription_oid(const char *subname, bool missing_ok); 83 extern char *get_subscription_name(Oid subid); 84 85 extern int CountDBSubscriptions(Oid dbid); 86 87 #endif /* PG_SUBSCRIPTION_H */ 88