implement secondary index extraction and checking

we'll need to know about unique keys to correctly upsert data with reused unique keys, so go ahead and implement basic support for both unique and non-unique keys now.  index options like collation, partial index support, expression indexes etc. is not implemented yet.