PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
subscriptioncmds.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * subscriptioncmds.c
4  * subscription catalog manipulation functions
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * IDENTIFICATION
10  * subscriptioncmds.c
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 #include "postgres.h"
16 
17 #include "miscadmin.h"
18 
19 #include "access/heapam.h"
20 #include "access/htup_details.h"
21 
22 #include "catalog/indexing.h"
23 #include "catalog/objectaccess.h"
24 #include "catalog/objectaddress.h"
25 #include "catalog/pg_type.h"
27 
28 #include "commands/defrem.h"
29 #include "commands/event_trigger.h"
31 
33 #include "replication/origin.h"
36 
37 #include "storage/lmgr.h"
38 
39 #include "utils/builtins.h"
40 #include "utils/memutils.h"
41 #include "utils/syscache.h"
42 
43 /*
44  * Common option parsing function for CREATE and ALTER SUBSCRIPTION commands.
45  *
46  * Since not all options can be specified in both commands, this function
47  * will report an error on options if the target output pointer is NULL to
48  * accomodate that.
49  */
50 static void
52  List **publications, bool *enabled_given,
53  bool *enabled, bool *create_slot, char **slot_name)
54 {
55  ListCell *lc;
56  bool create_slot_given = false;
57 
58  if (conninfo)
59  *conninfo = NULL;
60  if (publications)
61  *publications = NIL;
62  if (enabled)
63  {
64  *enabled_given = false;
65  *enabled = true;
66  }
67  if (create_slot)
68  *create_slot = true;
69  if (slot_name)
70  *slot_name = NULL;
71 
72  /* Parse options */
73  foreach (lc, options)
74  {
75  DefElem *defel = (DefElem *) lfirst(lc);
76 
77  if (strcmp(defel->defname, "conninfo") == 0 && conninfo)
78  {
79  if (*conninfo)
80  ereport(ERROR,
81  (errcode(ERRCODE_SYNTAX_ERROR),
82  errmsg("conflicting or redundant options")));
83 
84  *conninfo = defGetString(defel);
85  }
86  else if (strcmp(defel->defname, "publication") == 0 && publications)
87  {
88  if (*publications)
89  ereport(ERROR,
90  (errcode(ERRCODE_SYNTAX_ERROR),
91  errmsg("conflicting or redundant options")));
92 
93  *publications = defGetStringList(defel);
94  }
95  else if (strcmp(defel->defname, "enabled") == 0 && enabled)
96  {
97  if (*enabled_given)
98  ereport(ERROR,
99  (errcode(ERRCODE_SYNTAX_ERROR),
100  errmsg("conflicting or redundant options")));
101 
102  *enabled_given = true;
103  *enabled = defGetBoolean(defel);
104  }
105  else if (strcmp(defel->defname, "disabled") == 0 && enabled)
106  {
107  if (*enabled_given)
108  ereport(ERROR,
109  (errcode(ERRCODE_SYNTAX_ERROR),
110  errmsg("conflicting or redundant options")));
111 
112  *enabled_given = true;
113  *enabled = !defGetBoolean(defel);
114  }
115  else if (strcmp(defel->defname, "create slot") == 0 && create_slot)
116  {
117  if (create_slot_given)
118  ereport(ERROR,
119  (errcode(ERRCODE_SYNTAX_ERROR),
120  errmsg("conflicting or redundant options")));
121 
122  create_slot_given = true;
123  *create_slot = defGetBoolean(defel);
124  }
125  else if (strcmp(defel->defname, "nocreate slot") == 0 && create_slot)
126  {
127  if (create_slot_given)
128  ereport(ERROR,
129  (errcode(ERRCODE_SYNTAX_ERROR),
130  errmsg("conflicting or redundant options")));
131 
132  create_slot_given = true;
133  *create_slot = !defGetBoolean(defel);
134  }
135  else if (strcmp(defel->defname, "slot name") == 0 && slot_name)
136  {
137  if (*slot_name)
138  ereport(ERROR,
139  (errcode(ERRCODE_SYNTAX_ERROR),
140  errmsg("conflicting or redundant options")));
141 
142  *slot_name = defGetString(defel);
143  }
144  else
145  elog(ERROR, "unrecognized option: %s", defel->defname);
146  }
147 }
148 
149 /*
150  * Auxiliary function to return a text array out of a list of String nodes.
151  */
152 static Datum
154 {
155  ArrayType *arr;
156  Datum *datums;
157  int j = 0;
158  ListCell *cell;
159  MemoryContext memcxt;
160  MemoryContext oldcxt;
161 
162  /* Create memory context for temporary allocations. */
164  "publicationListToArray to array",
168  oldcxt = MemoryContextSwitchTo(memcxt);
169 
170  datums = palloc(sizeof(text *) * list_length(publist));
171  foreach(cell, publist)
172  {
173  char *name = strVal(lfirst(cell));
174  ListCell *pcell;
175 
176  /* Check for duplicates. */
177  foreach(pcell, publist)
178  {
179  char *pname = strVal(lfirst(cell));
180 
181  if (name == pname)
182  break;
183 
184  if (strcmp(name, pname) == 0)
185  ereport(ERROR,
186  (errcode(ERRCODE_SYNTAX_ERROR),
187  errmsg("publication name \"%s\" used more than once",
188  pname)));
189  }
190 
191  datums[j++] = CStringGetTextDatum(name);
192  }
193 
194  MemoryContextSwitchTo(oldcxt);
195 
196  arr = construct_array(datums, list_length(publist),
197  TEXTOID, -1, false, 'i');
198  MemoryContextDelete(memcxt);
199 
200  return PointerGetDatum(arr);
201 }
202 
203 /*
204  * Create new subscription.
205  */
208 {
209  Relation rel;
210  ObjectAddress myself;
211  Oid subid;
212  bool nulls[Natts_pg_subscription];
214  Oid owner = GetUserId();
215  HeapTuple tup;
216  bool enabled_given;
217  bool enabled;
218  char *conninfo;
219  char *slotname;
220  char originname[NAMEDATALEN];
221  bool create_slot;
222  List *publications;
223 
224  if (!superuser())
225  ereport(ERROR,
226  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
227  (errmsg("must be superuser to create subscriptions"))));
228 
230 
231  /* Check if name is used */
233  CStringGetDatum(stmt->subname));
234  if (OidIsValid(subid))
235  {
236  ereport(ERROR,
238  errmsg("subscription \"%s\" already exists",
239  stmt->subname)));
240  }
241 
242  /*
243  * Parse and check options.
244  * Connection and publication should not be specified here.
245  */
247  &enabled_given, &enabled,
248  &create_slot, &slotname);
249  if (slotname == NULL)
250  slotname = stmt->subname;
251 
252  conninfo = stmt->conninfo;
253  publications = stmt->publication;
254 
255  /* Load the library providing us libpq calls. */
256  load_file("libpqwalreceiver", false);
257 
258  /* Check the connection info string. */
259  walrcv_check_conninfo(conninfo);
260 
261  /* Everything ok, form a new tuple. */
262  memset(values, 0, sizeof(values));
263  memset(nulls, false, sizeof(nulls));
264 
266  values[Anum_pg_subscription_subname - 1] =
268  values[Anum_pg_subscription_subowner - 1] = ObjectIdGetDatum(owner);
269  values[Anum_pg_subscription_subenabled - 1] = BoolGetDatum(enabled);
271  CStringGetTextDatum(conninfo);
275  publicationListToArray(publications);
276 
277  tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
278 
279  /* Insert tuple into catalog. */
280  subid = CatalogTupleInsert(rel, tup);
281  heap_freetuple(tup);
282 
284 
285  snprintf(originname, sizeof(originname), "pg_%u", subid);
286  replorigin_create(originname);
287 
288  /*
289  * If requested, create the replication slot on remote side for our
290  * newly created subscription.
291  */
292  if (create_slot)
293  {
294  XLogRecPtr lsn;
295  char *err;
297 
298  /* Try to connect to the publisher. */
299  wrconn = walrcv_connect(conninfo, true, stmt->subname, &err);
300  if (!wrconn)
301  ereport(ERROR,
302  (errmsg("could not connect to the publisher: %s", err)));
303 
304  PG_TRY();
305  {
306  walrcv_create_slot(wrconn, slotname, false, &lsn);
307  ereport(NOTICE,
308  (errmsg("created replication slot \"%s\" on publisher",
309  slotname)));
310  }
311  PG_CATCH();
312  {
313  /* Close the connection in case of failure. */
314  walrcv_disconnect(wrconn);
315  PG_RE_THROW();
316  }
317  PG_END_TRY();
318 
319  /* And we are done with the remote side. */
320  walrcv_disconnect(wrconn);
321  }
322 
324 
326 
328 
330 
331  return myself;
332 }
333 
334 /*
335  * Alter the existing subscription.
336  */
339 {
340  Relation rel;
341  ObjectAddress myself;
342  bool nulls[Natts_pg_subscription];
343  bool replaces[Natts_pg_subscription];
345  HeapTuple tup;
346  Oid subid;
347  bool enabled_given;
348  bool enabled;
349  char *conninfo;
350  char *slot_name;
351  List *publications;
352 
354 
355  /* Fetch the existing tuple. */
357  CStringGetDatum(stmt->subname));
358 
359  if (!HeapTupleIsValid(tup))
360  ereport(ERROR,
361  (errcode(ERRCODE_UNDEFINED_OBJECT),
362  errmsg("subscription \"%s\" does not exist",
363  stmt->subname)));
364 
365  /* must be owner */
368  stmt->subname);
369 
370  subid = HeapTupleGetOid(tup);
371 
372  /* Parse options. */
373  parse_subscription_options(stmt->options, &conninfo, &publications,
374  &enabled_given, &enabled,
375  NULL, &slot_name);
376 
377  /* Form a new tuple. */
378  memset(values, 0, sizeof(values));
379  memset(nulls, false, sizeof(nulls));
380  memset(replaces, false, sizeof(replaces));
381 
382  if (enabled_given)
383  {
384  values[Anum_pg_subscription_subenabled - 1] = BoolGetDatum(enabled);
385  replaces[Anum_pg_subscription_subenabled - 1] = true;
386  }
387  if (conninfo)
388  {
390  CStringGetTextDatum(conninfo);
391  replaces[Anum_pg_subscription_subconninfo - 1] = true;
392  }
393  if (slot_name)
394  {
397  replaces[Anum_pg_subscription_subslotname - 1] = true;
398  }
399  if (publications != NIL)
400  {
402  publicationListToArray(publications);
403  replaces[Anum_pg_subscription_subpublications - 1] = true;
404  }
405 
406  tup = heap_modify_tuple(tup, RelationGetDescr(rel), values, nulls,
407  replaces);
408 
409  /* Update the catalog. */
410  CatalogTupleUpdate(rel, &tup->t_self, tup);
411 
413 
414  /* Cleanup. */
415  heap_freetuple(tup);
417 
419 
420  return myself;
421 }
422 
423 /*
424  * Drop a subscription
425  */
426 void
428 {
429  Relation rel;
430  ObjectAddress myself;
431  HeapTuple tup;
432  Oid subid;
433  Datum datum;
434  bool isnull;
435  char *subname;
436  char *conninfo;
437  char *slotname;
438  char originname[NAMEDATALEN];
439  char *err = NULL;
440  RepOriginId originid;
442  StringInfoData cmd;
443 
445 
447  CStringGetDatum(stmt->subname));
448 
449  if (!HeapTupleIsValid(tup))
450  {
451  heap_close(rel, NoLock);
452 
453  if (!stmt->missing_ok)
454  ereport(ERROR,
455  (errcode(ERRCODE_UNDEFINED_OBJECT),
456  errmsg("subscription \"%s\" does not exist",
457  stmt->subname)));
458  else
459  ereport(NOTICE,
460  (errmsg("subscription \"%s\" does not exist, skipping",
461  stmt->subname)));
462 
463  return;
464  }
465 
466  subid = HeapTupleGetOid(tup);
467 
468  /* must be owner */
469  if (!pg_subscription_ownercheck(subid, GetUserId()))
471  stmt->subname);
472 
473  /* DROP hook for the subscription being removed */
475 
476  /*
477  * Lock the subscription so nobody else can do anything with it
478  * (including the replication workers).
479  */
481 
482  /* Get subname */
483  datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
485  Assert(!isnull);
486  subname = pstrdup(NameStr(*DatumGetName(datum)));
487 
488  /* Get conninfo */
489  datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
491  Assert(!isnull);
492  conninfo = pstrdup(TextDatumGetCString(datum));
493 
494  /* Get slotname */
495  datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
497  Assert(!isnull);
498  slotname = pstrdup(NameStr(*DatumGetName(datum)));
499 
501  EventTriggerSQLDropAddObject(&myself, true, true);
502 
503  /* Remove the tuple from catalog. */
504  CatalogTupleDelete(rel, &tup->t_self);
505 
506  ReleaseSysCache(tup);
507 
508  /* Clean up dependencies */
510 
511  /* Protect against launcher restarting the worker. */
512  LWLockAcquire(LogicalRepLauncherLock, LW_EXCLUSIVE);
513 
514  /* Kill the apply worker so that the slot becomes accessible. */
515  logicalrep_worker_stop(subid);
516 
517  LWLockRelease(LogicalRepLauncherLock);
518 
519  /* Remove the origin tracking if exists. */
520  snprintf(originname, sizeof(originname), "pg_%u", subid);
521  originid = replorigin_by_name(originname, true);
522  if (originid != InvalidRepOriginId)
523  replorigin_drop(originid);
524 
525  /* If the user asked to not drop the slot, we are done mow.*/
526  if (!stmt->drop_slot)
527  {
528  heap_close(rel, NoLock);
529  return;
530  }
531 
532  /*
533  * Otherwise drop the replication slot at the publisher node using
534  * the replication connection.
535  */
536  load_file("libpqwalreceiver", false);
537 
538  initStringInfo(&cmd);
539  appendStringInfo(&cmd, "DROP_REPLICATION_SLOT \"%s\"", slotname);
540 
541  wrconn = walrcv_connect(conninfo, true, subname, &err);
542  if (wrconn == NULL)
543  ereport(ERROR,
544  (errmsg("could not connect to publisher when attempting to "
545  "drop the replication slot \"%s\"", slotname),
546  errdetail("The error was: %s", err)));
547 
548  if (!walrcv_command(wrconn, cmd.data, &err))
549  {
550  /* Close the connection in case of failure */
551  walrcv_disconnect(wrconn);
552  ereport(ERROR,
553  (errmsg("could not drop the replication slot \"%s\" on publisher",
554  slotname),
555  errdetail("The error was: %s", err)));
556  }
557  else
558  ereport(NOTICE,
559  (errmsg("dropped replication slot \"%s\" on publisher",
560  slotname)));
561 
562  walrcv_disconnect(wrconn);
563 
564  pfree(cmd.data);
565 
566  heap_close(rel, NoLock);
567 }
568 
569 /*
570  * Internal workhorse for changing a subscription owner
571  */
572 static void
574 {
576 
577  form = (Form_pg_subscription) GETSTRUCT(tup);
578 
579  if (form->subowner == newOwnerId)
580  return;
581 
584  NameStr(form->subname));
585 
586  /* New owner must be a superuser */
587  if (!superuser_arg(newOwnerId))
588  ereport(ERROR,
589  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
590  errmsg("permission denied to change owner of subscription \"%s\"",
591  NameStr(form->subname)),
592  errhint("The owner of an subscription must be a superuser.")));
593 
594  form->subowner = newOwnerId;
595  CatalogTupleUpdate(rel, &tup->t_self, tup);
596 
597  /* Update owner dependency reference */
599  HeapTupleGetOid(tup),
600  newOwnerId);
601 
603  HeapTupleGetOid(tup), 0);
604 }
605 
606 /*
607  * Change subscription owner -- by name
608  */
610 AlterSubscriptionOwner(const char *name, Oid newOwnerId)
611 {
612  Oid subid;
613  HeapTuple tup;
614  Relation rel;
615  ObjectAddress address;
616 
618 
620  CStringGetDatum(name));
621 
622  if (!HeapTupleIsValid(tup))
623  ereport(ERROR,
624  (errcode(ERRCODE_UNDEFINED_OBJECT),
625  errmsg("subscription \"%s\" does not exist", name)));
626 
627  subid = HeapTupleGetOid(tup);
628 
629  AlterSubscriptionOwner_internal(rel, tup, newOwnerId);
630 
631  ObjectAddressSet(address, SubscriptionRelationId, subid);
632 
633  heap_freetuple(tup);
634 
636 
637  return address;
638 }
639 
640 /*
641  * Change subscription owner -- by OID
642  */
643 void
645 {
646  HeapTuple tup;
647  Relation rel;
648 
650 
652 
653  if (!HeapTupleIsValid(tup))
654  ereport(ERROR,
655  (errcode(ERRCODE_UNDEFINED_OBJECT),
656  errmsg("subscription with OID %u does not exist", subid)));
657 
658  AlterSubscriptionOwner_internal(rel, tup, newOwnerId);
659 
660  heap_freetuple(tup);
661 
663 }
#define NIL
Definition: pg_list.h:69
#define walrcv_command(conn, cmd, err)
Definition: walreceiver.h:229
WalReceiverConn * wrconn
Definition: worker.c:106
ObjectAddress AlterSubscription(AlterSubscriptionStmt *stmt)
void MemoryContextDelete(MemoryContext context)
Definition: mcxt.c:200
Datum namein(PG_FUNCTION_ARGS)
Definition: name.c:46
int errhint(const char *fmt,...)
Definition: elog.c:987
#define GETSTRUCT(TUP)
Definition: htup_details.h:656
#define Anum_pg_subscription_subpublications
#define InvokeObjectPostCreateHook(classId, objectId, subId)
Definition: objectaccess.h:145
#define Anum_pg_subscription_subowner
#define RelationGetDescr(relation)
Definition: rel.h:425
Oid GetUserId(void)
Definition: miscinit.c:283
#define TEXTOID
Definition: pg_type.h:324
#define PointerGetDatum(X)
Definition: postgres.h:564
#define walrcv_check_conninfo(conninfo)
Definition: walreceiver.h:211
char * pstrdup(const char *in)
Definition: mcxt.c:1165
#define InvokeObjectDropHook(classId, objectId, subId)
Definition: objectaccess.h:154
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
ArrayType * construct_array(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:3306
uint16 RepOriginId
Definition: xlogdefs.h:51
#define strVal(v)
Definition: value.h:54
int errcode(int sqlerrcode)
Definition: elog.c:575
bool superuser(void)
Definition: superuser.c:47
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
Definition: indexing.c:255
static Datum publicationListToArray(List *publist)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
Definition: heaptuple.c:692
#define heap_close(r, l)
Definition: heapam.h:97
#define DirectFunctionCall1(func, arg1)
Definition: fmgr.h:555
FormData_pg_subscription * Form_pg_subscription
void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner)
Definition: pg_shdepend.c:158
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1374
unsigned int Oid
Definition: postgres_ext.h:31
#define OidIsValid(objectId)
Definition: c.h:534
List * defGetStringList(DefElem *def)
Definition: define.c:327
RepOriginId replorigin_by_name(char *roname, bool missing_ok)
Definition: origin.c:206
#define ALLOCSET_DEFAULT_MINSIZE
Definition: memutils.h:142
#define GetSysCacheOid2(cacheId, key1, key2)
Definition: syscache.h:178
void LWLockRelease(LWLock *lock)
Definition: lwlock.c:1714
#define NAMEDATALEN
#define DatumGetName(X)
Definition: postgres.h:593
void changeDependencyOnOwner(Oid classId, Oid objectId, Oid newOwnerId)
Definition: pg_shdepend.c:303
bool defGetBoolean(DefElem *def)
Definition: define.c:111
void pfree(void *pointer)
Definition: mcxt.c:992
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:110
#define ObjectIdGetDatum(X)
Definition: postgres.h:515
#define ERROR
Definition: elog.h:43
Oid CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Definition: indexing.c:162
#define Natts_pg_subscription
void DropSubscription(DropSubscriptionStmt *stmt)
#define Anum_pg_subscription_subname
char * defGetString(DefElem *def)
Definition: define.c:49
ItemPointerData t_self
Definition: htup.h:65
ObjectAddress CreateSubscription(CreateSubscriptionStmt *stmt)
static void parse_subscription_options(List *options, char **conninfo, List **publications, bool *enabled_given, bool *enabled, bool *create_slot, char **slot_name)
#define SubscriptionRelationId
#define NoLock
Definition: lockdefs.h:34
void aclcheck_error(AclResult aclerr, AclObjectKind objectkind, const char *objectname)
Definition: aclchk.c:3378
#define RowExclusiveLock
Definition: lockdefs.h:38
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define CStringGetDatum(X)
Definition: postgres.h:586
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
RepOriginId replorigin_create(char *roname)
Definition: origin.c:235
ObjectAddress AlterSubscriptionOwner(const char *name, Oid newOwnerId)
#define ereport(elevel, rest)
Definition: elog.h:122
#define InvokeObjectPostAlterHook(classId, objectId, subId)
Definition: objectaccess.h:163
bool superuser_arg(Oid roleid)
Definition: superuser.c:57
void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, int32 objectSubId)
Definition: pg_shdepend.c:822
#define Anum_pg_subscription_subslotname
void initStringInfo(StringInfo str)
Definition: stringinfo.c:65
#define Anum_pg_subscription_subdbid
void replorigin_drop(RepOriginId roident)
Definition: origin.c:327
#define TextDatumGetCString(d)
Definition: builtins.h:91
MemoryContext AllocSetContextCreate(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)
Definition: aset.c:440
uintptr_t Datum
Definition: postgres.h:374
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1083
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1245
Oid MyDatabaseId
Definition: globals.c:76
Relation heap_open(Oid relationId, LOCKMODE lockmode)
Definition: heapam.c:1287
void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
Definition: lmgr.c:871
#define BoolGetDatum(X)
Definition: postgres.h:410
static void AlterSubscriptionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
#define NOTICE
Definition: elog.h:37
#define Anum_pg_subscription_subconninfo
#define PG_CATCH()
Definition: elog.h:293
#define HeapTupleIsValid(tuple)
Definition: htup.h:77
#define NULL
Definition: c.h:226
uint64 XLogRecPtr
Definition: xlogdefs.h:21
#define Assert(condition)
Definition: c.h:671
#define lfirst(lc)
Definition: pg_list.h:106
void load_file(const char *filename, bool restricted)
Definition: dfmgr.c:133
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
Definition: indexing.c:210
static int list_length(const List *l)
Definition: pg_list.h:89
void EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool normal)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
Definition: lwlock.c:1110
#define PG_RE_THROW()
Definition: elog.h:314
#define walrcv_disconnect(conn)
Definition: walreceiver.h:231
const char * name
Definition: encode.c:521
#define InvalidRepOriginId
Definition: origin.h:34
#define ObjectAddressSet(addr, class_id, object_id)
Definition: objectaddress.h:40
#define Anum_pg_subscription_subenabled
static Datum values[MAXATTR]
Definition: bootstrap.c:162
#define SearchSysCacheCopy1(cacheId, key1)
Definition: syscache.h:158
#define AccessExclusiveLock
Definition: lockdefs.h:46
void * palloc(Size size)
Definition: mcxt.c:891
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define ALLOCSET_DEFAULT_INITSIZE
Definition: memutils.h:143
void AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId)
#define NameStr(name)
Definition: c.h:495
void logicalrep_worker_stop(Oid subid)
Definition: launcher.c:313
#define CStringGetTextDatum(s)
Definition: builtins.h:90
#define walrcv_create_slot(conn, slotname, temporary, lsn)
Definition: walreceiver.h:227
Definition: c.h:435
char * defname
Definition: parsenodes.h:675
#define ALLOCSET_DEFAULT_MAXSIZE
Definition: memutils.h:144
#define elog
Definition: elog.h:219
#define HeapTupleGetOid(tuple)
Definition: htup_details.h:695
void ApplyLauncherWakeupAtCommit(void)
Definition: launcher.c:541
#define SearchSysCacheCopy2(cacheId, key1, key2)
Definition: syscache.h:160
#define PG_TRY()
Definition: elog.h:284
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *replValues, bool *replIsnull, bool *doReplace)
Definition: heaptuple.c:793
#define ERRCODE_DUPLICATE_OBJECT
Definition: streamutil.c:34
Definition: pg_list.h:45
#define PG_END_TRY()
Definition: elog.h:300
bool pg_subscription_ownercheck(Oid sub_oid, Oid roleid)
Definition: aclchk.c:5085
#define walrcv_connect(conninfo, logical, appname, err)
Definition: walreceiver.h:209
#define SearchSysCache2(cacheId, key1, key2)
Definition: syscache.h:151