1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Tweak FOR UPDATE/SHARE error message wording (again)

In commit 0ac5ad5134 I changed some error messages from "FOR
UPDATE/SHARE" to a rather long gobbledygook which nobody liked.  Then,
in commit cb9b66d31 I changed them again, but the alternative chosen
there was deemed suboptimal by Peter Eisentraut, who in message
1373937980.20441.8.camel@vanquo.pezone.net proposed an alternative
involving a dynamically-constructed string based on the actual locking
strength specified in the SQL command.  This patch implements that
suggestion.
This commit is contained in:
Alvaro Herrera
2013-07-23 14:03:09 -04:00
parent 026bc46da3
commit 5712eeb2e7
4 changed files with 118 additions and 22 deletions

View File

@ -26,6 +26,7 @@
#include "optimizer/prep.h"
#include "optimizer/restrictinfo.h"
#include "optimizer/var.h"
#include "parser/analyze.h"
#include "rewrite/rewriteManip.h"
#include "utils/lsyscache.h"
@ -883,7 +884,10 @@ make_outerjoininfo(PlannerInfo *root,
(jointype == JOIN_FULL && bms_is_member(rc->rti, left_rels)))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("row-level locks cannot be applied to the nullable side of an outer join")));
/*------
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to the nullable side of an outer join",
LCS_asString(rc->strength))));
}
sjinfo->syn_lefthand = left_rels;

View File

@ -1081,7 +1081,11 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
if (parse->rowMarks)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("row-level locks are not allowed with UNION/INTERSECT/EXCEPT")));
/*------
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s is not allowed with UNION/INTERSECT/EXCEPT",
LCS_asString(((RowMarkClause *)
linitial(parse->rowMarks))->strength))));
/*
* Calculate pathkeys that represent result ordering requirements