[MASSMAIL]Add column name to error description - Mailing list pgsql-hackers

From Marcos Pegoraro
Subject [MASSMAIL]Add column name to error description
Date
Msg-id CAB-JLwanky28gjAMdnMh1CjyO1b2zLdr6UOA1-oY9G7PVL9KKQ@mail.gmail.com
Whole thread Raw
Responses Re: Add column name to error description
List pgsql-hackers
This is my first patch, so sorry if I miss something.

If I have a function which returns lots of columns and any of these columns returns a wrong type it's not easy to see which one is that column because it points me only to its position, not its name. So, this patch only adds that column name, just that.

create function my_f(a integer, b integer) returns table(first_col integer, lots_of_cols_later numeric) language plpgsql as $function$
begin
  return query select a, b;
end;$function$;

select * from my_f(1,1);
--ERROR: structure of query does not match function result type
--Returned type integer does not match expected type numeric in column 2.

For a function which has just 2 columns is easy but if it returns a hundred of columns, which one is that 66th column ?

My patch just adds column name to that description message.
--ERROR: structure of query does not match function result type
--Returned type integer does not match expected type numeric in column 2- lots_of_cols_later.

regards
Marcos
Attachment

pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: Security lessons from liblzma
Next
From: Yugo NAGATA
Date:
Subject: Re: pgbnech: allow to cancel queries during benchmark