improve pgbench syntax error messages

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: improve pgbench syntax error messages
Date: 2015-03-03 08:48:39
Message-ID: alpine.DEB.2.10.1503030926440.5591@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Report the origin of syntax errors from pgbench.

Currently only the column number (for expressions) and command are
essentially reported:

sh> ./pgbench -f bad.sql
syntax error at column 14
set: parse error

The patch helps locate the origin of errors with the file name, line
number and the actual text triggering the issue (either the line or an
extract for expressions):

sh> ./pgbench -f bad.sql
syntax error at column 14
error while processing "bad.sql" line 3: (1021 * :id) %
set: parse error

Whether using a macro is the right tool is debatable. The contents could
be expanded, but that would mean replicating the same message over and
over again, so it seems cleaner to me this way. An function seems
overkill.

--
Fabien.

Attachment Content-Type Size
pgbench-expr-error-1.patch text/x-diff 3.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kouhei Kaigai 2015-03-03 09:01:32 Re: Join push-down support for foreign tables
Previous Message Vladimir Borodin 2015-03-03 08:38:58 Re: pg_upgrade and rsync