How Does Postgresql Implement Upsert To Automatically

How Does Postgresql Implement Upsert To Automatically