71 elog(
ERROR,
"too much output for sql interface");
75 memset(nulls, 0,
sizeof(nulls));
122 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
123 errmsg(
"slot name must not be null")));
138 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
139 errmsg(
"options array must not be null")));
145 p->binary_output = binary;
155 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
156 errmsg(
"array must be one-dimensional")));
161 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
162 errmsg(
"array must not contain nulls")));
176 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
177 errmsg(
"array must have even number of elements")));
179 for (
i = 0;
i < nelems;
i += 2)
223 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
224 errmsg(
"logical decoding output plugin \"%s\" produces binary output, but function \"%s\" expects textual data",
233 wait_for_wal_lsn = end_of_wal;
235 wait_for_wal_lsn =
Min(upto_lsn, end_of_wal);
239 ctx->output_writer_private = p;
252 while (ctx->reader->EndRecPtr < end_of_wal)
259 elog(
ERROR,
"could not find record for logical decoding: %s", errm);
270 upto_lsn <= ctx->reader->EndRecPtr)
272 if (upto_nchanges != 0 &&
273 upto_nchanges <= p->returned_rows)
377 transactional, flush);
#define PG_GETARG_ARRAYTYPE_P(n)
bool array_contains_nulls(ArrayType *array)
void deconstruct_array_builtin(ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
static Datum values[MAXATTR]
#define TextDatumGetCString(d)
#define Assert(condition)
void LogicalDecodingProcessRecord(LogicalDecodingContext *ctx, XLogReaderState *record)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_GETARG_BYTEA_PP(n)
#define PG_GETARG_TEXT_PP(n)
#define PG_GETARG_NAME(n)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
void InvalidateSystemCaches(void)
List * lappend(List *list, void *datum)
void LogicalConfirmReceivedLocation(XLogRecPtr lsn)
void FreeDecodingContext(LogicalDecodingContext *ctx)
void CheckLogicalDecodingRequirements(void)
LogicalDecodingContext * CreateDecodingContext(XLogRecPtr start_lsn, List *output_plugin_options, bool fast_forward, XLogReaderRoutine *xl_routine, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, LogicalOutputPluginWriterUpdateProgress update_progress)
static void LogicalOutputPrepareWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xid, bool last_write)
Datum pg_logical_slot_get_changes(PG_FUNCTION_ARGS)
static void LogicalOutputWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xid, bool last_write)
Datum pg_logical_emit_message_bytea(PG_FUNCTION_ARGS)
Datum pg_logical_slot_get_binary_changes(PG_FUNCTION_ARGS)
Datum pg_logical_emit_message_text(PG_FUNCTION_ARGS)
Datum pg_logical_slot_peek_binary_changes(PG_FUNCTION_ARGS)
Datum pg_logical_slot_peek_changes(PG_FUNCTION_ARGS)
struct DecodingOutputState DecodingOutputState
static Datum pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool binary)
DefElem * makeDefElem(char *name, Node *arg, int location)
int GetDatabaseEncoding(void)
bool pg_verify_mbstr(int encoding, const char *mbstr, int len, bool noError)
void * palloc0(Size size)
XLogRecPtr LogLogicalMessage(const char *prefix, const char *message, size_t size, bool transactional, bool flush)
#define CHECK_FOR_INTERRUPTS()
@ OUTPUT_PLUGIN_TEXTUAL_OUTPUT
static Datum LSNGetDatum(XLogRecPtr X)
static Datum PointerGetDatum(const void *X)
static Datum TransactionIdGetDatum(TransactionId X)
MemoryContextSwitchTo(old_ctx)
char * format_procedure(Oid procedure_oid)
ResourceOwner CurrentResourceOwner
void ReplicationSlotMarkDirty(void)
void ReplicationSlotAcquire(const char *name, bool nowait)
ReplicationSlot * MyReplicationSlot
void CheckSlotPermissions(void)
void ReplicationSlotRelease(void)
void WaitForStandbyConfirmation(XLogRecPtr wait_for_lsn)
void resetStringInfo(StringInfo str)
Tuplestorestate * tupstore
MemoryContext ecxt_per_query_memory
void * output_writer_private
ReplicationSlotPersistentData data
Tuplestorestate * setResult
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
String * makeString(char *str)
#define VARSIZE_ANY_EXHDR(PTR)
char * text_to_cstring(const text *t)
text * cstring_to_text_with_len(const char *s, int len)
bool RecoveryInProgress(void)
XLogRecPtr GetFlushRecPtr(TimeLineID *insertTLI)
#define XLogRecPtrIsInvalid(r)
#define InvalidXLogRecPtr
XLogRecord * XLogReadRecord(XLogReaderState *state, char **errormsg)
void XLogBeginRead(XLogReaderState *state, XLogRecPtr RecPtr)
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
void wal_segment_close(XLogReaderState *state)
void wal_segment_open(XLogReaderState *state, XLogSegNo nextSegNo, TimeLineID *tli_p)
int read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *cur_page)