Issue #2990118 by amateescu: Optimize 'initial' and 'initial_from_field' handling in MySQL and PostgreSQL (cherry picked from commit bc328489)