OK I see ... This hook should be used only for ERROR (no WARNING nor NOTICE ...) and the only real interesting information is ErrorData -> internalquery; /* text of internally-generated query */ This doesn't permit to (re)build the link to queryid (that is based on parse tree, but not available here) So the only solution is to had queryId to ErrorData in this hook or create a new hook fired on ERROR and containing queryId ? Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html