* geqo_erx.c
* edge recombination crossover [ER]
*
-* $Id: geqo_erx.c,v 1.17 2002/03/02 21:39:26 momjian Exp $
+* $Id: geqo_erx.c,v 1.18 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
minimum_count = 1;
}
else if (minimum_count == -1)
- elog(ERROR, "gimme_gene: Internal error - minimum_count not set");
+ elog(ERROR, "minimum_count not set");
else if (edge_table[(int) friend].unused_edges == minimum_edges)
minimum_count++;
}
/* ... should never be reached */
- elog(ERROR, "gimme_gene: neither shared nor minimum number nor random edge found");
+ elog(ERROR, "neither shared nor minimum number nor random edge found");
return 0; /* to keep the compiler quiet */
}
}
}
- elog(LOG, "edge_failure(1): no edge found via random decision and total_edges == 4");
+ elog(LOG, "no edge found via random decision and total_edges == 4");
}
-
- else
-/* random decision of the gene with remaining edges */
-
- if (remaining_edges != 0)
+ else if (remaining_edges != 0)
{
-
+ /* random decision of the gene with remaining edges */
rand_decision = (int) geqo_randint(remaining_edges - 1, 0);
for (i = 1; i <= num_gene; i++)
}
}
- elog(LOG, "edge_failure(2): no edge found via random decision and remainig edges");
+ elog(LOG, "no edge found via random decision with remaining edges");
}
/*
if (edge_table[i].unused_edges >= 0)
return (Gene) i;
- elog(LOG, "edge_failure(3): no edge found via looking for the last ununsed point");
+ elog(LOG, "no edge found via looking for the last ununsed point");
}
-/* ... should never be reached */
- elog(ERROR, "edge_failure: no edge detected");
+ /* ... should never be reached */
+ elog(ERROR, "no edge found");
return 0; /* to keep the compiler quiet */
}
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.62 2003/05/02 20:54:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.63 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* Since geqo_eval() will be called many times, we can't afford to let
* all that memory go unreclaimed until end of statement. Note we
* make the temp context a child of the planner's normal context, so that
- * it will be freed even if we abort via elog(ERROR).
+ * it will be freed even if we abort via ereport(ERROR).
*/
mycontext = AllocSetContextCreate(CurrentMemoryContext,
"GEQO",
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.35 2003/05/27 17:49:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.36 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
daddy = alloc_chromo(pool->string_length);
#if defined (ERX)
- elog(DEBUG2, "geqo_main: using edge recombination crossover [ERX]");
+ elog(DEBUG2, "using edge recombination crossover [ERX]");
/* allocate edge table memory */
edge_table = alloc_edge_table(pool->string_length);
#elif defined(PMX)
- elog(DEBUG2, "geqo_main: using partially matched crossover [PMX]");
+ elog(DEBUG2, "using partially matched crossover [PMX]");
/* allocate chromosome kid memory */
kid = alloc_chromo(pool->string_length);
#elif defined(CX)
- elog(DEBUG2, "geqo_main: using cycle crossover [CX]");
+ elog(DEBUG2, "using cycle crossover [CX]");
/* allocate city table memory */
kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length);
#elif defined(PX)
- elog(DEBUG2, "geqo_main: using position crossover [PX]");
+ elog(DEBUG2, "using position crossover [PX]");
/* allocate city table memory */
kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length);
#elif defined(OX1)
- elog(DEBUG2, "geqo_main: using order crossover [OX1]");
+ elog(DEBUG2, "using order crossover [OX1]");
/* allocate city table memory */
kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length);
#elif defined(OX2)
- elog(DEBUG2, "geqo_main: using order crossover [OX2]");
+ elog(DEBUG2, "using order crossover [OX2]");
/* allocate city table memory */
kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length);
elog(LOG, "[GEQO] failures: %d, average: %d",
edge_failures, (int) generation / edge_failures);
else
- elog(LOG, "[GEQO] No edge failures detected.");
+ elog(LOG, "[GEQO] no edge failures detected");
#endif
if (mutations != 0)
elog(LOG, "[GEQO] mutations: %d, generations: %d", mutations, generation);
else
- elog(LOG, "[GEQO] No mutations processed.");
+ elog(LOG, "[GEQO] no mutations processed");
#endif
best_tour, pool->string_length);
if (best_rel == NULL)
- elog(ERROR, "geqo: failed to make a valid plan");
+ elog(ERROR, "failed to make a valid plan");
/* DBG: show the query plan */
#ifdef NOT_USED
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_misc.c,v 1.36 2002/12/16 21:30:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_misc.c,v 1.37 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
double cumulative = 0.0;
if (pool->size <= 0)
- elog(ERROR, "avg_pool: pool_size of zero");
+ elog(ERROR, "pool_size is zero");
/*
* Since the pool may contain multiple occurrences of DBL_MAX, divide
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.103 2003/06/29 23:05:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.104 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* do better?
*/
if (intMember(parentRTindex, root->rowMarks))
- elog(ERROR, "SELECT FOR UPDATE is not supported for inherit queries");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE is not supported for inherit queries")));
/*
* The executor will check the parent table's access permissions when
}
else
{
- elog(ERROR, "recurse_pushdown_safe: unexpected node %d",
+ elog(ERROR, "unrecognized node type: %d",
(int) nodeTag(setOp));
}
return true;
}
else
{
- elog(ERROR, "recurse_push_qual: unexpected node %d",
+ elog(ERROR, "unrecognized node type: %d",
(int) nodeTag(setOp));
}
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.110 2003/07/14 22:35:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.111 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
else if (IsA(node, SubLink))
{
/* This routine should not be applied to un-planned expressions */
- elog(ERROR, "cost_qual_eval: can't handle unplanned sub-select");
+ elog(ERROR, "cannot handle unplanned sub-select");
}
else if (IsA(node, SubPlan))
{
temp = inner_rel->rows;
break;
default:
- elog(ERROR, "set_joinrel_size_estimates: unsupported join type %d",
- (int) jointype);
+ elog(ERROR, "unrecognized join type: %d", (int) jointype);
temp = 0; /* keep compiler quiet */
break;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.144 2003/06/15 22:51:45 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.145 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
} while (!DoneMatchingIndexKeys(classes));
if (FastListValue(&quals) == NIL)
- elog(ERROR, "extract_or_indexqual_conditions: no matching clause");
+ elog(ERROR, "no matching OR clause");
return FastListValue(&quals);
}
if (!OidIsValid(test_op))
{
/* This should not fail, else pg_amop entry is missing */
- elog(ERROR, "Missing pg_amop entry for opclass %u strategy %d",
+ elog(ERROR, "missing pg_amop entry for opclass %u strategy %d",
opclass_id, test_strategy);
}
if (isNull)
{
/* Treat a null result as false ... but it's a tad fishy ... */
- elog(DEBUG2, "pred_test_simple_clause: null test result");
+ elog(DEBUG2, "null predicate test result");
return false;
}
return DatumGetBool(test_result);
break;
default:
- elog(ERROR, "prefix_quals: unexpected opclass %u", opclass);
+ /* shouldn't get here */
+ elog(ERROR, "unexpected opclass: %u", opclass);
return NIL;
}
prefix_const->constvalue));
break;
default:
- elog(ERROR, "prefix_quals: unexpected consttype %u",
+ elog(ERROR, "unexpected const type: %u",
prefix_const->consttype);
return NIL;
}
{
oproid = get_opclass_member(opclass, BTEqualStrategyNumber);
if (oproid == InvalidOid)
- elog(ERROR, "prefix_quals: no operator = for opclass %u", opclass);
+ elog(ERROR, "no = operator for opclass %u", opclass);
expr = make_opclause(oproid, BOOLOID, false,
(Expr *) leftop, (Expr *) prefix_const);
result = makeList1(expr);
*/
oproid = get_opclass_member(opclass, BTGreaterEqualStrategyNumber);
if (oproid == InvalidOid)
- elog(ERROR, "prefix_quals: no operator >= for opclass %u", opclass);
+ elog(ERROR, "no >= operator for opclass %u", opclass);
expr = make_opclause(oproid, BOOLOID, false,
(Expr *) leftop, (Expr *) prefix_const);
result = makeList1(expr);
{
oproid = get_opclass_member(opclass, BTLessStrategyNumber);
if (oproid == InvalidOid)
- elog(ERROR, "prefix_quals: no operator < for opclass %u", opclass);
+ elog(ERROR, "no < operator for opclass %u", opclass);
expr = make_opclause(oproid, BOOLOID, false,
(Expr *) leftop, (Expr *) greaterstr);
result = lappend(result, expr);
is_eq = true;
break;
default:
- elog(ERROR, "network_prefix_quals: unexpected operator %u",
- expr_op);
+ elog(ERROR, "unexpected operator: %u", expr_op);
return NIL;
}
{
opr1oid = get_opclass_member(opclass, BTGreaterEqualStrategyNumber);
if (opr1oid == InvalidOid)
- elog(ERROR, "network_prefix_quals: no >= operator for opclass %u",
- opclass);
+ elog(ERROR, "no >= operator for opclass %u", opclass);
}
else
{
opr1oid = get_opclass_member(opclass, BTGreaterStrategyNumber);
if (opr1oid == InvalidOid)
- elog(ERROR, "network_prefix_quals: no > operator for opclass %u",
- opclass);
+ elog(ERROR, "no > operator for opclass %u", opclass);
}
opr1right = network_scan_first(rightop);
opr2oid = get_opclass_member(opclass, BTLessEqualStrategyNumber);
if (opr2oid == InvalidOid)
- elog(ERROR, "network_prefix_quals: no <= operator for opclass %u",
- opclass);
+ elog(ERROR, "no <= operator for opclass %u", opclass);
opr2right = network_scan_last(rightop);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.78 2003/02/08 20:20:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.79 2003/07/25 00:01:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
useallclauses = true;
break;
default:
- elog(ERROR, "sort_inner_and_outer: unexpected join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) jointype);
useallclauses = false; /* keep compiler quiet */
break;
useallclauses = true;
break;
default:
- elog(ERROR, "match_unsorted_outer: unexpected join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) jointype);
nestjoinOK = false; /* keep compiler quiet */
useallclauses = false;
case JOIN_FULL:
if (restrictinfo->left_relids == NULL ||
restrictinfo->mergejoinoperator == InvalidOid)
- elog(ERROR, "FULL JOIN is only supported with mergejoinable join conditions");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("FULL JOIN is only supported with mergejoinable join conditions")));
break;
default:
/* otherwise, it's OK to have nonmergeable join quals */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.60 2003/02/08 20:20:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.61 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
if (result_rels == NIL)
- elog(ERROR, "make_rels_by_joins: failed to build any %d-way joins",
- level);
+ elog(ERROR, "failed to build any %d-way joins", level);
}
return result_rels;
/* Make this join rel */
rel = make_join_rel(root, lrel, rrel, j->jointype);
- if (rel == NULL)
- elog(ERROR, "make_jointree_rel: invalid join order!?");
+ if (rel == NULL) /* oops */
+ elog(ERROR, "invalid join order");
/*
* Since we are only going to consider this one way to do it,
return rel;
}
else
- elog(ERROR, "make_jointree_rel: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return NULL; /* keep compiler quiet */
}
restrictlist);
break;
default:
- elog(ERROR, "make_join_rel: unsupported join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) jointype);
break;
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.50 2003/06/29 23:05:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.51 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
- elog(ERROR, "make_pathkeys_for_mergeclauses: can't identify which side of mergeclause to use");
+ elog(ERROR, "could not identify which side of mergeclause to use");
pathkey = NIL; /* keep compiler quiet */
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.148 2003/07/14 22:35:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.149 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
(UniquePath *) best_path);
break;
default:
- elog(ERROR, "create_plan: unknown pathtype %d",
- best_path->pathtype);
+ elog(ERROR, "unrecognized node type: %d",
+ (int) best_path->pathtype);
plan = NULL; /* keep compiler quiet */
break;
}
break;
default:
- elog(ERROR, "create_scan_plan: unknown node type: %d",
- best_path->pathtype);
+ elog(ERROR, "unrecognized node type: %d",
+ (int) best_path->pathtype);
plan = NULL; /* keep compiler quiet */
break;
}
inner_plan);
break;
default:
- elog(ERROR, "unsupported node type %d",
- best_path->path.pathtype);
+ elog(ERROR, "unrecognized node type: %d",
+ (int) best_path->path.pathtype);
plan = NULL; /* keep compiler quiet */
break;
}
Oid opclass;
if (!IsA(clause, OpExpr) || length(clause->args) != 2)
- elog(ERROR, "fix_indxqual_sublist: indexqual clause is not binary opclause");
+ elog(ERROR, "indexqual clause is not binary opclause");
/*
* Make a copy that will become the fixed clause.
}
/* Ooops... */
- elog(ERROR, "fix_indxqual_operand: node is not index attribute");
+ elog(ERROR, "node is not an index attribute");
return NULL; /* keep compiler quiet */
}
break;
}
if (!j)
- elog(ERROR, "make_sort_from_pathkeys: cannot find pathkey item to sort");
+ elog(ERROR, "could not find pathkey item to sort");
/*
* Do we need to insert a Result node?
*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.86 2003/06/29 23:05:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.87 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* Safety check: join RTEs should not be SELECT FOR UPDATE targets
*/
if (intMember(j->rtindex, root->rowMarks))
- elog(ERROR, "SELECT FOR UPDATE cannot be applied to a join");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE cannot be applied to a join")));
}
else
- elog(ERROR, "add_base_rels_to_query: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
}
* This is where we fail if upper levels of planner
* haven't rewritten UNION JOIN as an Append ...
*/
- elog(ERROR, "UNION JOIN is not implemented yet");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("UNION JOIN is not implemented yet")));
break;
default:
- elog(ERROR,
- "distribute_quals_to_rels: unsupported join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) j->jointype);
break;
}
mark_baserels_for_outer_join(root, nullable_rels, result);
}
else
- elog(ERROR, "distribute_quals_to_rels: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return result;
}
if (rel->outerjoinset == NULL)
{
if (intMember(relno, root->rowMarks))
- elog(ERROR, "SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN")));
}
rel->outerjoinset = outerrels;
* 'clause' references no rels, and therefore we have no place to
* attach it. Shouldn't get here if callers are working properly.
*/
- elog(ERROR, "distribute_qual_to_rels: can't cope with variable-free clause");
+ elog(ERROR, "cannot cope with variable-free clause");
break;
}
* we have no suitable equality operator for the combination of
* datatypes? NO, because sortkey selection may screw up anyway.
*/
- elog(ERROR, "Unable to identify an equality operator for types '%s' and '%s'",
- format_type_be(ltype), format_type_be(rtype));
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_FUNCTION),
+ errmsg("unable to identify an equality operator for types %s and %s",
+ format_type_be(ltype), format_type_be(rtype))));
}
pgopform = (Form_pg_operator) GETSTRUCT(eq_operator);
if (pgopform->oprlsortop != sortop1 ||
pgopform->oprrsortop != sortop2 ||
pgopform->oprresult != BOOLOID)
- elog(ERROR, "Equality operator for types '%s' and '%s' should be mergejoinable, but isn't",
- format_type_be(ltype), format_type_be(rtype));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
+ errmsg("equality operator for types %s and %s should be mergejoinable, but isn't",
+ format_type_be(ltype), format_type_be(rtype))));
clause = make_opclause(oprid(eq_operator), /* opno */
BOOLOID, /* opresulttype */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.75 2003/03/10 03:53:50 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.76 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
final_rel = make_one_rel(root);
if (!final_rel || !final_rel->cheapest_total_path)
- elog(ERROR, "query_planner: failed to construct a relation");
+ elog(ERROR, "failed to construct the join relation");
/*
* Now that we have an estimate of the final rel's size, we can
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.156 2003/07/03 19:07:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.157 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
j->quals = preprocess_expression(parse, j->quals, EXPRKIND_QUAL);
}
else
- elog(ERROR, "preprocess_qual_conditions: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
}
/*--------------------
* already, but let's make sure).
*/
if (parse->rowMarks)
- elog(ERROR, "SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT")));
/*
* We set current_pathkeys NIL indicating we do not know sort
* level
*/
if (PlannerQueryLevel > 1)
- elog(ERROR, "SELECT FOR UPDATE is not allowed in subselects");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE is not allowed in subselects")));
foreach(l, parse->rowMarks)
{
break;
}
if (!sl)
- elog(ERROR, "locate_grouping_columns: failed");
+ elog(ERROR, "failed to locate grouping columns");
groupColIdx[keyno++] = te->resdom->resno;
}
* We need to transpose sort key info from the orig_tlist into new_tlist.
* NOTE: this would not be good enough if we supported resjunk sort keys
* for results of set operations --- then, we'd need to project a whole
- * new tlist to evaluate the resjunk columns. For now, just elog if we
+ * new tlist to evaluate the resjunk columns. For now, just ereport if we
* find any resjunk columns in orig_tlist.
*/
static List *
Assert(orig_tlist != NIL);
orig_tle = (TargetEntry *) lfirst(orig_tlist);
orig_tlist = lnext(orig_tlist);
- if (orig_tle->resdom->resjunk)
- elog(ERROR, "postprocess_setop_tlist: resjunk output columns not implemented");
+ if (orig_tle->resdom->resjunk) /* should not happen */
+ elog(ERROR, "resjunk output columns are not implemented");
Assert(new_tle->resdom->resno == orig_tle->resdom->resno);
Assert(new_tle->resdom->restype == orig_tle->resdom->restype);
new_tle->resdom->ressortgroupref = orig_tle->resdom->ressortgroupref;
}
if (orig_tlist != NIL)
- elog(ERROR, "postprocess_setop_tlist: resjunk output columns not implemented");
+ elog(ERROR, "resjunk output columns are not implemented");
return new_tlist;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.93 2003/06/29 00:33:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.94 2003/07/25 00:01:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
set_plan_references((Plan *) lfirst(pl), rtable);
break;
default:
- elog(ERROR, "set_plan_references: unknown plan type %d",
- nodeTag(plan));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(plan));
break;
}
return (Node *) copyObject(var);
/* No referent found for Var */
- elog(ERROR, "join_references: variable not in subplan target lists");
+ elog(ERROR, "variable not found in subplan target lists");
}
/* Try matching more complex expressions too, if tlists have any */
if (context->tlists_have_non_vars)
resdom = tlist_member((Node *) var, context->subplan_targetlist);
if (!resdom)
- elog(ERROR, "replace_vars_with_subplan_refs: variable not in subplan target list");
+ elog(ERROR, "variable not found in subplan target list");
newvar = (Var *) copyObject(var);
newvar->varno = context->subvarno;
newvar->varattno = resdom->resno;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.78 2003/06/25 21:30:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.79 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Assert(!te->resdom->resjunk);
arraytype = get_array_type(te->resdom->restype);
if (!OidIsValid(arraytype))
- elog(ERROR, "Cannot find array type for datatype %s",
+ elog(ERROR, "could not find array type for datatype %s",
format_type_be(te->resdom->restype));
prm = generate_new_param(arraytype, -1);
node->setParam = makeListi1(prm->paramid);
break;
default:
- elog(ERROR, "finalize_plan: node %d unsupported",
- nodeTag(plan));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(plan));
}
/* Process left and right child plans, if any */
/* Now we have all the paramids */
if (!bms_is_subset(context.paramids, valid_params))
- elog(ERROR, "finalize_plan: plan shouldn't reference subplan's variable");
+ elog(ERROR, "plan should not reference subplan's variable");
plan->extParam = bms_intersect(context.paramids, outer_params);
plan->allParam = context.paramids;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.7 2003/03/10 03:53:50 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.8 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* This is where we fail if upper levels of planner
* haven't rewritten UNION JOIN as an Append ...
*/
- elog(ERROR, "UNION JOIN is not implemented yet");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("UNION JOIN is not implemented yet")));
break;
default:
- elog(ERROR, "pull_up_subqueries: unexpected join type %d",
- j->jointype);
+ elog(ERROR, "unrecognized join type: %d",
+ (int) j->jointype);
break;
}
}
else
- elog(ERROR, "pull_up_subqueries: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return jtnode;
}
subquery->commandType != CMD_SELECT ||
subquery->resultRelation != 0 ||
subquery->into != NULL)
- elog(ERROR, "is_simple_subquery: subquery is bogus");
+ elog(ERROR, "subquery is bogus");
/*
* Can't currently pull up a query with setops. Maybe after querytree
*/
}
else
- elog(ERROR, "resolvenew_in_jointree: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
}
/*
/* planner.c shouldn't have called me if no outer joins */
if (state == NULL || !state->contains_outer)
- elog(ERROR, "reduce_outer_joins: so where are the outer joins?");
+ elog(ERROR, "so where are the outer joins?");
reduce_outer_joins_pass2((Node *) parse->jointree, state, parse, NULL);
}
result->sub_states = lappend(result->sub_states, sub_state);
}
else
- elog(ERROR, "reduce_outer_joins_pass1: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return result;
}
* because it's only called on subtrees marked as contains_outer.
*/
if (jtnode == NULL)
- elog(ERROR, "reduce_outer_joins_pass2: reached empty jointree");
+ elog(ERROR, "reached empty jointree");
if (IsA(jtnode, RangeTblRef))
{
- elog(ERROR, "reduce_outer_joins_pass2: reached base rel");
+ elog(ERROR, "reached base rel");
}
else if (IsA(jtnode, FromExpr))
{
}
}
else
- elog(ERROR, "reduce_outer_joins_pass2: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
}
/*
}
}
else
- elog(ERROR, "simplify_jointree: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return jtnode;
}
result = bms_join(result, get_relids_in_jointree(j->rarg));
}
else
- elog(ERROR, "get_relids_in_jointree: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return result;
}
jtnode = find_jointree_node_for_rel((Node *) parse->jointree, joinrelid);
if (!jtnode)
- elog(ERROR, "get_relids_for_join: join node %d not found", joinrelid);
+ elog(ERROR, "could not find join node %d", joinrelid);
return get_relids_in_jointree(jtnode);
}
return jtnode;
}
else
- elog(ERROR, "find_jointree_node_for_rel: unexpected node type %d",
- nodeTag(jtnode));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(jtnode));
return NULL;
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.61 2003/05/12 00:17:03 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.62 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
RangeTblEntry *rte = rt_fetch(result_relation, range_table);
if (rte->subquery != NULL || rte->relid == InvalidOid)
- elog(ERROR, "preprocess_targetlist: subquery cannot be result relation");
+ elog(ERROR, "subquery cannot be result relation");
}
/*
}
break;
default:
- elog(ERROR, "expand_targetlist: unexpected command_type");
+ elog(ERROR, "unrecognized command_type: %d",
+ (int) command_type);
new_expr = NULL; /* keep compiler quiet */
break;
}
Resdom *resdom = old_tle->resdom;
if (!resdom->resjunk)
- elog(ERROR, "expand_targetlist: targetlist is not sorted correctly");
+ elog(ERROR, "targetlist is not sorted correctly");
/* Get the resno right, but don't copy unnecessarily */
if (resdom->resno != attrno)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.99 2003/07/20 21:56:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.100 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
- elog(ERROR, "recurse_set_operations: unexpected node %d",
+ elog(ERROR, "unrecognized node type: %d",
(int) nodeTag(setOp));
return NULL; /* keep compiler quiet */
}
cmd = op->all ? SETOPCMD_EXCEPT_ALL : SETOPCMD_EXCEPT;
break;
default:
- elog(ERROR, "generate_nonunion_plan: bogus operation code");
+ elog(ERROR, "unrecognized set operation code: %d",
+ (int) op->op);
cmd = SETOPCMD_INTERSECT; /* keep compiler quiet */
break;
}
*
*
* 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
* 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.
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);
/*
/* 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;
}
* 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;
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);
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));
/*
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]++;
}
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;
}
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 */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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;
}
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;
}
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);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
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 */
{
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 */
{
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 */
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;
}
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 */
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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 */
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.82 2003/01/17 02:01:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.83 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
+#include "utils/lsyscache.h"
#include "utils/syscache.h"
if (HeapTupleIsValid(oldtup))
{
if (!replace)
- elog(ERROR, "Attempt to insert rule \"%s\" failed: already exists",
- rulname);
+ ereport(ERROR,
+ (errcode(ERRCODE_DUPLICATE_OBJECT),
+ errmsg("rule \"%s\" for relation \"%s\" already exists",
+ rulname, get_rel_name(eventrel_oid))));
/*
* When replacing, we don't need to replace every attribute
if (query != getInsertSelectQuery(query, NULL))
continue;
if (query->resultRelation == PRS2_OLD_VARNO)
- elog(ERROR, "rule actions on OLD currently not supported"
- "\n\tuse views or triggers instead");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("rule actions on OLD are not implemented"),
+ errhint("Use views or triggers instead.")));
if (query->resultRelation == PRS2_NEW_VARNO)
- elog(ERROR, "rule actions on NEW currently not supported"
- "\n\tuse triggers instead");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("rule actions on NEW are not implemented"),
+ errhint("Use triggers instead.")));
}
/*
* So there cannot be INSTEAD NOTHING, ...
*/
if (length(action) == 0)
- {
- elog(ERROR, "instead nothing rules on select currently not supported"
- "\n\tuse views instead");
- }
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("INSTEAD NOTHING rules on select are not implemented"),
+ errhint("Use views instead.")));
/*
* ... there cannot be multiple actions, ...
*/
if (length(action) > 1)
- elog(ERROR, "multiple action rules on select currently not supported");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("multiple action rules on select are not implemented")));
/*
* ... the one action must be a SELECT, ...
*/
query = (Query *) lfirst(action);
if (!is_instead || query->commandType != CMD_SELECT)
- elog(ERROR, "only instead-select rules currently supported on select");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("only instead-select rules are currently supported on select")));
/*
* ... there can be no rule qual, ...
*/
if (event_qual != NULL)
- elog(ERROR, "event qualifications not supported for rules on select");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("event qualifications are not implemented for rules on select")));
/*
* ... the targetlist of the SELECT action must exactly match the
continue;
i++;
if (i > event_relation->rd_att->natts)
- elog(ERROR, "select rule's target list has too many entries");
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("select rule's target list has too many entries")));
attr = event_relation->rd_att->attrs[i - 1];
attname = NameStr(attr->attname);
* positions.
*/
if (attr->attisdropped)
- elog(ERROR, "cannot convert relation containing dropped columns to view");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot convert relation containing dropped columns to view")));
if (strcmp(resdom->resname, attname) != 0)
- elog(ERROR, "select rule's target entry %d has different column name from %s", i, attname);
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("select rule's target entry %d has different column name from \"%s\"", i, attname)));
if (attr->atttypid != resdom->restype)
- elog(ERROR, "select rule's target entry %d has different type from attribute %s", i, attname);
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("select rule's target entry %d has different type from attribute \"%s\"", i, attname)));
/*
* Allow typmods to be different only if one of them is -1,
*/
if (attr->atttypmod != resdom->restypmod &&
attr->atttypmod != -1 && resdom->restypmod != -1)
- elog(ERROR, "select rule's target entry %d has different size from attribute %s", i, attname);
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("select rule's target entry %d has different size from attribute \"%s\"", i, attname)));
}
if (i != event_relation->rd_att->natts)
- elog(ERROR, "select rule's target list has too few entries");
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("select rule's target list has too few entries")));
/*
* ... there must not be another ON SELECT rule already ...
rule = event_relation->rd_rules->rules[i];
if (rule->event == CMD_SELECT)
- elog(ERROR, "\"%s\" is already a view",
- RelationGetRelationName(event_relation));
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("\"%s\" is already a view",
+ RelationGetRelationName(event_relation))));
}
}
if (strncmp(stmt->rulename, "_RET", 4) != 0 ||
strncmp(stmt->rulename + 4, event_obj->relname,
NAMEDATALEN - 4 - 4) != 0)
- elog(ERROR, "view rule for \"%s\" must be named \"%s\"",
- event_obj->relname, ViewSelectRuleName);
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("view rule for \"%s\" must be named \"%s\"",
+ event_obj->relname, ViewSelectRuleName)));
stmt->rulename = pstrdup(ViewSelectRuleName);
}
scanDesc = heap_beginscan(event_relation, SnapshotNow, 0, NULL);
if (heap_getnext(scanDesc, ForwardScanDirection) != NULL)
- elog(ERROR, "Relation \"%s\" is not empty. Cannot convert it to view",
- event_obj->relname);
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("cannot convert non-empty table \"%s\" to a view",
+ event_obj->relname)));
heap_endscan(scanDesc);
RelisBecomingView = true;
PointerGetDatum(oldName),
0, 0);
if (!HeapTupleIsValid(ruletup))
- elog(ERROR, "RenameRewriteRule: rule \"%s\" does not exist", oldName);
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("rule \"%s\" for relation \"%s\" does not exist",
+ oldName, get_rel_name(owningRel))));
/* should not already exist */
if (IsDefinedRewriteRule(owningRel, newName))
- elog(ERROR, "Attempt to rename rule \"%s\" failed: \"%s\" already exists",
- oldName, newName);
+ ereport(ERROR,
+ (errcode(ERRCODE_DUPLICATE_OBJECT),
+ errmsg("rule \"%s\" for relation \"%s\" already exists",
+ newName, get_rel_name(owningRel))));
namestrcpy(&(((Form_pg_rewrite) GETSTRUCT(ruletup))->rulename), newName);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.123 2003/07/16 17:25:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.124 2003/07/25 00:01:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* member statements of the setop?)
*/
if (sub_action->setOperations != NULL)
- elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
sub_action->jointree->fromlist =
nconc(newjointree, sub_action->jointree->fromlist);
{
/* Let's just make sure we processed all the non-junk items */
if (resdom->resno < 1 || resdom->resno > numattrs)
- elog(ERROR, "rewriteTargetList: bogus resno %d in targetlist",
- resdom->resno);
+ elog(ERROR, "bogus resno %d in targetlist", resdom->resno);
}
}
((ArrayRef *) prior_tle->expr)->refassgnexpr == NULL ||
((ArrayRef *) src_tle->expr)->refrestype !=
((ArrayRef *) prior_tle->expr)->refrestype)
- elog(ERROR, "Multiple assignments to same attribute \"%s\"",
- resdom->resname);
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("multiple assignments to same attribute \"%s\"",
+ resdom->resname)));
/*
* Prior TLE could be a nest of ArrayRefs if we do this more than
((ArrayRef *) priorbottom)->refassgnexpr != NULL)
priorbottom = (Node *) ((ArrayRef *) priorbottom)->refexpr;
if (!equal(priorbottom, ((ArrayRef *) src_tle->expr)->refexpr))
- elog(ERROR, "Multiple assignments to same attribute \"%s\"",
- resdom->resname);
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("multiple assignments to same attribute \"%s\"",
+ resdom->resname)));
/*
* Looks OK to nest 'em.
* type when it was created ...
*/
if (expr == NULL)
- elog(ERROR, "Column \"%s\" is of type %s"
- " but default expression is of type %s"
- "\n\tYou will need to rewrite or cast the expression",
- NameStr(att_tup->attname),
- format_type_be(atttype),
- format_type_be(exprtype));
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("column \"%s\" is of type %s"
+ " but default expression is of type %s",
+ NameStr(att_tup->attname),
+ format_type_be(atttype),
+ format_type_be(exprtype)),
+ errhint("You will need to rewrite or cast the expression.")));
return expr;
}
*subrte;
if (length(rule->actions) != 1)
- elog(ERROR, "ApplyRetrieveRule: expected just one rule action");
+ elog(ERROR, "expected just one rule action");
if (rule->qual != NULL)
- elog(ERROR, "ApplyRetrieveRule: can't handle qualified ON SELECT rule");
+ elog(ERROR, "cannot handle qualified ON SELECT rule");
if (!relation_level)
- elog(ERROR, "ApplyRetrieveRule: can't handle per-attribute ON SELECT rule");
+ elog(ERROR, "cannot handle per-attribute ON SELECT rule");
/*
* Make a modifiable copy of the view query, and recursively expand
List *l;
if (oidMember(RelationGetRelid(rel), activeRIRs))
- elog(ERROR, "Infinite recursion detected in rules for relation %s",
- RelationGetRelationName(rel));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("infinite recursion detected in rules for relation \"%s\"",
+ RelationGetRelationName(rel))));
newActiveRIRs = lconso(RelationGetRelid(rel), activeRIRs);
foreach(l, locks)
parsetree->hasAggs = checkExprHasAggs((Node *) parsetree);
if (parsetree->hasAggs)
if (checkExprHasAggs((Node *) parsetree->jointree))
- elog(ERROR, "fireRIRrules: failed to remove aggs from qual");
+ elog(ERROR, "failed to remove aggregates from qual");
}
if (parsetree->hasSubLinks)
parsetree->hasSubLinks = checkExprHasSubLink((Node *) parsetree);
rev = (rewrite_event *) lfirst(n);
if (rev->relation == RelationGetRelid(rt_entry_relation) &&
rev->event == event)
- elog(ERROR, "Infinite recursion detected in rules for relation %s",
- RelationGetRelationName(rt_entry_relation));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("infinite recursion detected in rules for relation \"%s\"",
+ RelationGetRelationName(rt_entry_relation))));
}
rev = (rewrite_event *) palloc(sizeof(rewrite_event));
switch (query->commandType)
{
case CMD_INSERT:
- elog(ERROR, "Cannot insert into a view"
- "\n\tYou need an unconditional ON INSERT DO INSTEAD rule");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot insert into a view"),
+ errhint("You need an unconditional ON INSERT DO INSTEAD rule.")));
break;
case CMD_UPDATE:
- elog(ERROR, "Cannot update a view"
- "\n\tYou need an unconditional ON UPDATE DO INSTEAD rule");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot update a view"),
+ errhint("You need an unconditional ON UPDATE DO INSTEAD rule.")));
break;
case CMD_DELETE:
- elog(ERROR, "Cannot delete from a view"
- "\n\tYou need an unconditional ON DELETE DO INSTEAD rule");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot delete from a view"),
+ errhint("You need an unconditional ON DELETE DO INSTEAD rule.")));
break;
default:
- elog(ERROR, "QueryRewrite: unexpected commandType %d",
+ elog(ERROR, "unrecognized commandType: %d",
(int) query->commandType);
break;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.73 2003/07/16 17:25:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.74 2003/07/25 00:01:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return parsetree;
Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr));
if (length(parsetree->jointree->fromlist) != 1)
- elog(ERROR, "getInsertSelectQuery: expected to find SELECT subquery");
+ elog(ERROR, "expected to find SELECT subquery");
rtr = (RangeTblRef *) lfirst(parsetree->jointree->fromlist);
Assert(IsA(rtr, RangeTblRef));
selectrte = rt_fetch(rtr->rtindex, parsetree->rtable);
selectquery = selectrte->subquery;
if (!(selectquery && IsA(selectquery, Query) &&
selectquery->commandType == CMD_SELECT))
- elog(ERROR, "getInsertSelectQuery: expected to find SELECT subquery");
+ elog(ERROR, "expected to find SELECT subquery");
if (length(selectquery->rtable) >= 2 &&
strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
"*OLD*") == 0 &&
*subquery_ptr = &(selectrte->subquery);
return selectquery;
}
- elog(ERROR, "getInsertSelectQuery: can't find rule placeholders");
+ elog(ERROR, "could not find rule placeholders");
return NULL; /* not reached */
}
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
return;
else
- elog(ERROR, "Conditional utility statements are not implemented");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("conditional utility statements are not implemented")));
}
if (parsetree->setOperations != NULL)
* (This could be fixed, but right now the planner simply ignores
* any qual condition on a setop query.)
*/
- elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
}
/* INTERSECT want's the original, but we need to copy - Jan */
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
return;
else
- elog(ERROR, "Conditional utility statements are not implemented");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("conditional utility statements are not implemented")));
}
if (parsetree->setOperations != NULL)
* (This could be fixed, but right now the planner simply ignores
* any qual condition on a setop query.)
*/
- elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
}
/* INTERSECT want's the original, but we need to copy - Jan */
/* band-aid: don't do the wrong thing with a whole-tuple Var */
if (var->varattno == InvalidAttrNumber)
- elog(ERROR, "ResolveNew: can't handle whole-tuple reference");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot handle whole-tuple reference")));
n = FindMatchingNew(context->targetlist, var->varattno);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.53 2002/09/04 20:31:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.54 2003/07/25 00:01:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* complain if no rule with such name exists
*/
if (!HeapTupleIsValid(tuple))
- elog(ERROR, "Rule \"%s\" not found", ruleName);
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("rule \"%s\" for relation \"%s\" does not exist",
+ ruleName, get_rel_name(owningRel))));
/*
* Verify user has appropriate permissions.
tuple = systable_getnext(rcscan);
if (!HeapTupleIsValid(tuple))
- elog(ERROR, "RemoveRewriteRuleById: Rule %u does not exist",
- ruleOid);
+ elog(ERROR, "could not find tuple for rule %u", ruleOid);
/*
* We had better grab AccessExclusiveLock so that we know no other
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.54 2002/08/05 03:29:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.55 2003/07/25 00:01:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ObjectIdGetDatum(relationId),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
- elog(ERROR, "SetRelationRuleStatus: cache lookup failed for relation %u", relationId);
+ elog(ERROR, "cache lookup failed for relation %u", relationId);
classForm = (Form_pg_class) GETSTRUCT(tuple);
if (classForm->relhasrules != relHasRules ||