aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/util')
-rw-r--r--src/backend/optimizer/util/clauses.c32
-rw-r--r--src/backend/optimizer/util/pathnode.c4
-rw-r--r--src/backend/optimizer/util/plancat.c8
-rw-r--r--src/backend/optimizer/util/relnode.c12
-rw-r--r--src/backend/optimizer/util/tlist.c4
5 files changed, 31 insertions, 29 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index d35cbee92e7..5df7e1c3cb3 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.146 2003/07/03 19:07:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.147 2003/07/25 00:01:08 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -404,7 +404,9 @@ count_agg_clause_walker(Node *node, int *count)
* nested agg functions are semantically nonsensical.
*/
if (contain_agg_clause((Node *) ((Aggref *) node)->target))
- elog(ERROR, "Aggregate function calls may not be nested");
+ ereport(ERROR,
+ (errcode(ERRCODE_GROUPING_ERROR),
+ errmsg("aggregate function calls may not be nested")));
/*
* Having checked that, we need not recurse into the argument.
@@ -982,14 +984,15 @@ CommuteClause(OpExpr *clause)
Oid opoid;
Node *temp;
+ /* Sanity checks: caller is at fault if these fail */
if (!is_opclause(clause) ||
length(clause->args) != 2)
- elog(ERROR, "CommuteClause: applied to non-binary-operator clause");
+ elog(ERROR, "cannot commute non-binary-operator clause");
opoid = get_commutator(clause->opno);
if (!OidIsValid(opoid))
- elog(ERROR, "CommuteClause: no commutator for operator %u",
+ elog(ERROR, "could not find commutator for operator %u",
clause->opno);
/*
@@ -1346,7 +1349,7 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
/* Else we still need a NOT node */
return (Node *) make_notclause(lfirst(args));
default:
- elog(ERROR, "eval_const_expressions: unexpected boolop %d",
+ elog(ERROR, "unrecognized boolop: %d",
(int) expr->boolop);
break;
}
@@ -1357,7 +1360,7 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
* Return a SubPlan unchanged --- too late to do anything
* with it.
*
- * XXX should we elog() here instead? Probably this routine
+ * XXX should we ereport() here instead? Probably this routine
* should never be invoked after SubPlan creation.
*/
return node;
@@ -1610,7 +1613,7 @@ simplify_function(Oid funcid, Oid result_type, List *args,
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(func_tuple))
- elog(ERROR, "Function OID %u does not exist", funcid);
+ elog(ERROR, "cache lookup failed for function %u", funcid);
newexpr = evaluate_function(funcid, result_type, args, func_tuple);
@@ -1794,8 +1797,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
Anum_pg_proc_prosrc,
&isNull);
if (isNull)
- elog(ERROR, "inline_function: null prosrc for procedure %u",
- funcid);
+ elog(ERROR, "null prosrc for function %u", funcid);
src = DatumGetCString(DirectFunctionCall1(textout, tmp));
/*
@@ -1961,9 +1963,9 @@ substitute_actual_parameters_mutator(Node *node,
Param *param = (Param *) node;
if (param->paramkind != PARAM_NUM)
- elog(ERROR, "substitute_actual_parameters_mutator: unexpected paramkind");
+ elog(ERROR, "unexpected paramkind: %d", param->paramkind);
if (param->paramid <= 0 || param->paramid > context->nargs)
- elog(ERROR, "substitute_actual_parameters_mutator: unexpected paramid");
+ elog(ERROR, "invalid paramid: %d", param->paramid);
/* Count usage of parameter */
context->usecounts[param->paramid - 1]++;
@@ -2350,8 +2352,8 @@ expression_tree_walker(Node *node,
}
break;
default:
- elog(ERROR, "expression_tree_walker: Unexpected node type %d",
- nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(node));
break;
}
return false;
@@ -2816,8 +2818,8 @@ expression_tree_mutator(Node *node,
}
break;
default:
- elog(ERROR, "expression_tree_mutator: Unexpected node type %d",
- nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(node));
break;
}
/* can't get here, but keep compiler happy */
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 19198bf2494..61ab51747c1 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.92 2003/07/14 22:35:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.93 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -133,7 +133,7 @@ set_cheapest(RelOptInfo *parent_rel)
Assert(IsA(parent_rel, RelOptInfo));
if (pathlist == NIL)
- elog(ERROR, "Unable to devise a query plan for the given query");
+ elog(ERROR, "could not devise a query plan for the given query");
cheapest_startup_path = cheapest_total_path = (Path *) lfirst(pathlist);
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 3f4fe661717..6823f03267e 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.84 2003/06/29 23:05:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.85 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -258,7 +258,7 @@ restriction_selectivity(Query *root,
Int32GetDatum(varRelid)));
if (result < 0.0 || result > 1.0)
- elog(ERROR, "restriction_selectivity: bad value %f", result);
+ elog(ERROR, "invalid restriction selectivity: %f", result);
return (Selectivity) result;
}
@@ -293,7 +293,7 @@ join_selectivity(Query *root,
Int16GetDatum(jointype)));
if (result < 0.0 || result > 1.0)
- elog(ERROR, "join_selectivity: bad value %f", result);
+ elog(ERROR, "invalid join selectivity: %f", result);
return (Selectivity) result;
}
@@ -365,7 +365,7 @@ has_subclass(Oid relationId)
ObjectIdGetDatum(relationId),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
- elog(ERROR, "has_subclass: Relation %u not found", relationId);
+ elog(ERROR, "cache lookup failed for relation %u", relationId);
result = ((Form_pg_class) GETSTRUCT(tuple))->relhassubclass;
ReleaseSysCache(tuple);
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 0b82569ba37..9a4a2069765 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.49 2003/06/29 23:05:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.50 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,7 +55,7 @@ build_base_rel(Query *root, int relid)
{
rel = (RelOptInfo *) lfirst(rels);
if (relid == rel->relid)
- elog(ERROR, "build_base_rel: rel already exists");
+ elog(ERROR, "rel already exists");
}
/* It should not exist as an "other" rel, either */
@@ -63,7 +63,7 @@ build_base_rel(Query *root, int relid)
{
rel = (RelOptInfo *) lfirst(rels);
if (relid == rel->relid)
- elog(ERROR, "build_base_rel: rel already exists as 'other' rel");
+ elog(ERROR, "rel already exists as \"other\" rel");
}
/* No existing RelOptInfo for this base rel, so make a new one */
@@ -98,7 +98,7 @@ build_other_rel(Query *root, int relid)
{
rel = (RelOptInfo *) lfirst(rels);
if (relid == rel->relid)
- elog(ERROR, "build_other_rel: rel already exists as base rel");
+ elog(ERROR, "rel already exists as base rel");
}
/* No existing RelOptInfo for this other rel, so make a new one */
@@ -165,7 +165,7 @@ make_base_rel(Query *root, int relid)
rel->max_attr = length(rte->eref->colnames);
break;
default:
- elog(ERROR, "make_base_rel: unsupported RTE kind %d",
+ elog(ERROR, "unrecognized RTE kind: %d",
(int) rte->rtekind);
break;
}
@@ -211,7 +211,7 @@ find_base_rel(Query *root, int relid)
return rel;
}
- elog(ERROR, "find_base_rel: no relation entry for relid %d", relid);
+ elog(ERROR, "no relation entry for relid %d", relid);
return NULL; /* keep compiler quiet */
}
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index 7a4422a3594..26d7d6fb245 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.57 2003/06/29 23:05:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.58 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -183,7 +183,7 @@ get_sortgroupclause_tle(SortClause *sortClause,
return tle;
}
- elog(ERROR, "get_sortgroupclause_tle: ORDER/GROUP BY expression not found in targetlist");
+ elog(ERROR, "ORDER/GROUP BY expression not found in targetlist");
return NULL; /* keep compiler quiet */
}