Re: BUG #17664: The subsctring() function with the char() text type does not work correctly

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: snztim(at)yandex(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17664: The subsctring() function with the char() text type does not work correctly
Date: 2022-10-27 12:31:22
Message-ID: CAKFQuwbpJ42W5fX7PYRsmx+3Q+G-e3G5buyMjxUB0r+0av2-qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 27, 2022 at 5:02 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 17664
> Logged by: Evgenii Timofeev
> Email address: snztim(at)yandex(dot)ru
> PostgreSQL version: 15.0
> Operating system: ALT Linux 10 (ALT Sisyphus 10.3.1)
> Description:
>
> Hi!
>
> If we do the same, but add the substring() function to concat(), the result
> will be incorrect (example 2).
> As seen in example 2, the function substring(), which should have printed 4
> characters, has printed only 3.
>
> Please tell me why the result is not correct?
>

Because substring only works for text inputs and produces text output so
your insignificant whitespace is thrown away if you pass data through that
function.

It isn't a bug but a missing feature. Given that the project basically
doesn't recommend people use char this gap in functionality isn't
surprising.

David J.

Note that concat is defined polymorphically.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-10-27 12:43:45 BUG #17667: to_char is used to collect statistics by week
Previous Message PG Bug reporting form 2022-10-27 11:37:20 BUG #17666: Unexpected shutdown