On 15 April 2013 20:52, Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Apr 15, 2013 at 11:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I claim this is a common class, since sequence next_val functions and
>>> uuid generators meet that criteria and most common forms of auditing
>>> trigger, as well as any other form of data-reformatting trigger.
>>
>> I don't believe that it's a good idea to consider nextval() to be
>> reorderable, so I'm not convinced by your argument here.
>
> Why not?
>
> I admit that I can't convince myself that it's safe. But I can't
> think of a concrete example where it breaks anything, either.
I'm not sure exactly if the corect label is "reorderable" or some
other word that describes this specific situation. "Parallel
independent" probably would work, since if we had a DML statement that
worked in 2 separate processes we'd probably want to know that the
rows in each could be divided up without changing the result.
It looks straightforward to put in a special case check for sequences,
which is the most important use case. Sequences are a recognised
database object, so such a special case could be justified... shame
about the other use cases though, e.g. UUIDs.
I guess we can generalise it when we have a better idea of whether
this does indeed make a useful generalisation.
--Simon Riggs http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services