| From: | Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com> | 
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Missing errcode() in ereport | 
| Date: | 2020-03-17 08:37:51 | 
| Message-ID: | CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
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.
Regards,
-- 
Masahiko Sawada            http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
| Attachment | Content-Type | Size | 
|---|---|---|
| add_errcode.patch | application/octet-stream | 1.5 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2020-03-17 08:59:47 | Re: Missing errcode() in ereport | 
| Previous Message | Etsuro Fujita | 2020-03-17 08:14:39 | Re: [HACKERS] advanced partition matching algorithm for partition-wise join |