Skip to content

Infinity date not working for paranoid delete #8382

Closed

Description

@gabegorelick

What are you doing?

const Date = this.sequelize.define('Date',
          {
            date: {
              type: DataTypes.DATE,
              primaryKey: true
            },
            deletedAt: {
              type: DataTypes.DATE,
              defaultValue: Infinity
            }
          },
          { paranoid: true });

        return this.sequelize.sync({ force: true })
          .then(() => {
            return Date.build({ date: Infinity })
              .save()
              .then(date => {
                return date.destroy();
              });
          });

What do you expect to happen?

UPDATE ... WHERE deletedAt = 'Infinity'

What is actually happening?

UPDATE ... WHERE deletedAt = Infinity

Since Infinity is not quoted or otherwise cast to a timestamp, Postgres interprets it as a column name, which causes an error.

Dialect: postgres
Dialect version: XXX
Database version: 9.6
Sequelize version: master
Tested with master branch: Yes

See #8336

Activity

  1. added 2 commits that reference this issue on Sep 27, 2017
    9fe7fdf
    aaa1772
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