Skip to content

Buffer reuse/overwrite bug when reading results into types.JSON values #1427

Open
@ianrose14

Description

@ianrose14

If you're having a generation problem please answer these questions before submitting your issue. Thanks!

What version of SQLBoiler are you using (sqlboiler --version)?

SQLBoiler v4.16.1

What is your database and version (eg. Postgresql 10)

Postgresql 12.1

If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)

If this happened at runtime what code produced the issue? (if not applicable leave blank)

What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)

Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)

Further information. What did you do, what did you expect?

I've added a failing testcase here that demonstrates the issue I am having: #1426

I'm not sure how to trigger tests in github. Regardless, this test fails for me locally with:

--- FAIL: TestBindJsonSlice (0.00s)
    reflect_test.go:221: wrong name: {}foo": "bar"}
FAIL
FAIL	github.com/volatiletech/sqlboiler/v4/queries	0.216s
FAIL

Note that the first two characters (which should be {") have been overwriten with the next row's column contents ({}). That's why this looks like a buffer reuse bug to me.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions