Search Postgresql Archives

Re: Trim not working (PostgreSQL 9.1.2 on Win64)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em 27/07/2012 21:04, Edson Richter escreveu:
I've a select with the following expression:

select trim(both ' ' from substring(rslinha2 from 5 for position('(-)' in rslinha2)-6))
           from ...

problem is that the spaces are not being removed from either side. What would be wrong?

Thanks for your help,

Edson Richter



Ok, sorry for answering my self. I just created an "alltrim" function with the following code:

CREATE OR REPLACE FUNCTION alltrim(text)
  RETURNS text AS
$BODY$
select regexp_replace(regexp_replace($1, '^\s*', ''), '\s*$', '');

$BODY$
  LANGUAGE sql VOLATILE
  COST 100;


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux