From: | Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Add column name to error description |
Date: | 2024-03-31 13:22:15 |
Message-ID: | CAB-JLwanky28gjAMdnMh1CjyO1b2zLdr6UOA1-oY9G7PVL9KKQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
Add column name to error description.patch | application/octet-stream | 847 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Yugo NAGATA | 2024-03-31 13:25:02 | Re: pgbnech: allow to cancel queries during benchmark |
Previous Message | Joe Conway | 2024-03-31 12:15:59 | Re: Security lessons from liblzma |