1/* -------------------------------------------------------------------------
3 * pg_subscription_rel.h
4 * definition of the system catalog containing the state for each
5 * replicated table in each subscription (pg_subscription_rel)
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/catalog/pg_subscription_rel.h
13 * The Catalog.pm module reads this file and derives schema
16 * -------------------------------------------------------------------------
18#ifndef PG_SUBSCRIPTION_REL_H
19#define PG_SUBSCRIPTION_REL_H
23#include "catalog/pg_subscription_rel_d.h" /* IWYU pragma: export */
27 * pg_subscription_rel definition. cpp turns this into
28 * typedef struct FormData_pg_subscription_rel
31 CATALOG(pg_subscription_rel,6102,SubscriptionRelRelationId)
33 Oid srsubid
BKI_LOOKUP(pg_subscription);
/* Oid of subscription */
35 char srsubstate;
/* state of the relation in subscription */
38 * Although srsublsn is a fixed-width type, it is allowed to be NULL, so
39 * we prevent direct C code access to it just as for a varlena field.
41#ifdef CATALOG_VARLEN /* variable-length fields start here */
44 * used for synchronization
45 * coordination, or NULL if not
52 DECLARE_UNIQUE_INDEX_PKEY(pg_subscription_rel_srrelid_srsubid_index, 6117, SubscriptionRelSrrelidSrsubidIndexId, pg_subscription_rel, btree(srrelid oid_ops, srsubid oid_ops));
54 MAKE_SYSCACHE(SUBSCRIPTIONRELMAP, pg_subscription_rel_srrelid_srsubid_index, 64);
56#ifdef EXPOSE_TO_CLIENT_CODE
62#define SUBREL_STATE_INIT 'i' /* initializing (sublsn NULL) */
63#define SUBREL_STATE_DATASYNC 'd' /* data is being synchronized (sublsn
65#define SUBREL_STATE_FINISHEDCOPY 'f' /* tablesync copy phase is completed
67#define SUBREL_STATE_SYNCDONE 's' /* synchronization finished in front of
68 * apply (sublsn set) */
69#define SUBREL_STATE_READY 'r' /* ready (sublsn set) */
71/* These are never stored in the catalog, we only use them for IPC. */
72#define SUBREL_STATE_UNKNOWN '0円' /* unknown state */
73#define SUBREL_STATE_SYNCWAIT 'w' /* waiting for sync */
74#define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */
76#endif /* EXPOSE_TO_CLIENT_CODE */
97#endif /* PG_SUBSCRIPTION_REL_H */
#define BKI_LOOKUP(catalog)
FormData_pg_subscription_rel * Form_pg_subscription_rel
void UpdateSubscriptionRelState(Oid subid, Oid relid, char state, XLogRecPtr sublsn, bool already_locked)
List * GetSubscriptionRelations(Oid subid, bool not_ready)
FormData_pg_subscription_rel
struct SubscriptionRelState SubscriptionRelState
void RemoveSubscriptionRel(Oid subid, Oid relid)
char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn)
void AddSubscriptionRelState(Oid subid, Oid relid, char state, XLogRecPtr sublsn, bool retain_lock)
DECLARE_UNIQUE_INDEX_PKEY(pg_subscription_rel_srrelid_srsubid_index, 6117, SubscriptionRelSrrelidSrsubidIndexId, pg_subscription_rel, btree(srrelid oid_ops, srsubid oid_ops))
bool HasSubscriptionRelations(Oid subid)
MAKE_SYSCACHE(SUBSCRIPTIONRELMAP, pg_subscription_rel_srrelid_srsubid_index, 64)
CATALOG(pg_subscription_rel, 6102, SubscriptionRelRelationId)
void UpdateDeadTupleRetentionStatus(Oid subid, bool active)