On Thu, Jun 01, 2006 at 03:33:50PM +0300, Tzahi Fadida wrote:
> The question is, can the CTID field change throughout
> the run of my function due to some other processes working
> on the relation? Or because of command boundaries it is
> pretty much secured inside an implicit transaction?
> The problem wasn't so great if I didn't want to exploit
> indices in the relations (but I do and does), since
> after you issue a SELECT that uses indices, all you can rely on
> is the CTID to uniquely identify a tuple.
The CTID is the location on disk of the tuple, so no, it doesn't change
while you are running.
However, if you're running in isolation mode "read committed", then
someone else could update the tuple while you're looking at it. In this
case the tuple will appear to vanish and the updated version will
appear elsewhere with a new CTID. Whether this is a problem or not
depends on what you're using it for.
Hope this helps,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.