Issue #2549323 by amateescu, mradcliffe, Damien Tournoud: Improve the Upsert query implementation for PostgreSQL