Tom Lane wrote:

A final point is that implementing CREATE DATABASE via "cp -r" is and
always has been fundamentally broken anyway, because of the lack of
interlocking against other backends changing the source database.
We have a very half-baked defense against that (erroring out if anyone
else is connected to the source DB at the start of the copy) which
I would dearly love to get rid of.



It struck me this morning that we could strengthen that defense considerable with the addition of some checks after the copy on the mtimes of the copied files. The additional code could be quite small and fast.


Longer term, a robust mechanism for DB level locks would probably be preferable, I guess, so I'm not sure if my idea is worth doing in the mean time. Presumably it hasn't caused much of a problem up to now, since most people are not likely to monkey with their template dbs at the same time as trying to create dbs based on them.

cheers

andrew


---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend

Reply via email to