Skip to content

Bug: various int arrays are generated as types.Int64Array which leads to out of range errors in tests #1308

Open
@erezrokah

Description

@erezrokah

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

SQLBoiler v4.15.0 (Actually I'm using the latest code from master)

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

Postgres 15

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

sqlboiler psql --wipe --no-hooks --no-auto-timestamps --no-back-referencing

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

N/A

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)

create table if not exists my_table(
    id serial primary key,
    small_ints smallint[]
);

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

Looks like various types of int arrays are always generated as types.Int64Array:

https://github.com/volatiletech/sqlboiler/blob/59e63d54028be0a3b89318577a80fdebd7e351cb/drivers/sqlboiler-psql/driver/psql.go#L918, which means when seeding the values with random data it can overflow the DB type

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions