Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d63e05a

Browse files
committed
Improve error message wording in unary_op_error() --- suggest that
problem could be lack of parentheses. This addresses cases like X UserOp UserOp Y, which will be parsed as (X UserOp) UserOp Y, whereas what likely was wanted was X UserOp (UserOp Y).
1 parent f91dd78 commit d63e05a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/backend/parser/parse_oper.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.37 2000/03/11 23:17:47 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.38 2000/03/18 19:53:54 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -703,18 +703,14 @@ op_error(char *op, Oid arg1, Oid arg2)
703703
if (typeidIsValid(arg1))
704704
tp1 = typeidType(arg1);
705705
else
706-
{
707706
elog(ERROR, "Left hand side of operator '%s' has an unknown type"
708707
"\n\tProbably a bad attribute name", op);
709-
}
710708

711709
if (typeidIsValid(arg2))
712710
tp2 = typeidType(arg2);
713711
else
714-
{
715712
elog(ERROR, "Right hand side of operator %s has an unknown type"
716713
"\n\tProbably a bad attribute name", op);
717-
}
718714

719715
elog(ERROR, "Unable to identify an operator '%s' for types '%s' and '%s'"
720716
"\n\tYou will have to retype this query using an explicit cast",
@@ -741,7 +737,7 @@ unary_op_error(char *op, Oid arg, bool is_left_op)
741737
}
742738

743739
elog(ERROR, "Unable to identify a %s operator '%s' for type '%s'"
744-
"\n\tYou will have to retype this query using an explicit cast",
740+
"\n\tYou may need to add parentheses or an explicit cast",
745741
(is_left_op ? "left" : "right"),
746742
op, typeTypeName(tp1));
747743
}

0 commit comments

Comments
 (0)