(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_pages.ml,v 1.11 2006/08/17 09:11:31 rich Exp $
+ * $Id: cocanwiki_pages.ml,v 1.12 2006/12/07 15:46:54 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
page_emails_url_cn, links_from_cn, recently_visited_url_cn
deferred";
- (* Mark the old page as deleted. NB. There is a small race
- * condition here because PostgreSQL doesn't do isolation
- * properly. If a user tries to visit this page between the
- * delete and the creation of the new page, then they'll get
- * a page not found error. (XXX)
+ (* Lock the pages table to avoid bogus 404 errors. The
+ * lock is released at the end of the current transaction.
*)
+ PGSQL(dbh) "lock table pages";
+
+ (* Mark the old page as deleted. *)
PGSQL(dbh) "update pages set url_deleted = url, url = null
where hostid = $hostid and id = $model_id";