Re: Missing errcode() in ereport
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-03-17T08:59:47Z
Lists: pgsql-hackers
On Tue, Mar 17, 2020 at 2:08 PM Masahiko Sawada
<masahiko.sawada@2ndquadrant.com> wrote:
>
> Hi,
>
> In PageIsVerified() we report a WARNING as follows:
>
> ereport(WARNING,
> (ERRCODE_DATA_CORRUPTED,
> errmsg("page verification failed, calculated checksum
> %u but expected %u",
> checksum, p->pd_checksum)));
>
> However the error message won't have sql error code due to missing
> errcode(). As far as I can see there are four places:
>
> $ git grep "(ERRCODE" | grep -v errcode
> contrib/adminpack/adminpack.c:
> (ERRCODE_DUPLICATE_FILE,
> contrib/adminpack/adminpack.c: (ERRCODE_DUPLICATE_FILE,
> contrib/adminpack/adminpack.c:
> (ERRCODE_UNDEFINED_FILE,
> src/backend/storage/page/bufpage.c:
> (ERRCODE_DATA_CORRUPTED,
> src/pl/plpgsql/src/pl_exec.c: else if
> (ERRCODE_IS_CATEGORY(sqlerrstate) &&
>
> Attached patch add errcode() to these places.
>
+1. This looks like an oversight to me.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Commits
-
Go back to returning int from ereport auxiliary functions.
- bda6dedbea59 13.0 landed
-
Improve the internal implementation of ereport().
- 17a28b03645e 13.0 landed
-
Re-implement the ereport() macro using __VA_ARGS__.
- e3a87b4991cc 13.0 landed
- a86715451653 12.3 landed
-
Add missing errcode() in a few ereport calls.
- 6bdfe428d399 9.5.22 landed
- fe27ce1c136d 9.6.18 landed
- 569f9354bb43 10.13 landed
- 18c41cb6b714 11.8 landed
- e37824136f06 12.3 landed
- b4f140869f5d 13.0 landed