On 2019-12-16 09:43, Norbert Saint Georges wrote:
Hello,
can't an identity column be a decfloat (16)?
RECREATE TABLE FIREBIRD_PARTS (
PART_ID DECFLOAT (16) GENERATED BY DEFAULT AS IDENTITY
not null
, PART_NAME varchar (255) not null
, BUY_PRICE decimal (9, 2)
);
error: 336068881
description found in client-java:
Identity column {0} of table {1} must be of exact number type with zero
scale
You can't, a `DECFLOAT` is not a suitable datatype for this. An identity
column has to be an exact number type with zero scale (== an integer
type), and a `DECFLOAT` is a floating point type.
And if it were possible, using `DECFLOAT(16)` wouldn't make much sense:
it has less digits than a BIGINT (16 vs 19), while it takes the same
storage space.
The maximum value generated by the sequence backing an identity column
is the maximum value of a `BIGINT`, so using a larger type than `BIGINT`
has no real use, except taking more space. I'm not sure if it is
possible to use `NUMERIC(38,0)` (which provides 38/39 digits), but given
the restriction on the maximum value of a sequence to 2^63 - 1, using
that type would also not make sense.
Mark
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel