diff --git a/contrib/pglogical/pglogical.c b/contrib/pglogical/pglogical.c
index f25b91d..6935d0b 100644
--- a/contrib/pglogical/pglogical.c
+++ b/contrib/pglogical/pglogical.c
@@ -25,9 +25,13 @@
 
 #include "mb/pg_wchar.h"
 
+#include "replication/message.h"
+
 #include "storage/ipc.h"
 #include "storage/proc.h"
 
+#include "tcop/utility.h"
+
 #include "utils/builtins.h"
 #include "utils/lsyscache.h"
 
@@ -51,8 +55,10 @@ bool	pglogical_synchronous_commit = false;
 char   *pglogical_temp_directory;
 
 void _PG_init(void);
+void _PG_fini(void);
 void pglogical_supervisor_main(Datum main_arg);
 
+static ProcessUtility_hook_type prev_utility_hook = NULL;
 
 /*
  * Ensure string is not longer than maxlen.
@@ -400,6 +406,38 @@ pglogical_supervisor_main(Datum main_arg)
 	proc_exit(1);
 }
 
+static void
+emit_message_utility(Node *parsetree,
+					 const char *queryString,
+					 ProcessUtilityContext context,
+					 ParamListInfo params,
+					 DestReceiver *dest,
+					 char *completionTag)
+{
+	NodeTag		stmtType = nodeTag(parsetree);
+
+	if (context == PROCESS_UTILITY_TOPLEVEL &&
+		/*
+		 * Create and drop statements are handled. Can be added more tags from
+		 * nodes.h.
+		 */
+		(stmtType == T_CreateStmt || stmtType == T_DropStmt))
+		LogLogicalMessage("pglogical",
+						  queryString, strlen(queryString), true);
+
+	/*
+	 * Fallback to normal process, be it the previous hook loaded
+	 * or the in-core code path if the previous hook does not exist.
+	 */
+	if (prev_utility_hook)
+		(*prev_utility_hook) (parsetree, queryString,
+							  context, params,
+							  dest, completionTag);
+	else
+		standard_ProcessUtility(parsetree, queryString,
+								context, params,
+								dest, completionTag);
+}
 
 /*
  * Entry point for this module.
@@ -442,6 +480,10 @@ _PG_init(void)
 							   "/tmp", PGC_SIGHUP,
 							   0,
 							   NULL, NULL, NULL);
+
+	prev_utility_hook = ProcessUtility_hook;
+	ProcessUtility_hook = emit_message_utility;
+
 	if (IsBinaryUpgrade)
 		return;
 
@@ -465,3 +507,9 @@ _PG_init(void)
 
 	RegisterBackgroundWorker(&bgw);
 }
+
+void
+_PG_fini(void)
+{
+	ProcessUtility_hook = prev_utility_hook;
+}
\ No newline at end of file
diff --git a/contrib/pglogical/pglogical_apply.c b/contrib/pglogical/pglogical_apply.c
index bf5615c..8f78fef 100644
--- a/contrib/pglogical/pglogical_apply.c
+++ b/contrib/pglogical/pglogical_apply.c
@@ -684,6 +684,19 @@ handle_delete(StringInfo s)
 	CommandCounterIncrement();
 }
 
+static void
+handle_ddl(StringInfo s)
+{
+	char		   *query = pglogical_read_ddl(s);
+	bool			started_tx = ensure_transaction();
+
+	/* Execute the query locally. */
+	pglogical_execute_sql_command(query, GetUserNameFromId(GetUserId(), false),
+								  started_tx);
+
+	CommandCounterIncrement();
+}
+
 inline static bool
 getmsgisend(StringInfo msg)
 {
@@ -1045,6 +1058,10 @@ replication_handler(StringInfo s)
 		case 'S':
 			handle_startup(s);
 			break;
+		/* DDL MESSAGE */
+		case 'M':
+			handle_ddl(s);
+			break;
 		default:
 			elog(ERROR, "unknown action of type %c", action);
 	}
diff --git a/contrib/pglogical/pglogical_proto.c b/contrib/pglogical/pglogical_proto.c
index 558a955..133c1c0 100644
--- a/contrib/pglogical/pglogical_proto.c
+++ b/contrib/pglogical/pglogical_proto.c
@@ -230,6 +230,27 @@ pglogical_read_delete(StringInfo in, LOCKMODE lockmode,
 	return rel;
 }
 
+/*
+ * Read DDL command from stream.
+ *
+ * Returns DDL query.
+ */
+char *
+pglogical_read_ddl(StringInfo in)
+{
+	uint8		flags;
+	Size		sz;
+
+	/* read the flags */
+	flags = pq_getmsgbyte(in);
+	Assert(flags == 0);
+
+	/* read the message lengh */
+	sz = pq_getmsgint(in, 4);
+
+	/* read the message */
+	return (char *) pq_getmsgbytes(in, sz);
+}
 
 /*
  * Read tuple in remote format from stream.
@@ -407,7 +428,7 @@ pglogical_read_attrs(StringInfo in, char ***attrnames, int *nattrnames)
 		if (blocktype != 'C')
 			elog(ERROR, "expected COLUMN, got %c", blocktype);
 		flags = pq_getmsgbyte(in);
-//		Assert(flags == 0);
+		Assert(flags >= 0);
 
 		blocktype = pq_getmsgbyte(in);		/* column name block follows */
 		if (blocktype != 'N')
diff --git a/contrib/pglogical/pglogical_proto.h b/contrib/pglogical/pglogical_proto.h
index 3229c322..1d2e055 100644
--- a/contrib/pglogical/pglogical_proto.h
+++ b/contrib/pglogical/pglogical_proto.h
@@ -38,5 +38,6 @@ extern PGLogicalRelation *pglogical_read_update(StringInfo in, LOCKMODE lockmode
 					   PGLogicalTupleData *oldtup, PGLogicalTupleData *newtup);
 extern PGLogicalRelation *pglogical_read_delete(StringInfo in, LOCKMODE lockmode,
 												 PGLogicalTupleData *oldtup);
+extern char *pglogical_read_ddl(StringInfo in);
 
 #endif /* PGLOGICAL_PROTO_H */
diff --git a/contrib/pglogical/pglogical_worker.c b/contrib/pglogical/pglogical_worker.c
index cc37866..1a3ca21 100644
--- a/contrib/pglogical/pglogical_worker.c
+++ b/contrib/pglogical/pglogical_worker.c
@@ -406,7 +406,11 @@ pglogical_worker_shmem_startup(void)
 
 	if (!found)
 	{
-		PGLogicalCtx->lock = LWLockAssign();
+		#if PG_VERSION_NUM >= 90600
+		PGLogicalCtx->lock = &(GetNamedLWLockTranche(EXTENSION_NAME))->lock;
+		#else
+		PGLogicalCtx->lock  = LWLockAssign();
+		#endif
 		PGLogicalCtx->supervisor = NULL;
 		PGLogicalCtx->total_workers = max_worker_processes;
 		memset(PGLogicalCtx->workers, 0,
@@ -430,7 +434,11 @@ pglogical_worker_shmem_init(void)
 	 * tries to allocate or free blocks from this array at once.  There won't
 	 * be enough contention to make anything fancier worth doing.
 	 */
+	#if PG_VERSION_NUM >= 90600
+	RequestNamedLWLockTranche(EXTENSION_NAME, 1);
+	#else
 	RequestAddinLWLocks(1);
+	#endif
 
 	/*
 	 * Whether this is a first startup or crash recovery, we'll be re-initing
diff --git a/contrib/pglogical_output/pglogical_output.c b/contrib/pglogical_output/pglogical_output.c
index 5262d82..3181c6c 100644
--- a/contrib/pglogical_output/pglogical_output.c
+++ b/contrib/pglogical_output/pglogical_output.c
@@ -66,6 +66,10 @@ static void pg_decode_commit_txn(LogicalDecodingContext *ctx,
 static void pg_decode_change(LogicalDecodingContext *ctx,
 				 ReorderBufferTXN *txn, Relation rel,
 				 ReorderBufferChange *change);
+static void pg_decode_message(LogicalDecodingContext *ctx,
+							  ReorderBufferTXN *txn, XLogRecPtr message_lsn,
+							  bool transactional, const char *prefix,
+							  Size sz, const char *message);
 
 #ifdef HAVE_REPLICATION_ORIGINS
 static bool pg_decode_origin_filter(LogicalDecodingContext *ctx,
@@ -87,6 +91,7 @@ _PG_output_plugin_init(OutputPluginCallbacks *cb)
 	cb->begin_cb = pg_decode_begin_txn;
 	cb->change_cb = pg_decode_change;
 	cb->commit_cb = pg_decode_commit_txn;
+	cb->message_cb = pg_decode_message;
 #ifdef HAVE_REPLICATION_ORIGINS
 	cb->filter_by_origin_cb = pg_decode_origin_filter;
 #endif
@@ -254,7 +259,7 @@ pg_decode_startup(LogicalDecodingContext * ctx, OutputPluginOptions *opt,
 			ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("client requested protocol %s but only \"json\" or \"native\" are supported",
-				 	data->client_protocol_format)));
+					data->client_protocol_format)));
 		}
 
 		/* check for encoding match if specific encoding demanded by client */
@@ -512,6 +517,22 @@ pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
 	MemoryContextReset(data->context);
 }
 
+static void
+pg_decode_message(LogicalDecodingContext *ctx,
+				  ReorderBufferTXN *txn, XLogRecPtr message_lsn,
+				  bool transactional, const char *prefix,
+				  Size sz, const char *message)
+{
+	PGLogicalOutputData *data = ctx->output_plugin_private;
+
+	if (strcmp(prefix, "pglogical") == 0)
+	{
+		OutputPluginPrepareWrite(ctx, true);
+		data->api->write_ddl(ctx->out, data, message, sz);
+		OutputPluginWrite(ctx, true);
+	}
+}
+
 #ifdef HAVE_REPLICATION_ORIGINS
 /*
  * Decide if the whole transaction with specific origin should be filtered out.
diff --git a/contrib/pglogical_output/pglogical_proto.c b/contrib/pglogical_output/pglogical_proto.c
index 47a883f..a1e6b85 100644
--- a/contrib/pglogical_output/pglogical_proto.c
+++ b/contrib/pglogical_output/pglogical_proto.c
@@ -31,6 +31,7 @@ pglogical_init_api(PGLogicalProtoType typ)
 		res->write_insert = pglogical_json_write_insert;
 		res->write_update = pglogical_json_write_update;
 		res->write_delete = pglogical_json_write_delete;
+		res->write_ddl = pglogical_json_write_ddl;
 		res->write_startup_message = json_write_startup_message;
 	}
 	else
@@ -42,6 +43,7 @@ pglogical_init_api(PGLogicalProtoType typ)
 		res->write_insert = pglogical_write_insert;
 		res->write_update = pglogical_write_update;
 		res->write_delete = pglogical_write_delete;
+		res->write_ddl = pglogical_write_ddl;
 		res->write_startup_message = write_startup_message;
 	}
 
diff --git a/contrib/pglogical_output/pglogical_proto.h b/contrib/pglogical_output/pglogical_proto.h
index 27897e2..032803b 100644
--- a/contrib/pglogical_output/pglogical_proto.h
+++ b/contrib/pglogical_output/pglogical_proto.h
@@ -34,6 +34,8 @@ typedef void (*pglogical_write_update_fn)(StringInfo out, struct PGLogicalOutput
 							 HeapTuple newtuple);
 typedef void (*pglogical_write_delete_fn)(StringInfo out, struct PGLogicalOutputData *data,
 							 Relation rel, HeapTuple oldtuple);
+typedef void (*pglogical_write_ddl_fn)(StringInfo out, struct PGLogicalOutputData *data,
+							 const char *message, Size sz);
 
 typedef void (*write_startup_message_fn)(StringInfo out, List *msg);
 
@@ -46,6 +48,7 @@ typedef struct PGLogicalProtoAPI
 	pglogical_write_insert_fn	write_insert;
 	pglogical_write_update_fn	write_update;
 	pglogical_write_delete_fn	write_delete;
+	pglogical_write_ddl_fn		write_ddl;
 	write_startup_message_fn	write_startup_message;
 } PGLogicalProtoAPI;
 
diff --git a/contrib/pglogical_output/pglogical_proto_json.c b/contrib/pglogical_output/pglogical_proto_json.c
index ae5a591..70e23c5 100644
--- a/contrib/pglogical_output/pglogical_proto_json.c
+++ b/contrib/pglogical_output/pglogical_proto_json.c
@@ -178,6 +178,18 @@ pglogical_json_write_delete(StringInfo out, PGLogicalOutputData *data,
 }
 
 /*
+ * Write DDL logical message to the output stream.
+ */
+void
+pglogical_json_write_ddl(StringInfo out, PGLogicalOutputData *data,
+							const char *message, Size sz)
+{
+	appendStringInfoString(out, "{\"action\":\"M\", \"message\":");
+	appendBinaryStringInfo(out, message, sz);
+	appendStringInfoString(out, "}");
+}
+
+/*
  * The startup message should be constructed as a json object, one
  * key/value per DefElem list member.
  */
diff --git a/contrib/pglogical_output/pglogical_proto_json.h b/contrib/pglogical_output/pglogical_proto_json.h
index d853e9e..03ccfc0 100644
--- a/contrib/pglogical_output/pglogical_proto_json.h
+++ b/contrib/pglogical_output/pglogical_proto_json.h
@@ -26,6 +26,8 @@ extern void pglogical_json_write_update(StringInfo out, PGLogicalOutputData *dat
 								 HeapTuple newtuple);
 extern void pglogical_json_write_delete(StringInfo out, PGLogicalOutputData *data,
 								 Relation rel, HeapTuple oldtuple);
+extern void pglogical_json_write_ddl(StringInfo out, PGLogicalOutputData *data,
+								 const char *message, Size sz);
 
 extern void json_write_startup_message(StringInfo out, List *msg);
 
diff --git a/contrib/pglogical_output/pglogical_proto_native.c b/contrib/pglogical_output/pglogical_proto_native.c
index 87ec453..f6630a2 100644
--- a/contrib/pglogical_output/pglogical_proto_native.c
+++ b/contrib/pglogical_output/pglogical_proto_native.c
@@ -318,6 +318,24 @@ pglogical_write_delete(StringInfo out, PGLogicalOutputData *data,
 }
 
 /*
+ * Write DDL logical message to the output stream.
+ */
+void
+pglogical_write_ddl(StringInfo out, PGLogicalOutputData *data,
+					const char *message, Size sz)
+{
+	uint8 flags = 0;
+
+	pq_sendbyte(out, 'M');		/* action DDL message */
+
+	/* send the flags field */
+	pq_sendbyte(out, flags);
+
+	pq_sendint(out, sz, 4);		/* message length */
+	pq_sendbytes(out, message, sz);
+}
+
+/*
  * Most of the brains for startup message creation lives in
  * pglogical_config.c, so this presently just sends the set of key/value pairs.
  */
diff --git a/contrib/pglogical_output/pglogical_proto_native.h b/contrib/pglogical_output/pglogical_proto_native.h
index d3ba125..c02d63e 100644
--- a/contrib/pglogical_output/pglogical_proto_native.h
+++ b/contrib/pglogical_output/pglogical_proto_native.h
@@ -41,6 +41,8 @@ extern void pglogical_write_update(StringInfo out, PGLogicalOutputData *data,
 							HeapTuple newtuple);
 extern void pglogical_write_delete(StringInfo out, PGLogicalOutputData *data,
 							Relation rel, HeapTuple oldtuple);
+extern void pglogical_write_ddl(StringInfo out, PGLogicalOutputData *data,
+							const char *message, Size sz);
 
 extern void write_startup_message(StringInfo out, List *msg);
 
