pgsql-ast-parser icon indicating copy to clipboard operation
pgsql-ast-parser copied to clipboard

Library causes crashes in Safari browser due to lack of support for lookbehind regex.

Open colbenkharrl opened this issue 1 year ago • 1 comments

Our team has started adopting this library for client-side query validation. We noticed that in Safari browser using this library causes our React application to crash before it has a chance to load due to an invalid regex being used in the lexer:

https://github.com/oguimbal/pgsql-ast-parser/blob/e2cec38142e242ec5e7808fb2bd363b805439639/src/lexer.ts#L49

SyntaxError: Invalid regular expression: invalid group specifier name

Unfortunately, Safari/WebKit has still not added support for lookbehind assertions in RegExp. Here is the open bug ticket.

I have validated that if we stop importing this library into our application, things function as normal in Safari.

Re-assessing the composition of this regex, which seems to be just looking for /*, should resolve this issue.

colbenkharrl avatar Aug 03 '22 20:08 colbenkharrl

Duplicate of https://github.com/oguimbal/pgsql-ast-parser/issues/34

gthb avatar Aug 09 '22 13:08 gthb

yup, duplicate :)

oguimbal avatar Aug 16 '22 08:08 oguimbal