Re: remove upsert example from docs

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: remove upsert example from docs
Дата
Msg-id d1d46489bdf788499ce8d6d0f3314d60@biglumber.com
обсуждение исходный текст
Ответ на remove upsert example from docs  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Attached is a patch to remove the upsert example from the pl/pgsql
> documentation.  It has a serious bug (see:
> http://www.spinics.net/lists/pgsql/msg112560.html) which is nontrivial
> to fix.  IMNSHO, our code examples should encourage good practices and
> style.

No, removing is a bad idea, as it's referenced from here to the North 
Pole and back. Better would simply be a warning about the non uniqueness 
of the unique constraint message.

> The 'correct' way to do race free upsert is to take a table lock first
> -- you don't have to loop or open a subtransaction.  A high
> concurrency version is nice but is more of a special case solution (it
> looks like concurrent MERGE might render the issue moot anyways).

I think anything doing table locks should be the "special case solution" 
as production systems generally avoid full table locks like the plague.
The existing solution works fine as long as we explain that caveat (which 
is a little bit of a corner case, else we'd have heard more complaints 
before now).

- -- 
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201008051402
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkxa/XgACgkQvJuQZxSWSsjTbACfcjrsBVXCOGUb6foARfNIztSo
AswAn0bNttP8XOs/2tw6jFsSa0cZkq7e
=HUcq
-----END PGP SIGNATURE-----




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Mike Lewis
Дата:
Сообщение: Re: Performance Enhancement/Fix for Array Utility Functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: remove upsert example from docs