=?utf-8?Q?Andr=C3=A9_H=C3=A4nsel?= <andre@xxxxxxxx> writes: > This will yield “8”, showing that new sequence numbers have been generated for each attempt. Well, yeah, because the INSERT has to be attempted first, and that includes forming the whole candidate row including the nextval() result. If you're expecting a serial ID column to not have holes in the sequence of values, you're going to be sadly disappointed, whether you use ON CONFLICT UPDATE or not. regards, tom lane