Heikki Linnakangas <hlinnaka@iki.fi> writes:
> On 08/04/2025 16:55, Tom Lane wrote:
>> + The trigger will replace the field's value only if that value is
>> + initially zero or null (after the action of the SQL statement that
>> + inserted or updated the row). Also, if the sequence's next value is
>> + zero, <function>nextval()</function> will be called a second time in
>> + order to obtain a non-zero value.
> That's a much clearer explanation of the behavior, but now that I read
> that paragraph, I wonder *why* it behaves like that. I'm sure it's just
> historical reasons. But perhaps we should nuke autoinc altogether?
Yeah, we were kind of wondering that about refint.c as well. But in
the end, none of the stuff in contrib/spi/ has much value as
production code. It's meant to be examples you can start from and
modify. In that light, I'm more worried about whether the coding
style is good than whether the definition is useful.
In any case, if we decided to nuke the modules entirely, we'd still
need half of the present patch in order to remove the core tests'
dependency on them. So I'll go ahead and push this, and then we
have a more self-contained target if we decide we don't want 'em.
regards, tom lane