Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/db/postgres/pgcopy/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package pgcopy

import (
"errors"
"fmt"
"slices"

"github.com/greenmaskio/greenmask/pkg/toolkit"
Expand Down Expand Up @@ -100,6 +101,14 @@ func (r *Row) Decode(raw []byte) error {
r.appendNewEmptyBuffer()
}

// A static-tuple row that receives a stream with more columns
// than the table (e.g. a user `query:` that joins extra columns)
// would otherwise panic here with 'index out of range' inside
// the dump pipeline. Return a clear error instead.
if idx >= len(r.columnPos) {
return fmt.Errorf("pgcopy: row has more columns than the configured tuple size (%d); check that the transformation's `query:` does not select additional columns", r.tupleSize)
}

p := r.columnPos[idx]
p.start = colStartPos
p.end = colEndPos
Expand Down
Loading