> > Can you tell me trim() spec, please ? (This problem has been
> > discussed in pgsql-jp ML. )
> > In trim(trailing 'abc' from '123cbabc') function, 'abc' means
> > ~'[abc]'.
> > If trim(trailing 'abc' from '123cbabc') returns "123cb", current
> > trim() spec is broken. However, the spec that 'abc' means ~'[abc]'
> > is ugly. It seems that this ugly spec isn't used for any kind of
> > functions argument and SQL expression except for trim().
> > How do you think about the trim() spec ?
> 
> afaict, the SQL92 spec for trim() requires a single character as the
> first argument; allowing a character string is a Postgres extension. 
> On the surface, istm that this extension is in the spirit of the SQL92
> spec, in that it allows trimming several possible characters.
> 
> I'm not sure if SQL3/SQL99 has anything extra to say on this.
> 
> position() and substring() seem to be able to do what you want;
> 
>  select substring('123ab' for position('ab' in '123ab')-1);
> 
> gives '123', while
> 
>  select substring('123ab' for position('d' in '123ab')-1);
> 
> gives '123ab', which seems to be the behavior you might be suggesting
> for trim().
> 
>                         - Tom

Tue, 13 Jun 2000 13:32:21 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: trim() spec