ltrim function

Serdar Başyiğit <[email protected]> Fri, 13 Dec 2019 02:15:33 +0300
Newsgroups gmane.comp.db.postgresql.bugs
Message-ID <[email protected]>
Hello,

I use Postgres with version PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (Debian 7.3.0-5) 7.3.0, 64-bit;

select ltrim('TRYTND', 'TRY’); — result is ND but I expected TND

select ltrim('TRYUSD', 'TRY’); — result is USD it is same what I expect

I need to change with;

select substring('TRYTND', length('TRY')+1, length('TRYTND')); — TND

select substring('TRYUSD', length('TRY')+1, length('TRYUSD')); — USD

Is there some thing that I misunderstood?

I thing it does not look for all of second parameters and works recursive.

select ltrim('TRYTND', 'TRY’);

1. TRYTND TRY

2. TND TRY — recursive

3. ND TRY — it only found first character of second parameter(T) into first parameter and removed it on first parameter.

Thanks,