I'm writing a lexer for SQL for syntax coloring and have the problem of parsing code like
SELECT * FROM table t WHERE t.name LIKE 'FOO\_%' ESCAPE '\';
Is my understanding correct, that \ escapes some characters like underscore (\_), but not if it is followed by a single quote (\')? Does the escaping depends on the SQL dialect or is the behavior the same for all (or a lot of) dialects?
Is it correct, that '\' usually would mean an incomplete string literal, because the backslash escapes the single quote?