REF: made db_common templated with postgres as a special case