26 .
name =
"test_decoding",
76 bool transactional,
const char *prefix,
77 Size sz,
const char *message);
116 bool transactional,
const char *prefix,
117 Size sz,
const char *message);
168 "text conversion context",
170 data->include_xids =
true;
171 data->include_timestamp =
false;
172 data->skip_empty_xacts =
false;
173 data->only_local =
false;
190 data->include_xids =
true;
194 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
200 data->include_timestamp =
true;
204 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
216 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
226 data->skip_empty_xacts =
true;
230 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
237 data->only_local =
true;
241 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
252 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
262 errmsg(
"could not parse value \"%s\" for parameter \"%s\"",
269 errmsg(
"option \"%s\" = \"%s\" is unknown",
296 txndata->xact_wrote_changes =
false;
303 if (
data->skip_empty_xacts)
313 if (
data->include_xids)
327 bool xact_wrote_changes =
txndata->xact_wrote_changes;
332 if (
data->skip_empty_xacts && !xact_wrote_changes)
336 if (
data->include_xids)
341 if (
data->include_timestamp)
356 txndata->xact_wrote_changes =
false;
363 if (
data->skip_empty_xacts)
381 if (
data->skip_empty_xacts && !
txndata->xact_wrote_changes)
389 if (
data->include_xids)
392 if (
data->include_timestamp)
411 if (
data->include_xids)
414 if (
data->include_timestamp)
435 if (
data->include_xids)
438 if (
data->include_timestamp)
547 if (attr->attisdropped)
554 if (attr->attnum < 0)
557 typid = attr->atttypid;
562 if (isnull && skip_nulls)
576 &typoutput, &typisvarlena);
586 else if (!typisvarlena)
616 if (
data->skip_empty_xacts && !
txndata->xact_wrote_changes)
620 txndata->xact_wrote_changes =
true;
702 if (
data->skip_empty_xacts && !
txndata->xact_wrote_changes)
706 txndata->xact_wrote_changes =
true;
722 NameStr(relations[
i]->rd_rel->relname)));
747 const char *prefix,
Size sz,
const char *message)
755 if (transactional &&
data->skip_empty_xacts && !
txndata->xact_wrote_changes)
759 txndata->xact_wrote_changes =
true;
763 transactional, prefix,
sz);
782 txndata->xact_wrote_changes =
false;
786 txndata->stream_wrote_changes =
false;
787 if (
data->skip_empty_xacts)
796 if (
data->include_xids)
810 if (
data->skip_empty_xacts && !
txndata->stream_wrote_changes)
814 if (
data->include_xids)
835 bool xact_wrote_changes =
txndata->xact_wrote_changes;
844 if (
data->skip_empty_xacts && !xact_wrote_changes)
848 if (
data->include_xids)
863 if (
data->skip_empty_xacts && !
txndata->xact_wrote_changes)
868 if (
data->include_xids)
875 if (
data->include_timestamp)
889 bool xact_wrote_changes =
txndata->xact_wrote_changes;
894 if (
data->skip_empty_xacts && !xact_wrote_changes)
899 if (
data->include_xids)
904 if (
data->include_timestamp)
926 if (
data->skip_empty_xacts && !
txndata->stream_wrote_changes)
930 txndata->xact_wrote_changes =
txndata->stream_wrote_changes =
true;
933 if (
data->include_xids)
948 const char *prefix,
Size sz,
const char *message)
956 if (
data->skip_empty_xacts && !
txndata->stream_wrote_changes)
960 txndata->xact_wrote_changes =
txndata->stream_wrote_changes =
true;
968 transactional, prefix,
sz);
972 appendStringInfo(ctx->
out,
"streaming message: transactional: %d prefix: %s, sz: %zu content:",
973 transactional, prefix,
sz);
992 if (
data->skip_empty_xacts && !
txndata->stream_wrote_changes)
996 txndata->xact_wrote_changes =
txndata->stream_wrote_changes =
true;
999 if (
data->include_xids)
const char * timestamptz_to_str(TimestampTz t)
bool parse_bool(const char *value, bool *result)
#define Assert(condition)
#define SQL_STR_DOUBLE(ch, escape_backslash)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define palloc0_object(type)
char * OidOutputFunctionCall(Oid functionId, Datum val)
#define PG_MODULE_MAGIC_EXT(...)
#define PG_DETOAST_DATUM(datum)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write)
void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write)
char * get_rel_name(Oid relid)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
Oid get_rel_namespace(Oid relid)
char * get_namespace_name(Oid nspid)
void MemoryContextReset(MemoryContext context)
void * MemoryContextAllocZero(MemoryContext context, Size size)
void pfree(void *pointer)
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define IsA(nodeptr, _type_)
#define InvalidRepOriginId
@ OUTPUT_PLUGIN_BINARY_OUTPUT
@ OUTPUT_PLUGIN_TEXTUAL_OUTPUT
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
FormData_pg_attribute * Form_pg_attribute
FormData_pg_class * Form_pg_class
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
char * quote_literal_cstr(const char *rawstr)
#define RelationGetForm(relation)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define rbtxn_is_toptxn(txn)
#define rbtxn_get_toptxn(txn)
@ REORDER_BUFFER_CHANGE_INSERT
@ REORDER_BUFFER_CHANGE_DELETE
@ REORDER_BUFFER_CHANGE_UPDATE
char * quote_qualified_identifier(const char *qualifier, const char *ident)
const char * quote_identifier(const char *ident)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void * output_plugin_private
List * output_plugin_options
LogicalDecodeStreamChangeCB stream_change_cb
LogicalDecodeMessageCB message_cb
LogicalDecodeStreamTruncateCB stream_truncate_cb
LogicalDecodeStreamMessageCB stream_message_cb
LogicalDecodeFilterPrepareCB filter_prepare_cb
LogicalDecodeFilterByOriginCB filter_by_origin_cb
LogicalDecodeTruncateCB truncate_cb
LogicalDecodeStreamStopCB stream_stop_cb
LogicalDecodeStreamCommitCB stream_commit_cb
LogicalDecodeRollbackPreparedCB rollback_prepared_cb
LogicalDecodeStreamPrepareCB stream_prepare_cb
LogicalDecodeCommitPreparedCB commit_prepared_cb
LogicalDecodeStreamStartCB stream_start_cb
LogicalDecodePrepareCB prepare_cb
LogicalDecodeStartupCB startup_cb
LogicalDecodeCommitCB commit_cb
LogicalDecodeBeginCB begin_cb
LogicalDecodeStreamAbortCB stream_abort_cb
LogicalDecodeBeginPrepareCB begin_prepare_cb
LogicalDecodeChangeCB change_cb
LogicalDecodeShutdownCB shutdown_cb
OutputPluginOutputType output_type
struct ReorderBufferChange::@115::@116 tp
ReorderBufferChangeType action
struct ReorderBufferChange::@115::@117 truncate
union ReorderBufferChange::@115 data
void * output_plugin_private
bool stream_wrote_changes
static void pg_decode_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr prepare_lsn)
static void pg_decode_stream_start(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
static void pg_decode_rollback_prepared_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr prepare_end_lsn, TimestampTz prepare_time)
static void pg_decode_commit_prepared_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
static void pg_decode_begin_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)
static void pg_decode_begin_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
static void pg_output_begin(LogicalDecodingContext *ctx, TestDecodingData *data, ReorderBufferTXN *txn, bool last_write)
static void pg_decode_commit_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
static void print_literal(StringInfo s, Oid typid, char *outputstr)
static void pg_decode_stream_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)
static void pg_decode_message(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr lsn, bool transactional, const char *prefix, Size sz, const char *message)
static void pg_decode_shutdown(LogicalDecodingContext *ctx)
static void pg_decode_stream_abort(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr abort_lsn)
static void pg_decode_stream_prepare(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr prepare_lsn)
static void pg_decode_stream_commit(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
static bool pg_decode_filter(LogicalDecodingContext *ctx, RepOriginId origin_id)
static void pg_output_stream_start(LogicalDecodingContext *ctx, TestDecodingData *data, ReorderBufferTXN *txn, bool last_write)
static bool pg_decode_filter_prepare(LogicalDecodingContext *ctx, TransactionId xid, const char *gid)
static void pg_decode_stream_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)
void _PG_output_plugin_init(OutputPluginCallbacks *cb)
static void pg_decode_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)
static void pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, bool is_init)
static void pg_decode_stream_stop(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
static void pg_decode_stream_message(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr lsn, bool transactional, const char *prefix, Size sz, const char *message)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static bool VARATT_IS_EXTERNAL_ONDISK(const void *PTR)