"Jules Alberts" <jules(dot)alberts(at)arbodienst-limburg(dot)nl> writes:> Something like lastval() IMHO is way too risky.
currval() is what you want, and it is *not* risky. Read the sequencedocumentation.
regards, tom lane