pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedDidn't correct output for LTRIM function
3+ messages / 3 participants
[nested] [flat]
* Didn't correct output for LTRIM function
@ 2022-06-13 01:46 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: PG Doc comments form @ 2022-06-13 01:46 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: nikunjkvadsakabcd@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/14/bug-reporting.html
Description:
First check the output of "select LTRIM(' startech academy ', ' sta');"
output is "rtech academy "
now the thing is output of "select LTRIM(' startech academy ', ' star');"
output is "ech academy "
the question is where is 't'?
The problem is when we do LTRIM for trimming the first four characters, it
trims the first five characters. but in the case of doing three characters,
it gives the correct output.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Didn't correct output for LTRIM function
@ 2022-06-13 08:26 Guillaume Lelarge <guillaume@lelarge.info>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Guillaume Lelarge @ 2022-06-13 08:26 UTC (permalink / raw)
To: nikunjkvadsakabcd@gmail.com; pgsql-docs@lists.postgresql.org
Le lun. 13 juin 2022 à 10:06, PG Doc comments form <noreply@postgresql.org>
a écrit :
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/14/bug-reporting.html
> Description:
>
> First check the output of "select LTRIM(' startech academy ', ' sta');"
>
> output is "rtech academy "
> now the thing is output of "select LTRIM(' startech academy ', '
> star');"
> output is "ech academy "
> the question is where is 't'?
>
>
It's trimmed, because you asked t to be removed. It trims every single
character at the beginning of the string till it encounters another
character. The doc example makes it more clear:
ltrim('zzzytest', 'xyz') → test
https://www.postgresql.org/docs/14/functions-string.html
The problem is when we do LTRIM for trimming the first four characters, it
> trims the first five characters. but in the case of doing three characters,
> it gives the correct output.
>
Both outputs are correct actually.
--
Guillaume.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Didn't correct output for LTRIM function
@ 2022-06-13 12:22 nikunj vadsak <nikunjkvadsakabcd@gmail.com>
parent: Guillaume Lelarge <guillaume@lelarge.info>
0 siblings, 0 replies; 3+ messages in thread
From: nikunj vadsak @ 2022-06-13 12:22 UTC (permalink / raw)
To: Guillaume Lelarge <guillaume@lelarge.info>; +Cc: pgsql-docs@lists.postgresql.org
Thank you for the clarification.
On Mon, 13 Jun 2022, 4:27 am Guillaume Lelarge, <guillaume@lelarge.info>
wrote:
> Le lun. 13 juin 2022 à 10:06, PG Doc comments form <noreply@postgresql.org>
> a écrit :
>
>> The following documentation comment has been logged on the website:
>>
>> Page: https://www.postgresql.org/docs/14/bug-reporting.html
>> Description:
>>
>> First check the output of "select LTRIM(' startech academy ', '
>> sta');"
>> output is "rtech academy "
>> now the thing is output of "select LTRIM(' startech academy ', '
>> star');"
>> output is "ech academy "
>> the question is where is 't'?
>>
>>
> It's trimmed, because you asked t to be removed. It trims every single
> character at the beginning of the string till it encounters another
> character. The doc example makes it more clear:
>
> ltrim('zzzytest', 'xyz') → test
>
> https://www.postgresql.org/docs/14/functions-string.html
>
> The problem is when we do LTRIM for trimming the first four characters, it
>> trims the first five characters. but in the case of doing three
>> characters,
>> it gives the correct output.
>>
>
> Both outputs are correct actually.
>
>
> --
> Guillaume.
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-06-13 12:22 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 01:46 Didn't correct output for LTRIM function PG Doc comments form <noreply@postgresql.org>
2022-06-13 08:26 ` Guillaume Lelarge <guillaume@lelarge.info>
2022-06-13 12:22 ` nikunj vadsak <nikunjkvadsakabcd@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox