Make merge_tables api more flexible

Allow the `target` argument to be either a string or wrapped table
and allow the `tables` sequence to have table names (strings) or
wrapped table instances (can be a mixture of both).