> On 26 Dec 2016, at 10:36, nte(at)mustinformatique(dot)fr wrote:
>
> Not sure if a bug or if I'm missing something but this query produces weird
> results with TRIM and TRIM:
> SELECT DISTINCT TRIM(TRAILING FROM 'cnam_lpp_histo_io','_io')
The devil is in the details. Trim won't remove the string "_io", it'll trim off the characters "_", "i" and "o". And with that logic, the "o" at the end of "histo" is correctly removed as well.
IOW, works as intended and advertised.
Doc here:
https://www.postgresql.org/docs/current/static/functions-string.html
Terje