New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequelize.where and is null #4334

Closed
User4martin opened this Issue Aug 14, 2015 · 0 comments

Comments

2 participants
@User4martin
Contributor

User4martin commented Aug 14, 2015

"c" in the examples is S.fn('lower', S.col('name'))

S.where(c, null);

fails with
Error: TypeError: Cannot read property '_isSequelizeMethod' of null,
Of course the doc says, that in the 2 argument version the comparator is '='

So using 3 arguments (comparator as string, as specified by docs
http://sequelize.readthedocs.org/en/latest/api/sequelize/index.html?highlight=col#whereattr-comparator-logic-sequelizewhere

S.where(c, 'is', null);

and get the same error.

I did find a workaround, using S.literal. But I wonder if that is the way to go (other than as workaround)

S.where(c, 'is', S.literal('null'));

This also has a curiosity of its own. There is no spacing around the comparator. So the sql is

  c isnull

which means

S.where(c, 'is not', S.literal('null'));

fails.

@janmeier janmeier added the bug label Aug 31, 2015

@janmeier janmeier closed this in a42b38b Aug 31, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment