pygments / pygments/pygments

backslash is not defined in `PostgresLexer`

Open
#2,310 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.2k
Forks
885
PR merge metrics
No merged PRs in 30d

Description

I stumbled on this problem multiple times. I need to lex an SQL script for PostgreSQL, specifically for creating and connecting to DB and creating tables in it. Everything works fine, but I don't know why such command as \connect is not defined. With minted package for TeX-family typesetting systems, the output of PDF file shows that the backslash in \connect command is not defined (or probably the command itself):

image

Other PostgreSQL lexers work even worse (some other commands are also not defined). After running python3 -I _postgres_builtins.py nothing has changed. Is this a bug or unimplemented syntax?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the PostgresLexer and the _postgres_builtins.py generation step mentioned in the report. Reproduce the minted output for a PostgreSQL script containing \connect, then determine whether the lexer recognizes that command; done means the command is highlighted correctly without regressing the other PostgreSQL syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.