I was lately writing some program for a client of mine, which used UPC codes matching.
Since the codes are given in various ways, there was decision to pad the codes with leading zeros – up to 12 characters.
The code has been done, and worked like this:
# select lpad('123456789', 12, '0');
Continue reading lpad() and rpad() gotcha
SoftNum asked on irc:
< SoftNum> does postgresql have a config option to automatically trim (both ' ' from blah) on string compares?
So, can you?
Of course there is no such option, but maybe there is a way to tell PostgreSQL to do this trim for given field? Sure there is 🙂
Continue reading Text comparisons that does automatic trim()