PostgreSQL Source Code  git master
pg_subscription_rel.h File Reference
#include "access/xlogdefs.h"
#include "catalog/genbki.h"
#include "catalog/pg_subscription_rel_d.h"
#include "nodes/pg_list.h"
Include dependency graph for pg_subscription_rel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SubscriptionRelState
 

Macros

#define SubscriptionRelSrrelidSrsubidIndexId   6117
 

Typedefs

typedef FormData_pg_subscription_relForm_pg_subscription_rel
 
typedef struct SubscriptionRelState SubscriptionRelState
 

Functions

 CATALOG (pg_subscription_rel, 6102, SubscriptionRelRelationId)
 
 DECLARE_UNIQUE_INDEX_PKEY (pg_subscription_rel_srrelid_srsubid_index, 6117, on pg_subscription_rel using btree(srrelid oid_ops, srsubid oid_ops))
 
void AddSubscriptionRelState (Oid subid, Oid relid, char state, XLogRecPtr sublsn)
 
void UpdateSubscriptionRelState (Oid subid, Oid relid, char state, XLogRecPtr sublsn)
 
char GetSubscriptionRelState (Oid subid, Oid relid, XLogRecPtr *sublsn)
 
void RemoveSubscriptionRel (Oid subid, Oid relid)
 
ListGetSubscriptionRelations (Oid subid)
 
ListGetSubscriptionNotReadyRelations (Oid subid)
 

Variables

 FormData_pg_subscription_rel
 

Macro Definition Documentation

◆ SubscriptionRelSrrelidSrsubidIndexId

#define SubscriptionRelSrrelidSrsubidIndexId   6117

Definition at line 53 of file pg_subscription_rel.h.

Typedef Documentation

◆ Form_pg_subscription_rel

◆ SubscriptionRelState

Function Documentation

◆ AddSubscriptionRelState()

void AddSubscriptionRelState ( Oid  subid,
Oid  relid,
char  state,
XLogRecPtr  sublsn 
)

Definition at line 238 of file pg_subscription.c.

References AccessShareLock, CatalogTupleInsert(), CharGetDatum, elog, ERROR, heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, InvalidXLogRecPtr, LockSharedObject(), LSNGetDatum, NoLock, ObjectIdGetDatum, RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, SUBSCRIPTIONRELMAP, table_close(), table_open(), and values.

Referenced by AlterSubscription_refresh(), and CreateSubscription().

240 {
241  Relation rel;
242  HeapTuple tup;
243  bool nulls[Natts_pg_subscription_rel];
244  Datum values[Natts_pg_subscription_rel];
245 
246  LockSharedObject(SubscriptionRelationId, subid, 0, AccessShareLock);
247 
248  rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
249 
250  /* Try finding existing mapping. */
252  ObjectIdGetDatum(relid),
253  ObjectIdGetDatum(subid));
254  if (HeapTupleIsValid(tup))
255  elog(ERROR, "subscription table %u in subscription %u already exists",
256  relid, subid);
257 
258  /* Form the tuple. */
259  memset(values, 0, sizeof(values));
260  memset(nulls, false, sizeof(nulls));
261  values[Anum_pg_subscription_rel_srsubid - 1] = ObjectIdGetDatum(subid);
262  values[Anum_pg_subscription_rel_srrelid - 1] = ObjectIdGetDatum(relid);
263  values[Anum_pg_subscription_rel_srsubstate - 1] = CharGetDatum(state);
264  if (sublsn != InvalidXLogRecPtr)
265  values[Anum_pg_subscription_rel_srsublsn - 1] = LSNGetDatum(sublsn);
266  else
267  nulls[Anum_pg_subscription_rel_srsublsn - 1] = true;
268 
269  tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
270 
271  /* Insert tuple into catalog. */
272  CatalogTupleInsert(rel, tup);
273 
274  heap_freetuple(tup);
275 
276  /* Cleanup. */
277  table_close(rel, NoLock);
278 }
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
#define RelationGetDescr(relation)
Definition: rel.h:495
#define AccessShareLock
Definition: lockdefs.h:36
#define LSNGetDatum(X)
Definition: pg_lsn.h:22
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
Definition: heaptuple.c:1020
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1338
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
#define ERROR
Definition: elog.h:46
#define NoLock
Definition: lockdefs.h:34
#define RowExclusiveLock
Definition: lockdefs.h:38
uintptr_t Datum
Definition: postgres.h:411
void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
Definition: lmgr.c:1017
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
Definition: regguts.h:317
#define CharGetDatum(X)
Definition: postgres.h:460
static Datum values[MAXATTR]
Definition: bootstrap.c:166
#define elog(elevel,...)
Definition: elog.h:232
#define SearchSysCacheCopy2(cacheId, key1, key2)
Definition: syscache.h:177
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Definition: indexing.c:221

◆ CATALOG()

CATALOG ( pg_subscription_rel  ,
6102  ,
SubscriptionRelRelationId   
)

Definition at line 31 of file pg_subscription_rel.h.

References BKI_FORCE_NULL, and BKI_LOOKUP.

32 {
33  Oid srsubid BKI_LOOKUP(pg_subscription); /* Oid of subscription */
34  Oid srrelid BKI_LOOKUP(pg_class); /* Oid of relation */
35  char srsubstate; /* state of the relation in subscription */
36 
37  /*
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.
40  */
41 #ifdef CATALOG_VARLEN /* variable-length fields start here */
42 
43  XLogRecPtr srsublsn BKI_FORCE_NULL; /* remote LSN of the state change
44  * used for synchronization
45  * coordination, or NULL if not
46  * valid */
47 #endif
unsigned int Oid
Definition: postgres_ext.h:31
FormData_pg_subscription_rel
#define BKI_FORCE_NULL
Definition: genbki.h:32
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
uint64 XLogRecPtr
Definition: xlogdefs.h:21

◆ DECLARE_UNIQUE_INDEX_PKEY()

DECLARE_UNIQUE_INDEX_PKEY ( pg_subscription_rel_srrelid_srsubid_index  ,
6117  ,
on pg_subscription_rel using   btreesrrelid oid_ops, srsubid oid_ops 
)

◆ GetSubscriptionNotReadyRelations()

List* GetSubscriptionNotReadyRelations ( Oid  subid)

Definition at line 513 of file pg_subscription.c.

References AccessShareLock, BTEqualStrategyNumber, CharGetDatum, DatumGetLSN, GETSTRUCT, HeapTupleIsValid, InvalidOid, InvalidXLogRecPtr, lappend(), SubscriptionRelState::lsn, NIL, ObjectIdGetDatum, palloc(), SubscriptionRelState::relid, ScanKeyInit(), SubscriptionRelState::state, SUBSCRIPTIONRELMAP, SysCacheGetAttr(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().

Referenced by DropSubscription(), and process_syncing_tables_for_apply().

514 {
515  List *res = NIL;
516  Relation rel;
517  HeapTuple tup;
518  int nkeys = 0;
519  ScanKeyData skey[2];
520  SysScanDesc scan;
521 
522  rel = table_open(SubscriptionRelRelationId, AccessShareLock);
523 
524  ScanKeyInit(&skey[nkeys++],
525  Anum_pg_subscription_rel_srsubid,
526  BTEqualStrategyNumber, F_OIDEQ,
527  ObjectIdGetDatum(subid));
528 
529  ScanKeyInit(&skey[nkeys++],
530  Anum_pg_subscription_rel_srsubstate,
531  BTEqualStrategyNumber, F_CHARNE,
532  CharGetDatum(SUBREL_STATE_READY));
533 
534  scan = systable_beginscan(rel, InvalidOid, false,
535  NULL, nkeys, skey);
536 
537  while (HeapTupleIsValid(tup = systable_getnext(scan)))
538  {
540  SubscriptionRelState *relstate;
541  Datum d;
542  bool isnull;
543 
544  subrel = (Form_pg_subscription_rel) GETSTRUCT(tup);
545 
546  relstate = (SubscriptionRelState *) palloc(sizeof(SubscriptionRelState));
547  relstate->relid = subrel->srrelid;
548  relstate->state = subrel->srsubstate;
550  Anum_pg_subscription_rel_srsublsn, &isnull);
551  if (isnull)
552  relstate->lsn = InvalidXLogRecPtr;
553  else
554  relstate->lsn = DatumGetLSN(d);
555 
556  res = lappend(res, relstate);
557  }
558 
559  /* Cleanup */
560  systable_endscan(scan);
562 
563  return res;
564 }
#define NIL
Definition: pg_list.h:65
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
void systable_endscan(SysScanDesc sysscan)
Definition: genam.c:595
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
#define AccessShareLock
Definition: lockdefs.h:36
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Definition: genam.c:383
HeapTuple systable_getnext(SysScanDesc sysscan)
Definition: genam.c:502
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
List * lappend(List *list, void *datum)
Definition: list.c:336
uintptr_t Datum
Definition: postgres.h:411
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1388
#define InvalidOid
Definition: postgres_ext.h:36
#define DatumGetLSN(X)
Definition: pg_lsn.h:21
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
FormData_pg_subscription_rel * Form_pg_subscription_rel
#define CharGetDatum(X)
Definition: postgres.h:460
void * palloc(Size size)
Definition: mcxt.c:1062
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

◆ GetSubscriptionRelations()

List* GetSubscriptionRelations ( Oid  subid)

Definition at line 460 of file pg_subscription.c.

References AccessShareLock, BTEqualStrategyNumber, DatumGetLSN, GETSTRUCT, HeapTupleIsValid, InvalidOid, InvalidXLogRecPtr, lappend(), SubscriptionRelState::lsn, NIL, ObjectIdGetDatum, palloc(), SubscriptionRelState::relid, ScanKeyInit(), SubscriptionRelState::state, SUBSCRIPTIONRELMAP, SysCacheGetAttr(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().

Referenced by AlterSubscription_refresh().

461 {
462  List *res = NIL;
463  Relation rel;
464  HeapTuple tup;
465  ScanKeyData skey[1];
466  SysScanDesc scan;
467 
468  rel = table_open(SubscriptionRelRelationId, AccessShareLock);
469 
470  ScanKeyInit(&skey[0],
471  Anum_pg_subscription_rel_srsubid,
472  BTEqualStrategyNumber, F_OIDEQ,
473  ObjectIdGetDatum(subid));
474 
475  scan = systable_beginscan(rel, InvalidOid, false,
476  NULL, 1, skey);
477 
478  while (HeapTupleIsValid(tup = systable_getnext(scan)))
479  {
481  SubscriptionRelState *relstate;
482  Datum d;
483  bool isnull;
484 
485  subrel = (Form_pg_subscription_rel) GETSTRUCT(tup);
486 
487  relstate = (SubscriptionRelState *) palloc(sizeof(SubscriptionRelState));
488  relstate->relid = subrel->srrelid;
489  relstate->state = subrel->srsubstate;
491  Anum_pg_subscription_rel_srsublsn, &isnull);
492  if (isnull)
493  relstate->lsn = InvalidXLogRecPtr;
494  else
495  relstate->lsn = DatumGetLSN(d);
496 
497  res = lappend(res, relstate);
498  }
499 
500  /* Cleanup */
501  systable_endscan(scan);
503 
504  return res;
505 }
#define NIL
Definition: pg_list.h:65
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
void systable_endscan(SysScanDesc sysscan)
Definition: genam.c:595
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
#define AccessShareLock
Definition: lockdefs.h:36
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Definition: genam.c:383
HeapTuple systable_getnext(SysScanDesc sysscan)
Definition: genam.c:502
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
List * lappend(List *list, void *datum)
Definition: list.c:336
uintptr_t Datum
Definition: postgres.h:411
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1388
#define InvalidOid
Definition: postgres_ext.h:36
#define DatumGetLSN(X)
Definition: pg_lsn.h:21
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
FormData_pg_subscription_rel * Form_pg_subscription_rel
void * palloc(Size size)
Definition: mcxt.c:1062
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

◆ GetSubscriptionRelState()

char GetSubscriptionRelState ( Oid  subid,
Oid  relid,
XLogRecPtr sublsn 
)

Definition at line 335 of file pg_subscription.c.

References AccessShareLock, DatumGetLSN, GETSTRUCT, HeapTupleIsValid, InvalidXLogRecPtr, ObjectIdGetDatum, ReleaseSysCache(), SearchSysCache2(), SUBSCRIPTIONRELMAP, SysCacheGetAttr(), table_close(), and table_open().

Referenced by AlterSubscription_refresh(), logicalrep_rel_open(), LogicalRepSyncTableStart(), and wait_for_relation_state_change().

336 {
337  HeapTuple tup;
338  char substate;
339  bool isnull;
340  Datum d;
341  Relation rel;
342 
343  /*
344  * This is to avoid the race condition with AlterSubscription which tries
345  * to remove this relstate.
346  */
347  rel = table_open(SubscriptionRelRelationId, AccessShareLock);
348 
349  /* Try finding the mapping. */
351  ObjectIdGetDatum(relid),
352  ObjectIdGetDatum(subid));
353 
354  if (!HeapTupleIsValid(tup))
355  {
357  *sublsn = InvalidXLogRecPtr;
358  return SUBREL_STATE_UNKNOWN;
359  }
360 
361  /* Get the state. */
362  substate = ((Form_pg_subscription_rel) GETSTRUCT(tup))->srsubstate;
363 
364  /* Get the LSN */
366  Anum_pg_subscription_rel_srsublsn, &isnull);
367  if (isnull)
368  *sublsn = InvalidXLogRecPtr;
369  else
370  *sublsn = DatumGetLSN(d);
371 
372  /* Cleanup */
373  ReleaseSysCache(tup);
374 
376 
377  return substate;
378 }
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
#define AccessShareLock
Definition: lockdefs.h:36
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
uintptr_t Datum
Definition: postgres.h:411
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1175
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1388
#define DatumGetLSN(X)
Definition: pg_lsn.h:21
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
FormData_pg_subscription_rel * Form_pg_subscription_rel
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
Definition: syscache.c:1138
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39

◆ RemoveSubscriptionRel()

void RemoveSubscriptionRel ( Oid  subid,
Oid  relid 
)

Definition at line 385 of file pg_subscription.c.

References BTEqualStrategyNumber, CatalogTupleDelete(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, ForwardScanDirection, get_rel_name(), get_subscription_name(), GETSTRUCT, heap_getnext(), HeapTupleIsValid, ObjectIdGetDatum, OidIsValid, RowExclusiveLock, ScanKeyInit(), HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), and table_open().

Referenced by AlterSubscription_refresh(), DropSubscription(), and heap_drop_with_catalog().

386 {
387  Relation rel;
388  TableScanDesc scan;
389  ScanKeyData skey[2];
390  HeapTuple tup;
391  int nkeys = 0;
392 
393  rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
394 
395  if (OidIsValid(subid))
396  {
397  ScanKeyInit(&skey[nkeys++],
398  Anum_pg_subscription_rel_srsubid,
400  F_OIDEQ,
401  ObjectIdGetDatum(subid));
402  }
403 
404  if (OidIsValid(relid))
405  {
406  ScanKeyInit(&skey[nkeys++],
407  Anum_pg_subscription_rel_srrelid,
409  F_OIDEQ,
410  ObjectIdGetDatum(relid));
411  }
412 
413  /* Do the search and delete what we found. */
414  scan = table_beginscan_catalog(rel, nkeys, skey);
416  {
418 
419  subrel = (Form_pg_subscription_rel) GETSTRUCT(tup);
420 
421  /*
422  * We don't allow to drop the relation mapping when the table
423  * synchronization is in progress unless the caller updates the
424  * corresponding subscription as well. This is to ensure that we don't
425  * leave tablesync slots or origins in the system when the
426  * corresponding table is dropped.
427  */
428  if (!OidIsValid(subid) && subrel->srsubstate != SUBREL_STATE_READY)
429  {
430  ereport(ERROR,
431  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
432  errmsg("could not drop relation mapping for subscription \"%s\"",
433  get_subscription_name(subrel->srsubid, false)),
434  errdetail("Table synchronization for relation \"%s\" is in progress and is in state \"%c\".",
435  get_rel_name(relid), subrel->srsubstate),
436 
437  /*
438  * translator: first %s is a SQL ALTER command and second %s is a
439  * SQL DROP command
440  */
441  errhint("Use %s to enable subscription if not already enabled or use %s to drop the subscription.",
442  "ALTER SUBSCRIPTION ... ENABLE",
443  "DROP SUBSCRIPTION ...")));
444  }
445 
446  CatalogTupleDelete(rel, &tup->t_self);
447  }
448  table_endscan(scan);
449 
451 }
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
int errhint(const char *fmt,...)
Definition: elog.c:1156
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
Definition: tableam.c:112
int errcode(int sqlerrcode)
Definition: elog.c:698
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
Definition: indexing.c:350
#define OidIsValid(objectId)
Definition: c.h:710
char * get_subscription_name(Oid subid, bool missing_ok)
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
#define ERROR
Definition: elog.h:46
ItemPointerData t_self
Definition: htup.h:65
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
Definition: heapam.c:1340
#define RowExclusiveLock
Definition: lockdefs.h:38
int errdetail(const char *fmt,...)
Definition: elog.c:1042
#define ereport(elevel,...)
Definition: elog.h:157
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
FormData_pg_subscription_rel * Form_pg_subscription_rel
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:991
int errmsg(const char *fmt,...)
Definition: elog.c:909
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
char * get_rel_name(Oid relid)
Definition: lsyscache.c:1899
#define BTEqualStrategyNumber
Definition: stratnum.h:31

◆ UpdateSubscriptionRelState()

void UpdateSubscriptionRelState ( Oid  subid,
Oid  relid,
char  state,
XLogRecPtr  sublsn 
)

Definition at line 284 of file pg_subscription.c.

References AccessShareLock, CatalogTupleUpdate(), CharGetDatum, elog, ERROR, heap_modify_tuple(), HeapTupleIsValid, InvalidXLogRecPtr, LockSharedObject(), LSNGetDatum, NoLock, ObjectIdGetDatum, RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, SUBSCRIPTIONRELMAP, HeapTupleData::t_self, table_close(), table_open(), and values.

Referenced by LogicalRepSyncTableStart(), process_syncing_tables_for_apply(), and process_syncing_tables_for_sync().

286 {
287  Relation rel;
288  HeapTuple tup;
289  bool nulls[Natts_pg_subscription_rel];
290  Datum values[Natts_pg_subscription_rel];
291  bool replaces[Natts_pg_subscription_rel];
292 
293  LockSharedObject(SubscriptionRelationId, subid, 0, AccessShareLock);
294 
295  rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
296 
297  /* Try finding existing mapping. */
299  ObjectIdGetDatum(relid),
300  ObjectIdGetDatum(subid));
301  if (!HeapTupleIsValid(tup))
302  elog(ERROR, "subscription table %u in subscription %u does not exist",
303  relid, subid);
304 
305  /* Update the tuple. */
306  memset(values, 0, sizeof(values));
307  memset(nulls, false, sizeof(nulls));
308  memset(replaces, false, sizeof(replaces));
309 
310  replaces[Anum_pg_subscription_rel_srsubstate - 1] = true;
311  values[Anum_pg_subscription_rel_srsubstate - 1] = CharGetDatum(state);
312 
313  replaces[Anum_pg_subscription_rel_srsublsn - 1] = true;
314  if (sublsn != InvalidXLogRecPtr)
315  values[Anum_pg_subscription_rel_srsublsn - 1] = LSNGetDatum(sublsn);
316  else
317  nulls[Anum_pg_subscription_rel_srsublsn - 1] = true;
318 
319  tup = heap_modify_tuple(tup, RelationGetDescr(rel), values, nulls,
320  replaces);
321 
322  /* Update the catalog. */
323  CatalogTupleUpdate(rel, &tup->t_self, tup);
324 
325  /* Cleanup. */
326  table_close(rel, NoLock);
327 }
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
#define RelationGetDescr(relation)
Definition: rel.h:495
#define AccessShareLock
Definition: lockdefs.h:36
#define LSNGetDatum(X)
Definition: pg_lsn.h:22
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
#define ERROR
Definition: elog.h:46
ItemPointerData t_self
Definition: htup.h:65
#define NoLock
Definition: lockdefs.h:34
#define RowExclusiveLock
Definition: lockdefs.h:38
uintptr_t Datum
Definition: postgres.h:411
void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
Definition: lmgr.c:1017
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
Definition: regguts.h:317
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
Definition: indexing.c:301
#define CharGetDatum(X)
Definition: postgres.h:460
static Datum values[MAXATTR]
Definition: bootstrap.c:166
#define elog(elevel,...)
Definition: elog.h:232
#define SearchSysCacheCopy2(cacheId, key1, key2)
Definition: syscache.h:177
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *replValues, bool *replIsnull, bool *doReplace)
Definition: heaptuple.c:1113

Variable Documentation

◆ FormData_pg_subscription_rel

FormData_pg_subscription_rel

Definition at line 48 of file pg_subscription_rel.h.