Im converting my php app to work with postgresql instead of mysql.
Before I had this function using PDO:
$stmt = $db->prepare("INSERT INTO $table(id,name,info) VALUES(:id,:name,:info) ON DUPLICATE KEY UPDATE name=:name,info=:info");
$stmt->execute(array(':id' => $id, ':name' => $name, :info' => $info));
If the key does not exist it creates a new entry, or else it updates the entry.
How is it possible to do somewhat the same with postgresql?
I have read some articles, but no one is clear on what I have to do. Do I need to write an trigger or rule for this?
Or do I write an check in php if the entry/id exist, and determine if it should update or create new?
Im using postgres 9.1.8