Skip to content

Commit 45708f5

Browse files
committed
Error message editing in backend/optimizer, backend/rewrite.
1 parent cfa191f commit 45708f5

29 files changed

+325
-246
lines changed

src/backend/optimizer/geqo/geqo_erx.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* geqo_erx.c
44
* edge recombination crossover [ER]
55
*
6-
* $Id: geqo_erx.c,v 1.17 2002/03/02 21:39:26 momjian Exp $
6+
* $Id: geqo_erx.c,v 1.18 2003/07/25 00:01:06 tgl Exp $
77
*
88
*-------------------------------------------------------------------------
99
*/
@@ -333,7 +333,7 @@ gimme_gene(Edge edge, Edge *edge_table)
333333
minimum_count = 1;
334334
}
335335
else if (minimum_count == -1)
336-
elog(ERROR, "gimme_gene: Internal error - minimum_count not set");
336+
elog(ERROR, "minimum_count not set");
337337
else if (edge_table[(int) friend].unused_edges == minimum_edges)
338338
minimum_count++;
339339

@@ -359,7 +359,7 @@ gimme_gene(Edge edge, Edge *edge_table)
359359
}
360360

361361
/* ... should never be reached */
362-
elog(ERROR, "gimme_gene: neither shared nor minimum number nor random edge found");
362+
elog(ERROR, "neither shared nor minimum number nor random edge found");
363363
return 0; /* to keep the compiler quiet */
364364
}
365365

@@ -419,15 +419,11 @@ edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
419419
}
420420
}
421421

422-
elog(LOG, "edge_failure(1): no edge found via random decision and total_edges == 4");
422+
elog(LOG, "no edge found via random decision and total_edges == 4");
423423
}
424-
425-
else
426-
/* random decision of the gene with remaining edges */
427-
428-
if (remaining_edges != 0)
424+
else if (remaining_edges != 0)
429425
{
430-
426+
/* random decision of the gene with remaining edges */
431427
rand_decision = (int) geqo_randint(remaining_edges - 1, 0);
432428

433429
for (i = 1; i <= num_gene; i++)
@@ -444,7 +440,7 @@ edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
444440
}
445441
}
446442

447-
elog(LOG, "edge_failure(2): no edge found via random decision and remainig edges");
443+
elog(LOG, "no edge found via random decision with remaining edges");
448444
}
449445

450446
/*
@@ -462,11 +458,11 @@ edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
462458
if (edge_table[i].unused_edges >= 0)
463459
return (Gene) i;
464460

465-
elog(LOG, "edge_failure(3): no edge found via looking for the last ununsed point");
461+
elog(LOG, "no edge found via looking for the last ununsed point");
466462
}
467463

468464

469-
/* ... should never be reached */
470-
elog(ERROR, "edge_failure: no edge detected");
465+
/* ... should never be reached */
466+
elog(ERROR, "no edge found");
471467
return 0; /* to keep the compiler quiet */
472468
}

src/backend/optimizer/geqo/geqo_eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.62 2003/05/02 20:54:34 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.63 2003/07/25 00:01:06 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -66,7 +66,7 @@ geqo_eval(Query *root, List *initial_rels, Gene *tour, int num_gene)
6666
* Since geqo_eval() will be called many times, we can't afford to let
6767
* all that memory go unreclaimed until end of statement. Note we
6868
* make the temp context a child of the planner's normal context, so that
69-
* it will be freed even if we abort via elog(ERROR).
69+
* it will be freed even if we abort via ereport(ERROR).
7070
*/
7171
mycontext = AllocSetContextCreate(CurrentMemoryContext,
7272
"GEQO",

src/backend/optimizer/geqo/geqo_main.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.35 2003/05/27 17:49:46 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.36 2003/07/25 00:01:06 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -120,30 +120,30 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
120120
daddy = alloc_chromo(pool->string_length);
121121

122122
#if defined (ERX)
123-
elog(DEBUG2, "geqo_main: using edge recombination crossover [ERX]");
123+
elog(DEBUG2, "using edge recombination crossover [ERX]");
124124
/* allocate edge table memory */
125125
edge_table = alloc_edge_table(pool->string_length);
126126
#elif defined(PMX)
127-
elog(DEBUG2, "geqo_main: using partially matched crossover [PMX]");
127+
elog(DEBUG2, "using partially matched crossover [PMX]");
128128
/* allocate chromosome kid memory */
129129
kid = alloc_chromo(pool->string_length);
130130
#elif defined(CX)
131-
elog(DEBUG2, "geqo_main: using cycle crossover [CX]");
131+
elog(DEBUG2, "using cycle crossover [CX]");
132132
/* allocate city table memory */
133133
kid = alloc_chromo(pool->string_length);
134134
city_table = alloc_city_table(pool->string_length);
135135
#elif defined(PX)
136-
elog(DEBUG2, "geqo_main: using position crossover [PX]");
136+
elog(DEBUG2, "using position crossover [PX]");
137137
/* allocate city table memory */
138138
kid = alloc_chromo(pool->string_length);
139139
city_table = alloc_city_table(pool->string_length);
140140
#elif defined(OX1)
141-
elog(DEBUG2, "geqo_main: using order crossover [OX1]");
141+
elog(DEBUG2, "using order crossover [OX1]");
142142
/* allocate city table memory */
143143
kid = alloc_chromo(pool->string_length);
144144
city_table = alloc_city_table(pool->string_length);
145145
#elif defined(OX2)
146-
elog(DEBUG2, "geqo_main: using order crossover [OX2]");
146+
elog(DEBUG2, "using order crossover [OX2]");
147147
/* allocate city table memory */
148148
kid = alloc_chromo(pool->string_length);
149149
city_table = alloc_city_table(pool->string_length);
@@ -211,15 +211,15 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
211211
elog(LOG, "[GEQO] failures: %d, average: %d",
212212
edge_failures, (int) generation / edge_failures);
213213
else
214-
elog(LOG, "[GEQO] No edge failures detected.");
214+
elog(LOG, "[GEQO] no edge failures detected");
215215
#endif
216216

217217

218218
#if defined(CX) && defined(GEQO_DEBUG)
219219
if (mutations != 0)
220220
elog(LOG, "[GEQO] mutations: %d, generations: %d", mutations, generation);
221221
else
222-
elog(LOG, "[GEQO] No mutations processed.");
222+
elog(LOG, "[GEQO] no mutations processed");
223223
#endif
224224

225225

@@ -239,7 +239,7 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
239239
best_tour, pool->string_length);
240240

241241
if (best_rel == NULL)
242-
elog(ERROR, "geqo: failed to make a valid plan");
242+
elog(ERROR, "failed to make a valid plan");
243243

244244
/* DBG: show the query plan */
245245
#ifdef NOT_USED

src/backend/optimizer/geqo/geqo_misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_misc.c,v 1.36 2002/12/16 21:30:29 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_misc.c,v 1.37 2003/07/25 00:01:06 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -38,7 +38,7 @@ avg_pool(Pool *pool)
3838
double cumulative = 0.0;
3939

4040
if (pool->size <= 0)
41-
elog(ERROR, "avg_pool: pool_size of zero");
41+
elog(ERROR, "pool_size is zero");
4242

4343
/*
4444
* Since the pool may contain multiple occurrences of DBL_MAX, divide

src/backend/optimizer/path/allpaths.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.103 2003/06/29 23:05:04 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.104 2003/07/25 00:01:06 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -209,7 +209,9 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
209209
* do better?
210210
*/
211211
if (intMember(parentRTindex, root->rowMarks))
212-
elog(ERROR, "SELECT FOR UPDATE is not supported for inherit queries");
212+
ereport(ERROR,
213+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
214+
errmsg("SELECT FOR UPDATE is not supported for inherit queries")));
213215

214216
/*
215217
* The executor will check the parent table's access permissions when
@@ -642,7 +644,7 @@ recurse_pushdown_safe(Node *setOp, Query *topquery,
642644
}
643645
else
644646
{
645-
elog(ERROR, "recurse_pushdown_safe: unexpected node %d",
647+
elog(ERROR, "unrecognized node type: %d",
646648
(int) nodeTag(setOp));
647649
}
648650
return true;
@@ -839,7 +841,7 @@ recurse_push_qual(Node *setOp, Query *topquery,
839841
}
840842
else
841843
{
842-
elog(ERROR, "recurse_push_qual: unexpected node %d",
844+
elog(ERROR, "unrecognized node type: %d",
843845
(int) nodeTag(setOp));
844846
}
845847
}

src/backend/optimizer/path/costsize.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* Portions Copyright (c) 1994, Regents of the University of California
5050
*
5151
* IDENTIFICATION
52-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.110 2003/07/14 22:35:54 tgl Exp $
52+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.111 2003/07/25 00:01:06 tgl Exp $
5353
*
5454
*-------------------------------------------------------------------------
5555
*/
@@ -1513,7 +1513,7 @@ cost_qual_eval_walker(Node *node, QualCost *total)
15131513
else if (IsA(node, SubLink))
15141514
{
15151515
/* This routine should not be applied to un-planned expressions */
1516-
elog(ERROR, "cost_qual_eval: can't handle unplanned sub-select");
1516+
elog(ERROR, "cannot handle unplanned sub-select");
15171517
}
15181518
else if (IsA(node, SubPlan))
15191519
{
@@ -1805,8 +1805,7 @@ set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
18051805
temp = inner_rel->rows;
18061806
break;
18071807
default:
1808-
elog(ERROR, "set_joinrel_size_estimates: unsupported join type %d",
1809-
(int) jointype);
1808+
elog(ERROR, "unrecognized join type: %d", (int) jointype);
18101809
temp = 0; /* keep compiler quiet */
18111810
break;
18121811
}

src/backend/optimizer/path/indxpath.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.144 2003/06/15 22:51:45 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.145 2003/07/25 00:01:06 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -490,7 +490,7 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
490490
} while (!DoneMatchingIndexKeys(classes));
491491

492492
if (FastListValue(&quals) == NIL)
493-
elog(ERROR, "extract_or_indexqual_conditions: no matching clause");
493+
elog(ERROR, "no matching OR clause");
494494

495495
return FastListValue(&quals);
496496
}
@@ -1245,7 +1245,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
12451245
if (!OidIsValid(test_op))
12461246
{
12471247
/* This should not fail, else pg_amop entry is missing */
1248-
elog(ERROR, "Missing pg_amop entry for opclass %u strategy %d",
1248+
elog(ERROR, "missing pg_amop entry for opclass %u strategy %d",
12491249
opclass_id, test_strategy);
12501250
}
12511251

@@ -1281,7 +1281,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
12811281
if (isNull)
12821282
{
12831283
/* Treat a null result as false ... but it's a tad fishy ... */
1284-
elog(DEBUG2, "pred_test_simple_clause: null test result");
1284+
elog(DEBUG2, "null predicate test result");
12851285
return false;
12861286
}
12871287
return DatumGetBool(test_result);
@@ -2055,7 +2055,8 @@ prefix_quals(Node *leftop, Oid opclass,
20552055
break;
20562056

20572057
default:
2058-
elog(ERROR, "prefix_quals: unexpected opclass %u", opclass);
2058+
/* shouldn't get here */
2059+
elog(ERROR, "unexpected opclass: %u", opclass);
20592060
return NIL;
20602061
}
20612062

@@ -2078,7 +2079,7 @@ prefix_quals(Node *leftop, Oid opclass,
20782079
prefix_const->constvalue));
20792080
break;
20802081
default:
2081-
elog(ERROR, "prefix_quals: unexpected consttype %u",
2082+
elog(ERROR, "unexpected const type: %u",
20822083
prefix_const->consttype);
20832084
return NIL;
20842085
}
@@ -2093,7 +2094,7 @@ prefix_quals(Node *leftop, Oid opclass,
20932094
{
20942095
oproid = get_opclass_member(opclass, BTEqualStrategyNumber);
20952096
if (oproid == InvalidOid)
2096-
elog(ERROR, "prefix_quals: no operator = for opclass %u", opclass);
2097+
elog(ERROR, "no = operator for opclass %u", opclass);
20972098
expr = make_opclause(oproid, BOOLOID, false,
20982099
(Expr *) leftop, (Expr *) prefix_const);
20992100
result = makeList1(expr);
@@ -2107,7 +2108,7 @@ prefix_quals(Node *leftop, Oid opclass,
21072108
*/
21082109
oproid = get_opclass_member(opclass, BTGreaterEqualStrategyNumber);
21092110
if (oproid == InvalidOid)
2110-
elog(ERROR, "prefix_quals: no operator >= for opclass %u", opclass);
2111+
elog(ERROR, "no >= operator for opclass %u", opclass);
21112112
expr = make_opclause(oproid, BOOLOID, false,
21122113
(Expr *) leftop, (Expr *) prefix_const);
21132114
result = makeList1(expr);
@@ -2122,7 +2123,7 @@ prefix_quals(Node *leftop, Oid opclass,
21222123
{
21232124
oproid = get_opclass_member(opclass, BTLessStrategyNumber);
21242125
if (oproid == InvalidOid)
2125-
elog(ERROR, "prefix_quals: no operator < for opclass %u", opclass);
2126+
elog(ERROR, "no < operator for opclass %u", opclass);
21262127
expr = make_opclause(oproid, BOOLOID, false,
21272128
(Expr *) leftop, (Expr *) greaterstr);
21282129
result = lappend(result, expr);
@@ -2167,8 +2168,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
21672168
is_eq = true;
21682169
break;
21692170
default:
2170-
elog(ERROR, "network_prefix_quals: unexpected operator %u",
2171-
expr_op);
2171+
elog(ERROR, "unexpected operator: %u", expr_op);
21722172
return NIL;
21732173
}
21742174

@@ -2180,15 +2180,13 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
21802180
{
21812181
opr1oid = get_opclass_member(opclass, BTGreaterEqualStrategyNumber);
21822182
if (opr1oid == InvalidOid)
2183-
elog(ERROR, "network_prefix_quals: no >= operator for opclass %u",
2184-
opclass);
2183+
elog(ERROR, "no >= operator for opclass %u", opclass);
21852184
}
21862185
else
21872186
{
21882187
opr1oid = get_opclass_member(opclass, BTGreaterStrategyNumber);
21892188
if (opr1oid == InvalidOid)
2190-
elog(ERROR, "network_prefix_quals: no > operator for opclass %u",
2191-
opclass);
2189+
elog(ERROR, "no > operator for opclass %u", opclass);
21922190
}
21932191

21942192
opr1right = network_scan_first(rightop);
@@ -2203,8 +2201,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
22032201

22042202
opr2oid = get_opclass_member(opclass, BTLessEqualStrategyNumber);
22052203
if (opr2oid == InvalidOid)
2206-
elog(ERROR, "network_prefix_quals: no <= operator for opclass %u",
2207-
opclass);
2204+
elog(ERROR, "no <= operator for opclass %u", opclass);
22082205

22092206
opr2right = network_scan_last(rightop);
22102207

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy