If you make Substring a `JdbcFunction` you may be able to simply leave of these two cases above..