Include 3 previous tokens in syntax error message

From: Andrus <kobruleht2(at)hot(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: Include 3 previous tokens in syntax error message
Date: 2020-12-27 14:48:39
Message-ID: ed636acc-f4c4-7b50-3d59-fc727068e4c7@hot.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Postgres returns unreadable syntax error messageges like

Syntax error at or near ')'

If there are many ) characters in query, it is not possible to find the
palce where error occurs.

STATEMENT_POSITION is difficult to use since drivers perform parameter
replacements which makes this different from source position.

How to fix this so that 3 last tokens are returned in message like

Syntax error at or near ' i > )'

Andrus.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-12-27 15:48:11 Re: Include 3 previous tokens in syntax error message
Previous Message Ahmet Demir 2020-12-27 08:00:47 Re: alter system command