Thread: pgsql: Add some errdetail to checkRuleResultList().

pgsql: Add some errdetail to checkRuleResultList().

From
Tom Lane
Date:
Add some errdetail to checkRuleResultList().

This function wasn't originally thought to be really user-facing,
because converting a table to a view isn't something we expect people
to do manually.  So not all that much effort was spent on the error
messages; in particular, while the code will complain that you got
the column types wrong it won't say exactly what they are.  But since
we repurposed the code to also check compatibility of rule RETURNING
lists, it's definitely user-facing.  It now seems worthwhile to add
errdetail messages showing exactly what the conflict is when there's
a mismatch of column names or types.  This is prompted by bug #10836
from Matthias Raffelsieper, which might have been forestalled if the
error message had reported the wrong column type as being "record".

Back-patch to 9.4, but not into older branches where the set of
translatable error strings is supposed to be stable.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7980ab30ecf36162699f138697e2ff5589d9063e

Modified Files
--------------
src/backend/rewrite/rewriteDefine.c |   33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)


Re: pgsql: Add some errdetail to checkRuleResultList().

From
Tom Lane
Date:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tom Lane wrote:
>> Add some errdetail to checkRuleResultList().

>> Back-patch to 9.4, but not into older branches where the set of
>> translatable error strings is supposed to be stable.

> Since most of this patch just adds new messages and not change existing
> ones, I think it's fine to backpatch.  People would get the translated
> error message, and an errdetail that might be in english, which seems
> better than not getting the errdetail at all.

Well, that's a fair point, especially since you could probably infer the
meaning well enough from context anyway.  I'll take out the one wording
change I did make, and back-patch the rest of this further.

            regards, tom lane


Re: pgsql: Add some errdetail to checkRuleResultList().

From
Alvaro Herrera
Date:
Tom Lane wrote:
> Add some errdetail to checkRuleResultList().

> Back-patch to 9.4, but not into older branches where the set of
> translatable error strings is supposed to be stable.

Since most of this patch just adds new messages and not change existing
ones, I think it's fine to backpatch.  People would get the translated
error message, and an errdetail that might be in english, which seems
better than not getting the errdetail at all.  In any case, several
translators do translate new messages for future minor releases for
stable branches.  It seems wrong to not provide message improvements
just because some translators are slacking.

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