Informix Error -25831: Cannot modify fragment expression for transition fragment.
Cause and resolution
Cannot modify fragment expression for transition fragment.
The fragment expression for transition fragment or last range fragment cannot be modified. However, the MODIFY INTERVAL TRANSITION option of the ALTER FRAGMENT statement allows modification of the transition value which in turn can change the fragment expression.
For example, the following alter generates an error:
CREATE TABLE employee (emp_id INTEGER, emp_name CHAR(64), ssn CHAR(12), basepay FLOAT, varpay FLOAT, dept_id SMALLINT, hire_date DATE) FRAGMENT BY RANGE(emp_id) INTERVAL(1000) STORE IN (dbs1, dbs2, dbs3) PARTITION p1 VALUES < 5000 IN dbs0, PARTITION p2 VALUES < 10000 IN dbs0, PARTITION p3 VALUES < 20000 IN dbs4;
ALTER FRAGMENT ON TABLE employee MODIFY PARTITION p3 TO PARTITION p3 VALUES < 25000 IN dbs4;
The fragment expression for transition fragment p3 cannot be modified using the above syntax. The following statement that modifies the transition value, will indirectly change the fragment expression for p3:
ALTER FRAGMENT ON TABLE employee MODIFY INTERVAL TRANSITION TO 25000;
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-25831 fires when ALTER FRAGMENT ... MODIFY targets the transition fragment (the last
range fragment) directly — per the official guidance, that fragment's expression can only
change indirectly, via MODIFY INTERVAL TRANSITION.
ALTER FRAGMENT ... MODIFYused directly on the transition fragment, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use
ALTER FRAGMENT ... MODIFY INTERVAL TRANSITION TO <value>instead, per the official guidance, to change the transition fragment's boundary indirectly.
Examples
Modifying the transition fragment directly
CREATE TABLE employee (emp_id INTEGER, emp_name CHAR(64), ssn CHAR(12),
basepay FLOAT, varpay FLOAT, dept_id SMALLINT, hire_date DATE)
FRAGMENT BY RANGE(emp_id) INTERVAL(1000) STORE IN (dbs1, dbs2, dbs3)
PARTITION p1 VALUES < 5000 IN dbs0,
PARTITION p2 VALUES < 10000 IN dbs0,
PARTITION p3 VALUES < 20000 IN dbs4;
ALTER FRAGMENT ON TABLE employee MODIFY PARTITION p3 TO PARTITION p3 VALUES < 25000 IN dbs4;
-- -25831: p3 is the transition fragment
Corrected
ALTER FRAGMENT ON TABLE employee MODIFY INTERVAL TRANSITION TO 25000;
Diagnostic Checks
- Check whether the fragment being modified is the transition (last range)
fragment, and use
MODIFY INTERVAL TRANSITIONinstead if so.
Related Errors / Related Topics
- -25830 — "The new fragment expression cannot cross adjacent fragment boundaries." A
related
ALTER FRAGMENT ... MODIFYrestriction, on non-transition range fragments. - -25835 — "The transition value specified is not valid." A related transition-value
error, on the
MODIFY INTERVAL TRANSITIONvalue's own validity constraints.
ALTER FRAGMENT ... MODIFY targeted the transition fragment directly — use MODIFY INTERVAL TRANSITION instead.