On Sat, Feb 24, 2007 at 12:18:10PM +0100, John Parnefjord wrote:
> is obviosouly not a good solution. I've not told the application to
> access this sequence in any way and it worked fine until I
> installed and turned on slony. The sql statement that reports the
> error is the only piece where lastval is used.
I think you got lucky, is all. It was never safe to do that. Slony
happened to be the application that tickled it, but you could as
easily have done it with some stored procedure, for instance.
> Just for the sake of clarity, its recommended to use currval()
> instead of lastval(). Or are there an other methods that I should
> consider to find out the last inserted id?
The right way is currval() on the sequence you want to know the value
of. In case you're worried about it, no, there is no race condition
on currval(). See the docs for more information.
A
--
Andrew Sullivan | [EMAIL PROTECTED]
I remember when computers were frustrating because they *did* exactly what
you told them to. That actually seems sort of quaint now.
--J.D. Baldwin
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general