pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: nozdrum@gmx.de
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16726: Invalid input syntax is not a useful error message
Date: Thu, 19 Nov 2020 10:31:35 -0300
Message-ID: <20201119133135.GA31339@alvherre.pgsql> (raw)
In-Reply-To: <16726-96431209e6e5f536@postgresql.org>

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.





view thread (7+ messages)

Message-ID: <20201119133135.GA31339@alvherre.pgsql>
Permalink:  ../20201119133135.GA31339@alvherre.pgsql/
Also on:    postgresql.org/message-id/20201119133135.GA31339@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@alvh.no-ip.org, nozdrum@gmx.de, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16726: Invalid input syntax is not a useful error message
  In-Reply-To: <20201119133135.GA31339@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox