Em 28/07/2012 19:41, Tom Lane escreveu:
Edson Richter <edsonrichter@xxxxxxxxxxx> writes:If I do apply trim over the substring, no spaces are removed, and I cannot understand why. ... But using the regular expression matching "^\s*" and "\s*$" works, and spaces are removed:I think what this means is that what you say are runs of spaces are no such thing, but are some other whitespace character(s). Perhaps tabs, or non-breaking spaces? regards, tom lane
By all means, you are right. I supposed they are spaces... at least in the original CVS file. I've used an Hex editor, and they are character C2A0 (UTF-8) in the file. Now, executing the following query surprises me: select rslinha2, ascii(substring(rslinha2 from 3 for position('(+)' in rslinha2)-4)) from plan_maio limit 1 resulted in the following: "2. TAXA VIGILANCIA (+) R$ 13,00";160 So, file_fdw converted my original spaces into character 160. That's the reason for trim not working.Thanks for your toughs. You led me to the right direction: when importing data from files, not always what looks like is what it is.
Regards, Edson Richter. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[Postgresql Jobs] [Postgresql Admin] [Postgresql Performance] [Linux Clusters] [PHP Home] [PHP on Windows] [Programming PHP] [Kernel Newbies] [PHP Classes] [Find Someone Nice] [PHP Books] [PHP Databases] [Postgresql & PHP] [Yosemite]