8

Apparently the syntax highlighting for SQL thinks that a \ is some kind of special character in a SQL string literal.

Which makes the highlighter think that the string constant did not end, leaving a really weird colored SQL statement.

See e.g. this question

enter image description here

After the 'C:\' part the SQL keywords are colored as if they were still part of the SQL string constant.

The backslash has no special meaning in SQL and thus 'C:\' is a complete constant and does not extend across multiple lines.

0

1 Answer 1

10

See this MySQL dev page: \' can mean an escaped single quote in MySQL. That means that for MySQL, this would be the correct highlighting.

Unfortunately, we don't have separate syntax highlighting for separate SQL dialects, and since there are significant differences between them, errors like this are bound to happen.

3
  • 8
    If there aren't separate highlighters, the SQL highlighter should stick to ANSI SQL not some DBMS specific (non-standard) extension to the language Aug 27, 2018 at 10:59
  • 5
    @a_horse_with_no_name I agree that ANSI SQL highlighting would be best, but since we're using Google Prettify for syntax highlighting, it's unlikely raising it here as a bug will change anything. You could raise it there on GitHub, but note that the SQL syntax highlighting for the main branch hasn't been updated since 2015, and SE is also slow at updating it when it changes on GitHub.
    – Erik A
    Aug 27, 2018 at 11:04
  • 4
    Also of interest: prettify refers back to this post on MSE to add support for non-ANSI stuff to syntax highlighting.
    – Erik A
    Aug 27, 2018 at 12:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .