Handling dropped attributes in pglogical_proto

Поиск
Список
Период
Сортировка
От Konstantin Knizhnik
Тема Handling dropped attributes in pglogical_proto
Дата
Msg-id 57EBD2C8.1060202@postgrespro.ru
обсуждение исходный текст
Ответы Re: Handling dropped attributes in pglogical_proto  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: psql casts aspersions on server reliability
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Tuplesort merge pre-reading