Incorrect use of errcode_for_file_access in backend code

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Incorrect use of errcode_for_file_access in backend code
Date: 2018-09-02 20:07:47
Message-ID: 20180902200747.GC1343@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

While looking at another patch for slot.c, I have noticed what looks
like incorrect use of errcode_for_file_access:
- errcode_for_file_access() is used with rmtree(), which makes no sense
as this comes from common/rmtree.c, and a warning already shows up using
%m.
- ERRCODE_DATA_CORRUPTED is not used to mention corrupted data, and
instead errcode_for_file_access() gets called.

Wouldn't something like the attached provide more adapted error
handling? That's mostly error handling beautification, so I would be
incline to just fix HEAD.

(I have noticed some inconsistent error string format in autoprewarm.c
on the way.)

Thoughts?
--
Michael

Attachment Content-Type Size
slot-errors.patch text/x-diff 3.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-09-02 20:32:32 Re: Stored procedures and out parameters
Previous Message Michael Paquier 2018-09-02 19:44:31 Re: Bug in slot.c and are replication slots ever used at Window?