Re: Mention column name in error messages - Mailing list pgsql-hackers

From Franck Verrot
Subject Re: Mention column name in error messages
Date
Msg-id CANfkH5=8OjF4k9VPXjzOeyeM70TN69PjvW7eSy6CAgJX5a9n0Q@mail.gmail.com
Whole thread Raw
In response to Re: Mention column name in error messages  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Mention column name in error messages
List pgsql-hackers


On Sat, Nov 5, 2016 at 11:13 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
The cases that are successfully annotated by the current patch seem to
mostly already have error cursor information, which really is good enough
IMO --- you can certainly figure out which column corresponds to the
textual spot that the cursor is pointing at.  


The original intent of that patch tried to cover the case where we insert records
made of dozens columns sharing the same type definition, and trying to understand
what is going on, at a glance, when we debugged something like this:


    # create table probes (
        id int,
        pin_1 varchar(2),
        pin_2 varchar(2),
        ...
        pin_19 varchar(2),
        pin_20 varchar(2));
    CREATE TABLE
    
    # insert into probes (
        pin_1,
        pin_2,
        ...
        pin_19,
        pin_20)
      values ( <only valid values> );
    INSERT 0 1
    
    # insert into probes (
        pin_1,
        pin_2,
        ...
        pin_19,
        pin_20)
      values ( <values, some subjects to type casting errors> );
    ERROR:  value too long for type character varying(2)


Relying on the cursor seems to be of little help I'm afraid.


Thanks for having looked into that, very useful to try understanding all
the mechanisms that are involved to make that happen.

Franck

-- 
Franck Verrot

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Add support for SRF and returning composites to pl/tcl
Next
From: Tom Lane
Date:
Subject: Re: Mention column name in error messages