Bold keyword in listing, but deletekeywords does not seem to work

I'm using the lstlisting package to write down the SQL queries. However, the word character appear in bold, because it is considered a keyword. I added it to the list of keyword to remove deletekeywords, but it does not seem to work. Although, if I put WHERE in the list of the deletekeywords list, it does work, unbolding it.

move it from the list o keywords.

\documentclass{article}
\usepackage{listings}
\usepackage{textcomp} % listings straight quote
\begin{document}
\lstset{
language=SQL,tabsize=2,upquote=true,
%keywordstyle=\ttfamily\bfseries,basicstyle=\ttfamily,
moredelim=[is][\underbar]{__}{__},
morekeywords={ilike},
sensitive=false,
deletekeywords = {CHARACTER,character,WHERE},
}
\begin{lstlisting}
SELECT m.title,c.id,p.name,ch.name
FROM movie m
JOIN casting c ON m.id = c.movie_id
JOIN person p ON p.id=c.person_id
JOIN character ch ON ch.id=c.char_id
WHERE m.title ILIKE '%legend%';
\end{lstlisting}
\end{document}


• Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem. Sep 8 '19 at 12:24
• @BambOo I've just updated the question. Sep 8 '19 at 12:56
• Is my answer conform with your request ? Sep 8 '19 at 19:47
• Thank you so much, @BambOo. Your answer worked like a charm. If you could also vote my question, I'll would appreciate too. Sep 9 '19 at 14:18

According to the listings manual, the passing arguments to the deletekeywords option should look like deletekeywords=[<number>]{<list of keywords>}. I did not find the correct <number> in the documentation, but playing a bit with values shows that <number>=2 works in your case.

\documentclass{article}
\usepackage{listings}
\usepackage{textcomp} % listings straight quote
\begin{document}
\lstset{
language=SQL,tabsize=2,upquote=true,
%keywordstyle=\ttfamily\bfseries,basicstyle=\ttfamily,
moredelim=[is][\underbar]{__}{__},
morekeywords={ilike},
sensitive=false,
deletekeywords =[2]{CHARACTER,character,WHERE},
}
\begin{lstlisting}
SELECT m.title,c.id,p.name,ch.name
FROM movie m
JOIN casting c ON m.id = c.movie_id
JOIN person p ON p.id=c.person_id
JOIN character ch ON ch.id=c.char_id
WHERE m.title ILIKE '%legend%';
\end{lstlisting}
\end{document}