Repository navigation
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue type
Description
Issue Creation Checklist
- [x ] I have read the contribution guidelines
Bug Description
I have a function that looks like this
User.findByUsername = async (username) => {
let user = await User.findOne({
where: {
username: sequelize.where(
sequelize.fn('LOWER', sequelize.col('username')),
'=',
sequelize.fn('LOWER', username)
),
},
});
return user;
};
if the username includes a $ symbol the lookup always fails. I dug around in the source code and found if I changed Line 1611 in the query-generator.js file from:
return this.escape(typeof arg === "string" ? arg.replace("$", "$$$") : arg);
to:
return this.escape(typeof arg === "string" ? arg.replace("$", "$$") : arg);
everything works properly. I'm not familiar with this codebase so unsure of why "$$$" was originally put but it is breaking things for me.
SSCCE
Here is the link to the SSCCE for this issue: LINK-HERE
What do you expect to happen?
The query of username="money$" should have returned Foo where there username was "money$"
What is actually happening?
the output as null
Additional context
Add any other context and details here.
Environment
- Sequelize version: 6.17.0
- Node.js version: v14.17.0
- If TypeScript related: TypeScript version:
- Database & Version: PostgreSQL 13
- Connector library & Version: pg
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I don't know how to start, I would need guidance.
- [x ] No, I don't have the time, although I believe I could do it if I had the time...
- No, I don't have the time and I wouldn't even know how to start.
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue type
Activity
ephys commentedon Mar 25, 2022
Likely related to #13817
github-actions commentedon Apr 9, 2022
This issue has been automatically marked as stale because it has been open for 14 days without activity. It will be closed if no further activity occurs within the next 14 days. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
ephys commentedon Apr 24, 2022
This is being fixed but we're tracking it in that linked issue
ephys commentedon Apr 25, 2022
I've now removed the piece of code you linked to in PR #14447. It was a bad band-aid for a deeper problem, which I am fixing.
I'll re-open because it's not strictly the same issue as #13817
jamesicon commentedon Apr 25, 2022
Awesome thank you @ephys
ephys commentedon Apr 26, 2022
The fix is ready, but the bad news is that this change is a breaking change, so I can only release this in Sequelize 7