[#542] Remove usage of postgres' function that's not available in < 9.1

The function left() was only added in Postgres 9.1, but we can easily use
substr() to achieve the same effect.

Fixes #542.
Merge pull request #561 from vitorbaptista/542-postgres-lt9.1-has-no-left

[#542] Remove usage of postgres' function that's not available in < 9.1