int4->bool test coverage

From: Christoph Berg <myon(at)debian(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: int4->bool test coverage
Date: 2023-12-21 10:56:22
Message-ID: ZYQZ1hNfLd_4rzkn@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I was surprised to learn that 2 is a valid boolean (thanks Berge):

# select 2::boolean;
bool
──────
t

... while '2' is not:

# select '2'::boolean;
ERROR: 22P02: invalid input syntax for type boolean: "2"
LINE 1: select '2'::boolean;
^
LOCATION: boolin, bool.c:151

The first cast is the int4_bool function, but it isn't covered by the
regression tests at all. The attached patch adds tests.

Christoph

Attachment Content-Type Size
0001-Add-tests-for-int4_bool.patch text/x-diff 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2023-12-21 10:58:19 Re: Add --check option to pgindent
Previous Message Daniel Gustafsson 2023-12-21 10:53:27 Re: ci: Build standalone INSTALL file