Re: BUG #16726: Invalid input syntax is not a useful error message

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: nozdrum(at)gmx(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16726: Invalid input syntax is not a useful error message
Date: 2020-11-19 13:31:35
Message-ID: 20201119133135.GA31339@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2020-Nov-18, PG Bug reporting form wrote:

> I also tried curly braces ( as suggested by your awful documentation ), but
> this just leads to
> `syntax error at or near "{"`

Actually, curly braces work just fine:

=# create table users (some_uuid_field uuid);
CREATE TABLE

=# insert into users values ('{dec3d6c4-c32e-45c6-0000-1eae3df44fbf}');
INSERT 0 1

(I fixed the broken UUID value, obviously.)

The problem with that, I suspect, is that you *replaced* the
single-quote delimiters with braces, rather than *add* the braces inside
the quoted literal. That's what gives the error message you suggest:

=# insert into users values ({dec3d6c4-c32e-45c6-0000-1eae3df44fbf});
ERROR: syntax error at or near "{"
LÍNEA 1: insert into users values ({dec3d6c4-c32e-45c6-0000-1eae3df44...
^

> What I want:

> b) That your error messages FOR ONCE are not useless and tell me the
> expected syntax, you are wasting millions of hours of developer time and
> human life, because you can not be asked to make useful error messages.

I think you're suggesting something like this:

insert into users values ('{dec3d6c4-c32e-45c6-000-1eae3df44fbf}');
ERROR: invalid input syntax for type uuid: "{dec3d6c4-c32e-45c6-000-1eae3df44fbf}"
LÍNEA 1: insert into users values ('{dec3d6c4-c32e-45c6-000-1eae3df44...
^
HINT: Valid UUID values are of the form 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'.

This is not impossible, but I think it'd be overkill, and it fails to
convey that there are other possible formats (if we tried to list them
all, it'd be pretty cumbersome). Would this be really all that
valuable?

However, before embarking on such an implementation, you would certainly
owe this group an apology for your rudeness and an admission that we do
spend a lot of time producing pretty decent error messages most of the
time.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-11-19 15:41:24 BUG #16730: Create table like with inheritance and self referencing index
Previous Message Neil Chen 2020-11-19 08:20:18 Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted