Viktor Künstler
Viktor Künstler

Reputation: 309

INFORMIX ERROR: A SERIAL column may not be updated

On Uniface I got an error when I updating an entity.

The error message from the database in uniface is the following:

"INFORMIX ERROR (SQLSTATE: IX000): A SERIAL column (my_column) may not be updated.      
 SQLCODE -232: A SERIAL column (my_column) may not be updated."

I don't understand why the column "my_column" may not be updated and this further leads to an error.

What should I do to fix the error?

Following versions are used:

Upvotes: 1

Views: 586

Answers (2)

Jonathan Leffler
Jonathan Leffler

Reputation: 753455

Transferring comments into an answer.

You aren't allowed to update a SERIAL column like the error messages say — not even if the new value is the same as the old value.

You avoid the error by not trying to update the column — don't list it in the UPDATE statement.

I looked at a previous Uniface + Informix question of yours and realize I do not know anything about the mindset of Uniface.

One possible last resort would be to change the type of the column from SERIAL to INTEGER and then use, probably, a SEQUENCE to provide the unique values that are characteristic of SERIAL columns. Informix 12.10 has sequences. That has ramifications for the rest of your code that inserts data into this table.

Upvotes: 2

Related Questions