PL/pgSQL and minted [closed]

When using Minted to highlight a PL/pgSQL script, I get following error:

TypeError: 'NoneType' object has no attribute '__getitem__'
(File '%pythonpath%/scripts/pygments/formatters/latex.py', line 133, in _get_ttype_name)


So I tried to use the PostgresLexer, but when trying to compile, this gives errors because square brackets aren't properly escaped:

\begin{minted}[fontsize=\footnotesize,frame=single]{postgresql}
-- Function: dist_calc(bigint[])
-- DROP FUNCTION dist_calc(bigint[]);

CREATE OR REPLACE FUNCTION dist_calc(nodes_array bigint[])
RETURNS double precision AS
$BODY$
DECLARE
geom_1 RECORD;
...
\end{minted}


Is there a solution for the plpgsql lexer, or is there another lexer I could use to format

-
Hi, welcome to TeX.sx! :) Your code snippet works flawlessly with me (old TL2011, Pygments 1.5). Could you add a minimal working example (MWE) containing your document class, packages and other definitions? It might help us to track down the error. :) –  Paulo Cereda Aug 6 '12 at 11:14