Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9c9a74c

Browse files
committed
Make error logging in extended statistics more consistent
Most errors reported in extended statistics are internal issues, and soshould use elog(). The MCV list code was already following this rule, butthe functional dependencies and ndistinct coefficients were using a mixof elog() and ereport(). Fix this by changing most places to elog(), withthe exception of input functions.This is a mostly cosmetic change, it makes the life a little bit easierfor translators, as elog() messages are not translated. So backpatch toPostgreSQL 10, where extended statistics were introduced.Author: Tomas VondraBackpatch-through: 10 where extended statistics were addedDiscussion:https://postgr.es/m/20190503154404.GA7478@alvherre.pgsql
1 parent88a0e3d commit9c9a74c

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

‎src/backend/statistics/dependencies.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,7 @@ statext_dependencies_deserialize(bytea *data)
529529
dependencies->type,STATS_DEPS_TYPE_BASIC);
530530

531531
if (dependencies->ndeps==0)
532-
ereport(ERROR,
533-
(errcode(ERRCODE_DATA_CORRUPTED),
534-
errmsg("invalid zero-length item array in MVDependencies")));
532+
elog(ERROR,"invalid zero-length item array in MVDependencies");
535533

536534
/* what minimum bytea size do we expect for those parameters */
537535
min_expected_size=SizeOfDependencies+

‎src/backend/statistics/mvdistinct.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,29 +257,21 @@ statext_ndistinct_deserialize(bytea *data)
257257
tmp+=sizeof(uint32);
258258

259259
if (ndist.magic!=STATS_NDISTINCT_MAGIC)
260-
ereport(ERROR,
261-
(errcode(ERRCODE_DATA_CORRUPTED),
262-
errmsg("invalid ndistinct magic %08x (expected %08x)",
263-
ndist.magic,STATS_NDISTINCT_MAGIC)));
260+
elog(ERROR,"invalid ndistinct magic %08x (expected %08x)",
261+
ndist.magic,STATS_NDISTINCT_MAGIC);
264262
if (ndist.type!=STATS_NDISTINCT_TYPE_BASIC)
265-
ereport(ERROR,
266-
(errcode(ERRCODE_DATA_CORRUPTED),
267-
errmsg("invalid ndistinct type %d (expected %d)",
268-
ndist.type,STATS_NDISTINCT_TYPE_BASIC)));
263+
elog(ERROR,"invalid ndistinct type %d (expected %d)",
264+
ndist.type,STATS_NDISTINCT_TYPE_BASIC);
269265
if (ndist.nitems==0)
270-
ereport(ERROR,
271-
(errcode(ERRCODE_DATA_CORRUPTED),
272-
errmsg("invalid zero-length item array in MVNDistinct")));
266+
elog(ERROR,"invalid zero-length item array in MVNDistinct");
273267

274268
/* what minimum bytea size do we expect for those parameters */
275269
minimum_size= (SizeOfMVNDistinct+
276270
ndist.nitems* (SizeOfMVNDistinctItem+
277271
sizeof(AttrNumber)*2));
278272
if (VARSIZE_ANY_EXHDR(data)<minimum_size)
279-
ereport(ERROR,
280-
(errcode(ERRCODE_DATA_CORRUPTED),
281-
errmsg("invalid MVNDistinct size %zd (expected at least %zd)",
282-
VARSIZE_ANY_EXHDR(data),minimum_size)));
273+
elog(ERROR,"invalid MVNDistinct size %zd (expected at least %zd)",
274+
VARSIZE_ANY_EXHDR(data),minimum_size);
283275

284276
/*
285277
* Allocate space for the ndistinct items (no space for each item's

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp