Seaquel
PostgreSQL error code

PostgreSQL error 2201B

2201B is the SQLSTATE PostgreSQL reports for invalid regular expression, in class 22, Data Exception.

SQLSTATE2201B
Condition nameinvalid_regular_expression
Class22 — Data Exception

Reproduce it, then fix it

The pattern opens a group with ( and never closes it. ~ reads its right side as a regular expression, so to match a literal parenthesis, escape it as \(. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT name FROM products WHERE name ~ '(Mouse|Keyboard';
SELECT name FROM products WHERE name ~ '(Mouse|Keyboard)';

Source: PostgreSQL documentation, Appendix A