One of the SUBSTRING() variants supported by MySQL is:
SUBSTRING(str FROM len)
That looks weird to me. FROM connotes that it should refer to a position,
not a length, as in one of the other variants:
SUBSTRING(str FROM pos FOR len)
But the first variant does indeed seem to treat len as a length and not
a position, returning the rightmost len characters. For example,
SUBSTRING("abcdef" FROM 2) is "ef"
On the other hand, an appendix in the online Postgres docs gives the syntax
like this:
<character substring function> ::=
SUBSTRING <left paren> <character value expression>
FROM <start position>
[ FOR <string length> ] <right paren>
That also implies the value following FROM should be a position, not a length.
How can I resolve this inconsistency?
--
Paul DuBois, paul@stripped