Skip to content

Commit 8bc4eec

Browse files
blessy456bthomashackorum
authored andcommitted
Added logical replication warning
1 parent d29d469 commit 8bc4eec

120 files changed

Lines changed: 28 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/backend/replication/logical/tablesync.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,34 @@ copy_table(Relation rel)
10891089
fetch_remote_table_info(get_namespace_name(RelationGetNamespace(rel)),
10901090
RelationGetRelationName(rel), &lrel, &qual,
10911091
&gencol_published);
1092+
/* Get the subscriber table schema */
1093+
TupleDesc tupdesc = RelationGetDescr(rel);
1094+
for (int i = 0; i < lrel.natts; i++)
1095+
{
1096+
/* Get column type OIDs */
1097+
Oid local_typid = TupleDescAttr(tupdesc, i)->atttypid;
1098+
Oid remote_typid = lrel.atttyps[i];
1099+
1100+
/* Get human-readable type names */
1101+
char *local_typname = format_type_be(local_typid);
1102+
char *remote_typname = format_type_be(remote_typid);
1103+
1104+
/* Check if types are different */
1105+
if (local_typid != remote_typid)
1106+
{
1107+
ereport(WARNING,
1108+
(errmsg("Datatype mismatch for column \"%s\" in table \"%s.%s\": "
1109+
"Publisher type is %s, Subscriber type is %s",
1110+
lrel.attnames[i], lrel.nspname, lrel.relname,
1111+
remote_typname, local_typname)));
1112+
}
1113+
1114+
/* Free allocated memory */
1115+
pfree(local_typname);
1116+
pfree(remote_typname);
1117+
}
1118+
1119+
10921120

10931121
/* Put the relation into relmap. */
10941122
logicalrep_relmap_update(&lrel);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/test/isolation/specs/classroom-scheduling.spec renamed to src/test/isolation/specs_backup/classroom-scheduling.spec

File renamed without changes.

src/test/isolation/specs/cluster-conflict-partition.spec renamed to src/test/isolation/specs_backup/cluster-conflict-partition.spec

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)