remove "msg" parameter from convert_tuples_by_name

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: remove "msg" parameter from convert_tuples_by_name
Date: 2019-08-06 22:47:28
Message-ID: 20190806224728.GA17233@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, here's a pretty trivial cleanup.

Currently, you have to pass the errmsg text to convert_tuples_by_name
and convert_tuples_by_position that's going to be raised if the tuple
descriptors don't match. In the latter's case that makes sense, as each
case is pretty specific and tailored messages can be offered, so this is
useful.

However, in the case of convert_tuples_by_name, it seems we don't have
enough control over what is being called, so there's no way to
produce tailored messages -- all the callers are using the same generic
wording: "could not convert row type".

This code was introduced by dcb2bda9b704; I think back then we were
thinking that it would be possible to give different error messages for
different cases (as convert_tuples_by_position was already doing then),
however it seems clear now that that'll never happen.

I propose we get rid of it by having convert_tuples_by_name supply the
error message by itself, as in the attached patch.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Remove-msg-param-from-convert_tuples_by_name-and-fri.patch text/x-diff 15.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Lambert 2019-08-06 22:52:12 Re: FETCH FIRST clause PERCENT option
Previous Message Bruce Momjian 2019-08-06 22:45:06 Re: [Proposal] Table-level Transparent Data Encryption (TDE) and Key Management Service (KMS)