PostgreSQL Source Code  git master
pg_publication.h File Reference
#include "catalog/genbki.h"
#include "catalog/objectaddress.h"
#include "catalog/pg_publication_d.h"
Include dependency graph for pg_publication.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PublicationActions
 
struct  Publication
 

Typedefs

typedef FormData_pg_publicationForm_pg_publication
 
typedef struct PublicationActions PublicationActions
 
typedef struct Publication Publication
 
typedef enum PublicationPartOpt PublicationPartOpt
 

Enumerations

enum  PublicationPartOpt { PUBLICATION_PART_ROOT, PUBLICATION_PART_LEAF, PUBLICATION_PART_ALL }
 

Functions

 CATALOG (pg_publication, 6104, PublicationRelationId)
 
PublicationGetPublication (Oid pubid)
 
PublicationGetPublicationByName (const char *pubname, bool missing_ok)
 
ListGetRelationPublications (Oid relid)
 
ListGetPublicationRelations (Oid pubid, PublicationPartOpt pub_partopt)
 
ListGetAllTablesPublications (void)
 
ListGetAllTablesPublicationRelations (bool pubviaroot)
 
bool is_publishable_relation (Relation rel)
 
ObjectAddress publication_add_relation (Oid pubid, Relation targetrel, bool if_not_exists)
 
Oid get_publication_oid (const char *pubname, bool missing_ok)
 
char * get_publication_name (Oid pubid, bool missing_ok)
 

Variables

 FormData_pg_publication
 

Typedef Documentation

◆ Form_pg_publication

Definition at line 64 of file pg_publication.h.

◆ Publication

typedef struct Publication Publication

◆ PublicationActions

◆ PublicationPartOpt

Enumeration Type Documentation

◆ PublicationPartOpt

Enumerator
PUBLICATION_PART_ROOT 
PUBLICATION_PART_LEAF 
PUBLICATION_PART_ALL 

Definition at line 96 of file pg_publication.h.

Function Documentation

◆ CATALOG()

CATALOG ( pg_publication  ,
6104  ,
PublicationRelationId   
)

Definition at line 29 of file pg_publication.h.

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;
unsigned int Oid
Definition: postgres_ext.h:31
FormData_pg_publication
Definition: c.h:609

◆ get_publication_name()

char* get_publication_name ( Oid  pubid,
bool  missing_ok 
)

Definition at line 481 of file pg_publication.c.

References elog, ERROR, GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum, pstrdup(), PUBLICATIONOID, ReleaseSysCache(), and SearchSysCache1().

Referenced by getObjectDescription(), and getObjectIdentityParts().

482 {
483  HeapTuple tup;
484  char *pubname;
485  Form_pg_publication pubform;
486 
488 
489  if (!HeapTupleIsValid(tup))
490  {
491  if (!missing_ok)
492  elog(ERROR, "cache lookup failed for publication %u", pubid);
493  return NULL;
494  }
495 
496  pubform = (Form_pg_publication) GETSTRUCT(tup);
497  pubname = pstrdup(NameStr(pubform->pubname));
498 
499  ReleaseSysCache(tup);
500 
501  return pubname;
502 }
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
char * pstrdup(const char *in)
Definition: mcxt.c:1186
#define ObjectIdGetDatum(X)
Definition: postgres.h:507
#define ERROR
Definition: elog.h:43
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:1116
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1164
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define elog(elevel,...)
Definition: elog.h:214
#define NameStr(name)
Definition: c.h:615
FormData_pg_publication * Form_pg_publication

◆ get_publication_oid()

Oid get_publication_oid ( const char *  pubname,
bool  missing_ok 
)

Definition at line 461 of file pg_publication.c.

References CStringGetDatum, ereport, errcode(), errmsg(), ERROR, GetSysCacheOid1, OidIsValid, and PUBLICATIONNAME.

Referenced by get_object_address_unqualified(), and GetPublicationByName().

462 {
463  Oid oid;
464 
465  oid = GetSysCacheOid1(PUBLICATIONNAME, Anum_pg_publication_oid,
466  CStringGetDatum(pubname));
467  if (!OidIsValid(oid) && !missing_ok)
468  ereport(ERROR,
469  (errcode(ERRCODE_UNDEFINED_OBJECT),
470  errmsg("publication \"%s\" does not exist", pubname)));
471  return oid;
472 }
#define GetSysCacheOid1(cacheId, oidcol, key1)
Definition: syscache.h:192
int errcode(int sqlerrcode)
Definition: elog.c:610
unsigned int Oid
Definition: postgres_ext.h:31
#define OidIsValid(objectId)
Definition: c.h:644
#define ERROR
Definition: elog.h:43
#define CStringGetDatum(X)
Definition: postgres.h:578
#define ereport(elevel,...)
Definition: elog.h:144
int errmsg(const char *fmt,...)
Definition: elog.c:824

◆ GetAllTablesPublicationRelations()

List* GetAllTablesPublicationRelations ( bool  pubviaroot)

Definition at line 352 of file pg_publication.c.

References AccessShareLock, BTEqualStrategyNumber, CharGetDatum, ForwardScanDirection, GETSTRUCT, heap_getnext(), is_publishable_class(), sort-test::key, lappend_oid(), NIL, ScanKeyInit(), table_beginscan_catalog(), table_close(), table_endscan(), and table_open().

Referenced by pg_get_publication_tables().

353 {
354  Relation classRel;
355  ScanKeyData key[1];
356  TableScanDesc scan;
357  HeapTuple tuple;
358  List *result = NIL;
359 
360  classRel = table_open(RelationRelationId, AccessShareLock);
361 
362  ScanKeyInit(&key[0],
363  Anum_pg_class_relkind,
364  BTEqualStrategyNumber, F_CHAREQ,
365  CharGetDatum(RELKIND_RELATION));
366 
367  scan = table_beginscan_catalog(classRel, 1, key);
368 
369  while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
370  {
371  Form_pg_class relForm = (Form_pg_class) GETSTRUCT(tuple);
372  Oid relid = relForm->oid;
373 
374  if (is_publishable_class(relid, relForm) &&
375  !(relForm->relispartition && pubviaroot))
376  result = lappend_oid(result, relid);
377  }
378 
379  table_endscan(scan);
380 
381  if (pubviaroot)
382  {
383  ScanKeyInit(&key[0],
384  Anum_pg_class_relkind,
385  BTEqualStrategyNumber, F_CHAREQ,
386  CharGetDatum(RELKIND_PARTITIONED_TABLE));
387 
388  scan = table_beginscan_catalog(classRel, 1, key);
389 
390  while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
391  {
392  Form_pg_class relForm = (Form_pg_class) GETSTRUCT(tuple);
393  Oid relid = relForm->oid;
394 
395  if (is_publishable_class(relid, relForm) &&
396  !relForm->relispartition)
397  result = lappend_oid(result, relid);
398  }
399 
400  table_endscan(scan);
401  table_close(classRel, AccessShareLock);
402  }
403 
404  return result;
405 }
#define NIL
Definition: pg_list.h:65
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:133
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
Definition: tableam.c:98
#define AccessShareLock
Definition: lockdefs.h:36
unsigned int Oid
Definition: postgres_ext.h:31
List * lappend_oid(List *list, Oid datum)
Definition: list.c:357
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
Definition: heapam.c:1290
#define CharGetDatum(X)
Definition: postgres.h:416
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:862
FormData_pg_class * Form_pg_class
Definition: pg_class.h:153
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Definition: scankey.c:76
static bool is_publishable_class(Oid relid, Form_pg_class reltuple)
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
Definition: pg_list.h:50
#define BTEqualStrategyNumber
Definition: stratnum.h:31

◆ GetAllTablesPublications()

List* GetAllTablesPublications ( void  )

Definition at line 311 of file pg_publication.c.

References AccessShareLock, BoolGetDatum, BTEqualStrategyNumber, GETSTRUCT, HeapTupleIsValid, InvalidOid, lappend_oid(), NIL, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().

Referenced by GetRelationPublicationActions().

312 {
313  List *result;
314  Relation rel;
315  ScanKeyData scankey;
316  SysScanDesc scan;
317  HeapTuple tup;
318 
319  /* Find all publications that are marked as for all tables. */
320  rel = table_open(PublicationRelationId, AccessShareLock);
321 
322  ScanKeyInit(&scankey,
323  Anum_pg_publication_puballtables,
324  BTEqualStrategyNumber, F_BOOLEQ,
325  BoolGetDatum(true));
326 
327  scan = systable_beginscan(rel, InvalidOid, false,
328  NULL, 1, &scankey);
329 
330  result = NIL;
331  while (HeapTupleIsValid(tup = systable_getnext(scan)))
332  {
333  Oid oid = ((Form_pg_publication) GETSTRUCT(tup))->oid;
334 
335  result = lappend_oid(result, oid);
336  }
337 
338  systable_endscan(scan);
340 
341  return result;
342 }
#define NIL
Definition: pg_list.h:65
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:133
void systable_endscan(SysScanDesc sysscan)
Definition: genam.c:529
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
#define AccessShareLock
Definition: lockdefs.h:36
unsigned int Oid
Definition: postgres_ext.h:31
List * lappend_oid(List *list, Oid datum)
Definition: list.c:357
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Definition: genam.c:356
HeapTuple systable_getnext(SysScanDesc sysscan)
Definition: genam.c:448
#define BoolGetDatum(X)
Definition: postgres.h:402
#define InvalidOid
Definition: postgres_ext.h:36
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Definition: scankey.c:76
FormData_pg_publication * Form_pg_publication
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
Definition: pg_list.h:50
#define BTEqualStrategyNumber
Definition: stratnum.h:31

◆ GetPublication()

Publication* GetPublication ( Oid  pubid)

Definition at line 413 of file pg_publication.c.

References Publication::alltables, elog, ERROR, GETSTRUCT, HeapTupleIsValid, Publication::name, NameStr, ObjectIdGetDatum, Publication::oid, palloc(), pstrdup(), Publication::pubactions, PublicationActions::pubdelete, PublicationActions::pubinsert, PUBLICATIONOID, PublicationActions::pubtruncate, PublicationActions::pubupdate, Publication::pubviaroot, ReleaseSysCache(), and SearchSysCache1().

Referenced by GetPublicationByName(), and publication_add_relation().

414 {
415  HeapTuple tup;
416  Publication *pub;
417  Form_pg_publication pubform;
418 
420  if (!HeapTupleIsValid(tup))
421  elog(ERROR, "cache lookup failed for publication %u", pubid);
422 
423  pubform = (Form_pg_publication) GETSTRUCT(tup);
424 
425  pub = (Publication *) palloc(sizeof(Publication));
426  pub->oid = pubid;
427  pub->name = pstrdup(NameStr(pubform->pubname));
428  pub->alltables = pubform->puballtables;
429  pub->pubactions.pubinsert = pubform->pubinsert;
430  pub->pubactions.pubupdate = pubform->pubupdate;
431  pub->pubactions.pubdelete = pubform->pubdelete;
432  pub->pubactions.pubtruncate = pubform->pubtruncate;
433  pub->pubviaroot = pubform->pubviaroot;
434 
435  ReleaseSysCache(tup);
436 
437  return pub;
438 }
PublicationActions pubactions
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
char * pstrdup(const char *in)
Definition: mcxt.c:1186
#define ObjectIdGetDatum(X)
Definition: postgres.h:507
#define ERROR
Definition: elog.h:43
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:1116
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1164
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
void * palloc(Size size)
Definition: mcxt.c:949
#define elog(elevel,...)
Definition: elog.h:214
#define NameStr(name)
Definition: c.h:615
FormData_pg_publication * Form_pg_publication

◆ GetPublicationByName()

Publication* GetPublicationByName ( const char *  pubname,
bool  missing_ok 
)

Definition at line 445 of file pg_publication.c.

References get_publication_oid(), GetPublication(), and OidIsValid.

Referenced by get_object_address_publication_rel(), LoadPublications(), and pg_get_publication_tables().

446 {
447  Oid oid;
448 
449  oid = get_publication_oid(pubname, missing_ok);
450 
451  return OidIsValid(oid) ? GetPublication(oid) : NULL;
452 }
unsigned int Oid
Definition: postgres_ext.h:31
#define OidIsValid(objectId)
Definition: c.h:644
Publication * GetPublication(Oid pubid)
Oid get_publication_oid(const char *pubname, bool missing_ok)

◆ GetPublicationRelations()

List* GetPublicationRelations ( Oid  pubid,
PublicationPartOpt  pub_partopt 
)

Definition at line 248 of file pg_publication.c.

References AccessShareLock, Assert, BTEqualStrategyNumber, find_all_inheritors(), get_rel_relkind(), GETSTRUCT, HeapTupleIsValid, lappend_oid(), lfirst_oid, list_concat(), NIL, NoLock, ObjectIdGetDatum, PUBLICATION_PART_ALL, PUBLICATION_PART_LEAF, PUBLICATION_PART_ROOT, PublicationRelPrrelidPrpubidIndexId, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().

Referenced by AlterPublicationOptions(), AlterPublicationTables(), and pg_get_publication_tables().

249 {
250  List *result;
251  Relation pubrelsrel;
252  ScanKeyData scankey;
253  SysScanDesc scan;
254  HeapTuple tup;
255 
256  /* Find all publications associated with the relation. */
257  pubrelsrel = table_open(PublicationRelRelationId, AccessShareLock);
258 
259  ScanKeyInit(&scankey,
260  Anum_pg_publication_rel_prpubid,
261  BTEqualStrategyNumber, F_OIDEQ,
262  ObjectIdGetDatum(pubid));
263 
265  true, NULL, 1, &scankey);
266 
267  result = NIL;
268  while (HeapTupleIsValid(tup = systable_getnext(scan)))
269  {
271 
272  pubrel = (Form_pg_publication_rel) GETSTRUCT(tup);
273 
274  if (get_rel_relkind(pubrel->prrelid) == RELKIND_PARTITIONED_TABLE &&
275  pub_partopt != PUBLICATION_PART_ROOT)
276  {
277  List *all_parts = find_all_inheritors(pubrel->prrelid, NoLock,
278  NULL);
279 
280  if (pub_partopt == PUBLICATION_PART_ALL)
281  result = list_concat(result, all_parts);
282  else if (pub_partopt == PUBLICATION_PART_LEAF)
283  {
284  ListCell *lc;
285 
286  foreach(lc, all_parts)
287  {
288  Oid partOid = lfirst_oid(lc);
289 
290  if (get_rel_relkind(partOid) != RELKIND_PARTITIONED_TABLE)
291  result = lappend_oid(result, partOid);
292  }
293  }
294  else
295  Assert(false);
296  }
297  else
298  result = lappend_oid(result, pubrel->prrelid);
299  }
300 
301  systable_endscan(scan);
302  table_close(pubrelsrel, AccessShareLock);
303 
304  return result;
305 }
#define NIL
Definition: pg_list.h:65
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:133
void systable_endscan(SysScanDesc sysscan)
Definition: genam.c:529
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
char get_rel_relkind(Oid relid)
Definition: lsyscache.c:1866
#define AccessShareLock
Definition: lockdefs.h:36
List * list_concat(List *list1, const List *list2)
Definition: list.c:515
unsigned int Oid
Definition: postgres_ext.h:31
List * lappend_oid(List *list, Oid datum)
Definition: list.c:357
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Definition: genam.c:356
HeapTuple systable_getnext(SysScanDesc sysscan)
Definition: genam.c:448
#define ObjectIdGetDatum(X)
Definition: postgres.h:507
#define NoLock
Definition: lockdefs.h:34
#define PublicationRelPrrelidPrpubidIndexId
Definition: indexing.h:355
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define Assert(condition)
Definition: c.h:738
List * find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, List **numparents)
Definition: pg_inherits.c:165
FormData_pg_publication_rel * Form_pg_publication_rel
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Definition: scankey.c:76
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
Definition: pg_list.h:50
#define BTEqualStrategyNumber
Definition: stratnum.h:31
#define lfirst_oid(lc)
Definition: pg_list.h:192

◆ GetRelationPublications()

List* GetRelationPublications ( Oid  relid)

Definition at line 219 of file pg_publication.c.

References GETSTRUCT, i, lappend_oid(), catclist::members, catclist::n_members, NIL, ObjectIdGetDatum, PUBLICATIONRELMAP, ReleaseSysCacheList, SearchSysCacheList1, and catctup::tuple.

Referenced by ATPrepChangePersistence(), get_rel_sync_entry(), and GetRelationPublicationActions().

220 {
221  List *result = NIL;
222  CatCList *pubrellist;
223  int i;
224 
225  /* Find all publications associated with the relation. */
227  ObjectIdGetDatum(relid));
228  for (i = 0; i < pubrellist->n_members; i++)
229  {
230  HeapTuple tup = &pubrellist->members[i]->tuple;
231  Oid pubid = ((Form_pg_publication_rel) GETSTRUCT(tup))->prpubid;
232 
233  result = lappend_oid(result, pubid);
234  }
235 
236  ReleaseSysCacheList(pubrellist);
237 
238  return result;
239 }
#define NIL
Definition: pg_list.h:65
int n_members
Definition: catcache.h:176
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
unsigned int Oid
Definition: postgres_ext.h:31
List * lappend_oid(List *list, Oid datum)
Definition: list.c:357
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
Definition: catcache.h:178
#define ObjectIdGetDatum(X)
Definition: postgres.h:507
#define SearchSysCacheList1(cacheId, key1)
Definition: syscache.h:210
#define ReleaseSysCacheList(x)
Definition: syscache.h:217
FormData_pg_publication_rel * Form_pg_publication_rel
int i
HeapTupleData tuple
Definition: catcache.h:121
Definition: pg_list.h:50

◆ is_publishable_relation()

bool is_publishable_relation ( Relation  rel)

Definition at line 111 of file pg_publication.c.

References is_publishable_class(), RelationData::rd_rel, and RelationGetRelid.

Referenced by GetRelationPublicationActions(), pgoutput_change(), and pgoutput_truncate().

112 {
113  return is_publishable_class(RelationGetRelid(rel), rel->rd_rel);
114 }
Form_pg_class rd_rel
Definition: rel.h:109
static bool is_publishable_class(Oid relid, Form_pg_class reltuple)
#define RelationGetRelid(relation)
Definition: rel.h:456

◆ publication_add_relation()

ObjectAddress publication_add_relation ( Oid  pubid,
Relation  targetrel,
bool  if_not_exists 
)

Definition at line 144 of file pg_publication.c.

References CacheInvalidateRelcache(), CatalogTupleInsert(), check_publication_add_relation(), DEPENDENCY_AUTO, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, GetNewOidWithIndex(), GetPublication(), heap_form_tuple(), heap_freetuple(), InvalidObjectAddress, Publication::name, ObjectAddressSet, ObjectIdGetDatum, PUBLICATIONRELMAP, PublicationRelObjectIndexId, recordDependencyOn(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheExists2, table_close(), table_open(), and values.

Referenced by PublicationAddTables().

146 {
147  Relation rel;
148  HeapTuple tup;
149  Datum values[Natts_pg_publication_rel];
150  bool nulls[Natts_pg_publication_rel];
151  Oid relid = RelationGetRelid(targetrel);
152  Oid prrelid;
153  Publication *pub = GetPublication(pubid);
154  ObjectAddress myself,
155  referenced;
156 
157  rel = table_open(PublicationRelRelationId, RowExclusiveLock);
158 
159  /*
160  * Check for duplicates. Note that this does not really prevent
161  * duplicates, it's here just to provide nicer error message in common
162  * case. The real protection is the unique key on the catalog.
163  */
165  ObjectIdGetDatum(pubid)))
166  {
168 
169  if (if_not_exists)
170  return InvalidObjectAddress;
171 
172  ereport(ERROR,
174  errmsg("relation \"%s\" is already member of publication \"%s\"",
175  RelationGetRelationName(targetrel), pub->name)));
176  }
177 
179 
180  /* Form a tuple. */
181  memset(values, 0, sizeof(values));
182  memset(nulls, false, sizeof(nulls));
183 
185  Anum_pg_publication_rel_oid);
186  values[Anum_pg_publication_rel_oid - 1] = ObjectIdGetDatum(prrelid);
187  values[Anum_pg_publication_rel_prpubid - 1] =
188  ObjectIdGetDatum(pubid);
189  values[Anum_pg_publication_rel_prrelid - 1] =
190  ObjectIdGetDatum(relid);
191 
192  tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
193 
194  /* Insert tuple into catalog. */
195  CatalogTupleInsert(rel, tup);
196  heap_freetuple(tup);
197 
198  ObjectAddressSet(myself, PublicationRelRelationId, prrelid);
199 
200  /* Add dependency on the publication */
201  ObjectAddressSet(referenced, PublicationRelationId, pubid);
202  recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
203 
204  /* Add dependency on the relation */
205  ObjectAddressSet(referenced, RelationRelationId, relid);
206  recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
207 
208  /* Close the table. */
210 
211  /* Invalidate relcache so that publication info is rebuilt. */
212  CacheInvalidateRelcache(targetrel);
213 
214  return myself;
215 }
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
Definition: catalog.c:317
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:133
#define RelationGetDescr(relation)
Definition: rel.h:482
int errcode(int sqlerrcode)
Definition: elog.c:610
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
Definition: pg_depend.c:43
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
Definition: heaptuple.c:1020
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1338
unsigned int Oid
Definition: postgres_ext.h:31
Publication * GetPublication(Oid pubid)
#define ObjectIdGetDatum(X)
Definition: postgres.h:507
#define ERROR
Definition: elog.h:43
static void check_publication_add_relation(Relation targetrel)
#define RowExclusiveLock
Definition: lockdefs.h:38
#define RelationGetRelationName(relation)
Definition: rel.h:490
uintptr_t Datum
Definition: postgres.h:367
#define ereport(elevel,...)
Definition: elog.h:144
#define SearchSysCacheExists2(cacheId, key1, key2)
Definition: syscache.h:185
#define ObjectAddressSet(addr, class_id, object_id)
Definition: objectaddress.h:40
#define PublicationRelObjectIndexId
Definition: indexing.h:352
void CacheInvalidateRelcache(Relation relation)
Definition: inval.c:1270
static Datum values[MAXATTR]
Definition: bootstrap.c:167
const ObjectAddress InvalidObjectAddress
int errmsg(const char *fmt,...)
Definition: elog.c:824
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
#define ERRCODE_DUPLICATE_OBJECT
Definition: streamutil.c:31
#define RelationGetRelid(relation)
Definition: rel.h:456
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Definition: indexing.c:183

Variable Documentation

◆ FormData_pg_publication

FormData_pg_publication

Definition at line 57 of file pg_publication.h.