Description
When a table has 5 columns (in this example), using the query: parameter to return any additional columns causes a hard panic in the internal row decoder:
panic: runtime error: index out of range [5] with length 5
goroutine 21 [running]:
github.com/greenmaskio/greenmask/internal/db/postgres/pgcopy.(*Row).Decode(0xc79d47e0a0, {0xc79de40019, 0x2c, 0x2d})
/var/lib/greenmask/internal/db/postgres/pgcopy/row.go:103 +0x3c8
github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TransformationPipeline).Dump(0xc79d3d7320, {0x125af58, 0xc79d340190}, {0xc79de40019?, 0x0?, 0x0?})
/var/lib/greenmask/internal/db/postgres/dumpers/transformation_pipeline.go:160 +0x73
github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TableDumper).process(0xc79d7fd800, {0x125af58, 0xc79d340190}, {0x1266480?, 0xc79d980750?}, {0x77c2c550bc28?, 0xc79d458048?}, {0x125b3c0, 0xc79d3d7320})
/var/lib/greenmask/internal/db/postgres/dumpers/table.go:160 +0x466
github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TableDumper).Execute.(*TableDumper).dumper.func2()
/var/lib/greenmask/internal/db/postgres/dumpers/table.go:89 +0x1a5
golang.org/x/sync/errgroup.(*Group).Go.func1()
/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 13
/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:78 +0x95
Expected behavior
It should be possible to use query: to join/fetch data from other tables (the documented way to implement complex masking logic with Template + .GetDynamicValue(...)).
Minimal reproduction
- schema: "public"
name: "my_five_column_table"
query: >
SELECT t.*, 'extra' as extra_col
FROM my_five_column_table t
transformers:
- name: "Template"
params:
column: "some_column"
template: "xxx"
Even the simplest extra column triggers it.
We need to join other tables to decide how to mask the value column based on data from joined tables.
Is there other ways to access data from other tables and use it in templates?
Environment
- Greenmask version: latest (as of April 2026)
- Database: PostgreSQL
- OS: Linux (Docker, :latest)
Additional context
This is the official documented pattern for complex transformations (see Transformation conditions / dynamic values and query: parameter). It works perfectly on tables with any other column count.
Thanks in advance for fixing the decoder!
Description
When a table has 5 columns (in this example), using the
query:parameter to return any additional columns causes a hard panic in the internal row decoder:Expected behavior
It should be possible to use query: to join/fetch data from other tables (the documented way to implement complex masking logic with Template + .GetDynamicValue(...)).
Minimal reproduction
Even the simplest extra column triggers it.
We need to join other tables to decide how to mask the value column based on data from joined tables.
Environment
Additional context
This is the official documented pattern for complex transformations (see Transformation conditions / dynamic values and query: parameter). It works perfectly on tables with any other column count.
Thanks in advance for fixing the decoder!