Re: BUG #17450: SUBSTRING function extracting lesser characters than specified

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #17450: SUBSTRING function extracting lesser characters than specified
Дата
Msg-id CAKFQuwZ9=nQojnCdk3nVqaPUH1CQGvg2+w_H+U_xp+1vzMoPJQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17450: SUBSTRING function extracting lesser characters than specified  (Pavel Borisov <pashkin.elfe@gmail.com>)
Список pgsql-bugs
On Mon, Mar 28, 2022 at 5:35 AM Pavel Borisov <pashkin.elfe@gmail.com> wrote:
пн, 28 мар. 2022 г. в 15:01, hubert depesz lubaczewski <depesz@depesz.com>:
On Mon, Mar 28, 2022 at 10:30:07AM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      17450
> Logged by:          Suman Ganguly
> Email address:      ganguly.04@gmail.com
> PostgreSQL version: 10.17
> Operating system:   x86_64-pc-linux-gnu
> Description:       
>
> select substring('123456', 0 , 5)
> On running this, Postgres returns '1234'
> Expecting '12345' to be returned as per the documentation

You should reference the documentation you are basing your conclusion off of for this kind of report.

This example in the documentation clearly demonstrates the 1-based nature of the numbering:

substring('Thomas' from 2 for 3) → hom

as does this one:

substr('alphabet', 3, 2) → ph


Oddly, I don't actually see a non-standard form of substring spelled that way though indeed the example works.


Probably it should be backpatched into all versions having 4bd3fad80e5c i.e. since v11.

The behavior of the example command is identical both before and since v11 so I don't see how that commit has anything to do with this.  Nor, as shown above, does this contradict the documentation.  The bug report is simply wrong and you seem to have attempted to supply a fix without confirming it.

David J.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Pavel Borisov
Дата:
Сообщение: Re: BUG #17450: SUBSTRING function extracting lesser characters than specified
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Logical replication stops dropping used initial-sync replication slots