Philip Warner wrote:
>
> The usual way around this sort of problem is to update the counter as the
> first thing you do in any transaction. This locks the row and prevents any
> possible deadlock:
But if there was no record then nothing will be locked...
Without ability to read dirty data LOCK is the only way.
...
> diagnostics' is not yet applied (I may not have mailed it yet...), and I am
> not sure if plpgsql starts a new TX for each statment - if so, you need to
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It doesn't.
> start a TX in the procedure, or prior to valling it.
Vadim