On Wednesday 8. August 2007 15:12, Alban Hertroys wrote: >You should probably use a trigger (a before one maybe) instead of a > rule. I tried that too, but I'm still quite shaky on how to write triggers, and the same thing happened there: the inserted record was immediately deleted. I solved the problem temporarily with two lines in PHP: function set_last_selected_place($place) { pg_query("DELETE FROM recent_places WHERE place_fk = $place"); pg_query("INSERT INTO recent_places (place_fk) VALUES ($place)"); } As my application is single-user, and everything is already wrapped up in a transaction anyway, there's no real problem with this. But I'd still like to understand how to do it 'properly' inside the DB. -- Leif Biberg Kristensen | Registered Linux User #338009 http://solumslekt.org/ | Cruising with Gentoo/KDE My Jazz Jukebox: http://www.last.fm/user/leifbk/ ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/