elog: clarify usage and style of error reporting functions

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: elog: clarify usage and style of error reporting functions
Date: 2026-03-17 03:16:13
Message-ID: 39976911-5A4B-4C52-844B-6FF397CECC8F@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

This came up while reviewing a patch [1], where Tom pointed out the difference between elog() and ereport() and referenced the corresponding documentation [2]. While doing patch reviews, I have also noticed many inconsistencies in the style of detail and hint messages. Even in the current code base, these inconsistencies are quite common. The PostgreSQL documentation [3] already provides guidelines for writing such messages.

For these logging functions, developers are more likely to read the function header comments than the external documentation, so it seems useful to include brief guidelines directly in the code.

This patch adds short style guidelines to the relevant logging functions.

[1] https://postgr.es/m/297458.1772811905@sss.pgh.pa.us
[2] https://www.postgresql.org/docs/devel/error-message-reporting.html
[3] https://www.postgresql.org/docs/current/error-style-guide.html

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v1-0001-elog-document-style-guidelines-for-error-message-.patch application/octet-stream 3.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-03-17 03:16:38 Re: Skipping schema changes in publication
Previous Message Hayato Kuroda (Fujitsu) 2026-03-17 02:56:13 RE: POC: make mxidoff 64 bits