Re: A doubt about a newly added errdetail

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: A doubt about a newly added errdetail
Date: 2022-09-27 12:42:49
Message-ID: 20220927124249.4zdzzlz6had7k3x2@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While reading this code, I noticed that function expr_allowed_in_node()
has a very strange API: it doesn't have any return convention at all
other than "if we didn't modify errdetail_str then all is good". I was
tempted to add an "Assert(*errdetail_msg == NULL)" at the start of it,
just to make sure that it is not called if a message is already set.

I think it would be much saner to inline the few lines of that function
in its sole caller, as in the attached.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"E pur si muove" (Galileo Galilei)

Attachment Content-Type Size
expr_allowed_in_node.patch text/x-diff 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-09-27 13:16:44 Re: [RFC] building postgres with meson - v13
Previous Message Aleksander Alekseev 2022-09-27 12:34:48 Re: Adding a clang-format file