I'm trying to check if a serial value has reached its upper limit. I noticed the following unpleasant behaviour.
In the sysmaster tables sysptnhdr and sysactptnhdr the currently used serial values are in three fields for the datatypes serial, serial8 and bigserial.
If my serial approaches the upper limit for integer data types, the easiest way is to change it to a serial8 or bigserial.
During the alter table, the current value from serial is now copied into the column of the new type. Unfortunately the value of serial is not reset to 0 or NULL.
This means that a value check still reports a dangerously high serial value, even though the table no longer has this data type.
Since you can have both types serial and serial8/BigSerial in a table in parallel, you must now also check the syscolumns of the affected database to suppress this message.
At least for databases with non-english locale this is even more difficult, because you cannot access directly from sysadmin or sysmaster.
My suggestion is that only the field of the data type that is used is filled with the current serial value and the others are reset to 0 or NULL.
A repro for this behaviour can be found in the support case TS002868693.
|Who would benefit from this IDEA?||All users who use the serial data type and check if they reach its upper limit to prevent production stopping when this happens.|
How should it work?
Only the current serial data type should be used in the tables syspthhdr and syspactptnhdr. The others should be marked as unused with 0 or NULL.
|Priority Justification||There is a workaround as described above, but it is quite tricky.|
|Customer Name||CURSOR Software AG|
NOTICE TO EU RESIDENTS: per EU Data Protection Policy, if you wish to remove your personal information from the IBM ideas portal, please login to the ideas portal using your previously registered information then change your email to "firstname.lastname@example.org" and first name to "anonymous" and last name to "anonymous". This will ensure that IBM will not send any emails to you about all idea submissions