Move _R to the db module.
Add 'prototype' arg to extend.

It turns out that there are very good reasons to want to be able to
extend an empty relation.  This came up specifically in dealing with the
missing values problem (Missing-info-without-nulls.pdf), where there
might not be any missing values, but you still want to extend that table
when composing a view containing a column depicting both the real values
and the missing values.
Add some type guessing to extend.

I thought of a clever trick that will cover 80% or more of the cases
of extending empty relations: construct a dummy row by calling the type
functions with no arguments.  It might be worth adding this as
a further requirement on dinsd type functions.  The downside is that
it means you don't get type checking for null input values, so I'm not
going that route yet.