Skip to content

User defined number types not serialized properly #10491

Closed

Description

@gabegorelick

What are you doing?

const User = this.sequelize.define('user', {
  age: Sequelize.BIGINT
});

const age = BigInt(Number.MAX_SAFE_INTEGER).add(Number.MAX_SAFE_INTEGER);

return User.sync({force: true}).then(() => {
  return User.create({age});
}).then(user => {
  expect(BigInt(user.age).toString()).to.equal(age.toString());
  return User.findAll({
    where: {age}
  });
}).then(users => {
  expect(users).to.have.lengthOf(1);
  expect(BigInt(users[0].age).toString()).to.equal(age.toString());
});

What do you expect to happen?

Sequelize serializes the BigInt as a string and generates valid SQL.

What is actually happening?

SequelizeDatabaseError: invalid input syntax for integer: ""18014398509481982""

Dialect: any (but tested on PG)
Dialect version: any
Database version: any
Sequelize version: master
Tested with latest release: yes

Activity

  1. added a commit that references this issue on Mar 2, 2019
    183646a
  2. changed the title [-]User defined number types not supported[/-] [+]User defined number types not serialized properly[/+] on Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions