Hi,

pglogical_read_tuple from pglogical_proto.c contains the following code:

        natts = pq_getmsgint(in, 2);
        if (rel->natts != natts)
                elog(ERROR, "tuple natts mismatch, %u vs %u", rel->natts, 
natts);



But if table was just altered and some attribute was removed from the table, then rel->natts can be greater than natts.
The problem can be fixed by the following patch:

--- a/pglogical_proto.c
+++ b/pglogical_proto.c
@@ -263,10 +263,15 @@ pglogical_read_tuple(StringInfo in, PGLogicalRelation 
*rel,
        {
                int                     attid = rel->attmap[i];
                Form_pg_attribute att = desc->attrs[attid];
-               char            kind = pq_getmsgbyte(in);
+               char            kind;
                const char *data;
                int                     len;
+ if (att->atttypid == InvalidOid) {
+                       continue;
+               }
+               kind = pq_getmsgbyte(in);
+
                switch (kind)
                {
                        case 'n': /* null */


--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to