Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> writes: > Ken Johanson wrote: >> Just to be sure, will the RETURNING clause work with custom sequences >> (say, non numeric or increment by two) or other types of key >> generators?... And how will triggers interfere with it (if at all)? > As far as I know, RETURNING will give you exactly the values that are > put into the table. RETURNING evaluates the given expression-list over the values that were actually stored. There's no way for a datatype or BEFORE trigger to "fool" it. The only possibly interesting case is if you had an AFTER trigger that proceeded to modify the stored row by issuing an UPDATE ... but that would be a pretty silly/inefficient way to do things, and even then I think that RETURNING is telling the truth as of the time that the tuple insert/update happened. It can't be supposed to be prescient about subsequent changes. regards, tom lane