Allow user to specify column types

This revises the work started by @adrianlzt.

While pulling in his changes, I've cleaned up our existing code a very little bit to make some of macros calls a little less overwhelming.

This is a non-trivial code change to an important system, so let's make sure we don't merge it prematurely.