Skip to content

Commit 7b0bef4

Browse files
authored
Error out instead of panic when tuple has more columns than expected (#3608)
1 parent d1c894b commit 7b0bef4

File tree

1 file changed

+9
-1
lines changed
  • flow/connectors/postgres

1 file changed

+9
-1
lines changed

flow/connectors/postgres/cdc.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,15 @@ func processTuple[Items model.Items](
279279
items := processor.NewItems(len(tuple.Columns))
280280
var unchangedToastColumns map[string]struct{}
281281

282+
var none Items
283+
if len(tuple.Columns) > len(rel.Columns) {
284+
return none, nil, fmt.Errorf(
285+
"tuple has more columns than the last RelationMessage: %d > %d. "+
286+
"One known occurrence of this was due to a bug with replication column lists in PG 15-15.1. "+
287+
"https://www.postgresql.org/message-id/CADGJaX9kiRZ-OH0EpWF5Fkyh1ZZYofoNRCrhapBfdk02tj5EKg@mail.gmail.com",
288+
len(tuple.Columns), len(rel.Columns))
289+
}
290+
282291
for idx, tcol := range tuple.Columns {
283292
rcol := rel.Columns[idx]
284293
if _, ok := nameAndExclude.Exclude[rcol.Name]; ok {
@@ -290,7 +299,6 @@ func processTuple[Items model.Items](
290299
}
291300
unchangedToastColumns[rcol.Name] = struct{}{}
292301
} else if err := processor.Process(items, p, tcol, rcol, customTypeMapping); err != nil {
293-
var none Items
294302
return none, nil, err
295303
}
296304
}

0 commit comments

Comments
 (0)