1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #402 open

SQL not correctly highlighted

Anonymous created an issue

cf. http://pygments.org/demo/1583/

Original query:

{{{ select c.relname, l.mode, l.granted as lock_held, l.pid, s.usename as user, s.datname as database, s.current_query from pg_class c, pg_locks l, pg_stat_activity s where c.oid = l.relation AND s.procpid = l.pid }}}

Reported by guest

Comments (4)

  1. Georg Brandl repo owner
    • changed status to open

    Oh well, the SQL lexer needs to be quite a bit more context sensitive. That's difficult though because of the wide range of slightly incompatible dialects...

  2. Thomas Aglassinger

    If I understand the specific issue correctly, the ticket creator objects to "user" and "database" being rendered as token,Keyword. Wouldn't it already be an improvement to render the next token after "as" and "." as token.Name?

    Of course, this still won't catch code like

    select user, database from some_table


    select u user, d database from some_table
  3. Log in to comment