Re: improve pgbench syntax error messages

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: improve pgbench syntax error messages
Date: 2015-03-04 16:25:16
Message-ID: alpine.DEB.2.10.1503041720550.15572@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> As I mentioned on the other thread, I'd really like to get this into a
> better format, where each error message is on one line. Looking at
> that, you can't tell whether you've got one mistake, two mistakes, or
> three mistakes.

Indeed. Here is a v2.

sh> ./pgbench -f bad.sql
bad.sql:3: syntax error at column 23 in command "set"
\set aid (1021 * :id) %
^ error found here

sh> ./pgbench -f bad2.sql
bad2.sql:1: unexpected argument (x) at column 25 in command "setrandom"
\setrandom id 1 1000 x
^ error found here

sh> ./pgbench -f bad3.sql
bad3.sql:1: too many arguments (gaussian) at column 35 in command "setrandom"
\setrandom foo 1 10 gaussian 10.3 1
^ error found here

sh> ./pgbench -f bad4.sql
bad4.sql:1: missing threshold argument (exponential) in command "setrandom"
\setrandom foo 1 10 exponential

I think that transforming unexpected garbage in errors would be a good
move, even if this breaks backwards compatibility (currently a warning is
printed about ignored extra stuff).

--
Fabien.

Attachment Content-Type Size
pgbench-expr-error-2.patch text/x-diff 8.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-03-04 16:26:22 Re: failures with tuplesort and ordered set aggregates (due to 5cefbf5a6c44)
Previous Message Robert Haas 2015-03-04 16:18:53 Re: xpath changes in the recent back branches