I want to store big integer values such as MySQL bigint in my Informix table. But Informix does not have a data type bigint. What is the data type I have to use instead?
I want to store big integer values such as MySQL bigint in my Informix
Share
On current versions of Informix Dynamic Server (meaning IDS version 11.x) on all platforms (32-bit and 64-bit), there is a data type BIGINT which is an 8-byte integer (and a matching BIGSERIAL).
There is also, for hysterical raisins1, a second pair of types: INT8 and SERIAL8. However (and this is the hysterical bit), they occupy 10 bytes on disk instead of 8. I don’t recommend them. Any given table can have either a BIGSERIAL or a SERIAL8 column, but not both; you can also have a SERIAL column, but then why do you need the bigger number. (There are also sequences for generating numbers that increment by values other than 1, but they’re fiddlier to use than (BIG)SERIAL(8) columns.)
If you don’t have BIGINT, you must be using an out of date version of Informix.
There is one gotcha with Informix integer data types. The range of valid values is symmetric. For example, the valid range for SMALLINT is ±32767. The odd-ball value (either -32768 on a 2’s complement machine, or -0 on a sign-magnitude machine or a 1’s complement machine) is reserved for use as NULL.
1 For ‘hysterical raisins’, read ‘historical reasons’.