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

Commitfe415ff

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 parent56b7862 commitfe415ff

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
@@ -534,9 +534,7 @@ statext_dependencies_deserialize(bytea *data)
534534
dependencies->type,STATS_DEPS_TYPE_BASIC);
535535

536536
if (dependencies->ndeps==0)
537-
ereport(ERROR,
538-
(errcode(ERRCODE_DATA_CORRUPTED),
539-
errmsg("invalid zero-length item array in MVDependencies")));
537+
elog(ERROR,"invalid zero-length item array in MVDependencies");
540538

541539
/* what minimum bytea size do we expect for those parameters */
542540
min_expected_size=SizeOfItem(dependencies->ndeps);

‎src/backend/statistics/mvdistinct.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -274,27 +274,19 @@ statext_ndistinct_deserialize(bytea *data)
274274
tmp+=sizeof(uint32);
275275

276276
if (ndist.magic!=STATS_NDISTINCT_MAGIC)
277-
ereport(ERROR,
278-
(errcode(ERRCODE_DATA_CORRUPTED),
279-
errmsg("invalid ndistinct magic %08x (expected %08x)",
280-
ndist.magic,STATS_NDISTINCT_MAGIC)));
277+
elog(ERROR,"invalid ndistinct magic %08x (expected %08x)",
278+
ndist.magic,STATS_NDISTINCT_MAGIC);
281279
if (ndist.type!=STATS_NDISTINCT_TYPE_BASIC)
282-
ereport(ERROR,
283-
(errcode(ERRCODE_DATA_CORRUPTED),
284-
errmsg("invalid ndistinct type %d (expected %d)",
285-
ndist.type,STATS_NDISTINCT_TYPE_BASIC)));
280+
elog(ERROR,"invalid ndistinct type %d (expected %d)",
281+
ndist.type,STATS_NDISTINCT_TYPE_BASIC);
286282
if (ndist.nitems==0)
287-
ereport(ERROR,
288-
(errcode(ERRCODE_DATA_CORRUPTED),
289-
errmsg("invalid zero-length item array in MVNDistinct")));
283+
elog(ERROR,"invalid zero-length item array in MVNDistinct");
290284

291285
/* what minimum bytea size do we expect for those parameters */
292286
minimum_size=MinSizeOfItems(ndist.nitems);
293287
if (VARSIZE_ANY_EXHDR(data)<minimum_size)
294-
ereport(ERROR,
295-
(errcode(ERRCODE_DATA_CORRUPTED),
296-
errmsg("invalid MVNDistinct size %zd (expected at least %zd)",
297-
VARSIZE_ANY_EXHDR(data),minimum_size)));
288+
elog(ERROR,"invalid MVNDistinct size %zd (expected at least %zd)",
289+
VARSIZE_ANY_EXHDR(data),minimum_size);
298290

299291
/*
300292
* Allocate space for the ndistinct items (no space for each item's

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp