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

Can not create valid oracle regexp constraint using knex #3823

Open
felczukr opened this issue Apr 23, 2020 · 1 comment
Open

Can not create valid oracle regexp constraint using knex #3823

felczukr opened this issue Apr 23, 2020 · 1 comment

Comments

@felczukr
Copy link

Environment

Knex version: 0.20.13
Database + version: oracle 18, oracledb: 4.2.0
OS: macOs High Sierra
@atiertant

Bug

I'm trying to create the constraint with regexp using knex on the oracle database. Knex creates the constraint on the oracle column but it replaces "?" with placeholder like ":1", ":2". I tried to replace the question mark (according to documentation) with "?". It doesn't work for me on oracle db. Here is an example of oracle column constraint
knex.raw('ALTER TABLE atest ADD CONSTRAINT C_TEST CHECK (REGEXP_LIKE(COL_A, \'^((([A]{0,4})WW)|(W{0,2}))\\?([B]{5}WW)+((([C]{5})W\\?))$\'))');
Instead of mentioned regexp in the database I see:
^((([A]{0,4})WW)|(W{0,2})):1([B]{5}WW)+((([C]{5})W:2))$

I read the documentation and the suggested solution to escape the question \? mark doesn't work for me.

@elhigu
Copy link
Member

elhigu commented Apr 23, 2020

Ah you actually had made a bug report. There seems to be a bug in escaping for oracle https://runkit.com/embed/qlo6re5ixn4s

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

No branches or pull requests

2 participants