Subject INTEGER or BIGINT for table primary key?
Author Jacob Havkrog
Hi

Is it ok to use INTEGER as a primary key incremented with at generator trigger?

I understand that a generator returns a BIGINT and that using BIGINT as the primary key is common now, but the range of INTEGER is sufficient for my purposes.

So is ok to do like this:?

CREATE TABLE CARS (
CarID INTEGER NOT NULL,
Data CHAR(35),
CONSTRAINT PK_CARS PRIMARY KEY (CarID)
);

CREATE SEQUENCE CarID_CARS_GEN;

SET GENERATOR CarID_CARS_GEN 1;

CREATE TRIGGER CarID_CARS_TRIG FOR CARS
BEFORE INSERT
AS
BEGIN
IF (NEW.CarID IS NULL) THEN
NEW.CarID = NEXT VALUE FOR CarID_CARS_GEN;
END

Thanks
Jacob