SQL: fix target_metadata call