Skip to content
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

TypeError: The operator "~=" is not permitted #4371

Closed
thekevinbrown opened this issue Mar 13, 2021 · 0 comments · Fixed by #4372
Closed

TypeError: The operator "~=" is not permitted #4371

thekevinbrown opened this issue Mar 13, 2021 · 0 comments · Fixed by #4372

Comments

@thekevinbrown
Copy link
Contributor

thekevinbrown commented Mar 13, 2021

Environment

Knex version: 0.21.19
Database + version: PostgreSQL 12
OS: Mac OS 11.2.1 (Big Sur)

Bug

  1. Explain what kind of behaviour you are getting and how you think it should do

When trying to use the ~= operator that's supported by PostgreSQL, I get:

TypeError: The operator "~=" is not permitted
      at Formatter.operator (node_modules/knex/lib/formatter.js:203:13)
      at QueryCompiler_PG.whereBasic (node_modules/knex/lib/query/compiler.js:672:22)
      at QueryCompiler_PG.where (node_modules/knex/lib/query/compiler.js:390:34)
      at node_modules/knex/lib/query/compiler.js:115:69
          at Array.map (<anonymous>)
      at QueryCompiler_PG.select (node_modules/knex/lib/query/compiler.js:115:35)
      at QueryCompiler_PG.toSQL (node_modules/knex/lib/query/compiler.js:61:29)
      at Builder.toSQL (node_modules/knex/lib/query/builder.js:97:44)
      [...project code]
  1. Error message

TypeError: The operator "~=" is not permitted

  1. Reduced test code, for example in https://npm.runkit.com/knex or if it needs real
    database connection to MySQL or PostgreSQL, then single file example which initializes
    needed data and demonstrates the problem.

This looks very similar to:
#3359

I went ahead and added it to the operators array in formatters.js locally and it worked. I'll prepare a PR with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant