SQL-related tests updates. Fixes #202. Fixes #203.