Re: Bitwise OR instead of logical one in test_aio.c

From: Mikhail Gribkov <youzhick(at)gmail(dot)com>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Bitwise OR instead of logical one in test_aio.c
Date: 2026-11-26 07:53:27
Message-ID: CAMEv5_vcS5xP3o3fgzy35xpNky68fTRfvjfyCc6EgTwcdXDybA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> AI found another one in FuncnameGetCandidates() in namespace.c:
>
> Assert(nargs >= 0 || !(expand_variadic | expand_defaults));
>
> I think they belong to the same category and could be addressed together.

Whoa, this one is 18 years old!

Yes, I agree these should be addressed together. Neither issue is truly
problematic, but cleaning up the code would be nice.
Attached is the V2-patch fixing both places.

--
best regards,
Mikhail A. Gribkov

On Thu, Nov 26, 2026 at 4:39 AM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:

> Hi Mikhail,
>
> On Thu, Nov 26, 2026 at 5:02 AM Mikhail Gribkov <youzhick(at)gmail(dot)com>
> wrote:
> >
> > Hi hackers,
> >
> > I've noticed an odd check in test_aio.c:
> > if (zero_on_error | zero_damaged_pages)
> > srb_flags |= READ_BUFFERS_ZERO_ON_ERROR;
> >
> > Both zero_on_error and zero_damaged_pages declared as bool. Shouldn't
> there be a logical "||" inside the if-condition, not a bitwise "|"?
> > Yes, it works now, but fixing it would be cleaner.
> >
> > Proposed patch is attached (although it's quite trivial).
>
> AI found another one in FuncnameGetCandidates() in namespace.c:
>
> Assert(nargs >= 0 || !(expand_variadic | expand_defaults));
>
> I think they belong to the same category and could be addressed together.
>
> --
> Regards,
> Xuneng Zhou
> HighGo Software Co., Ltd.
>

Attachment Content-Type Size
001_Fix_bitwise_operation_on_bools_v2.patch application/octet-stream 1.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-11-26 08:06:51 Re: Bitwise OR instead of logical one in test_aio.c
Previous Message Zhijie Hou 2026-11-26 07:51:10 Re: Proposal: Conflict log history table for Logical Replication