fix lost $sql_extra in recent sql query changes