SQLite Forum

Feature Request: Allow REAL to serve as rowid by having the B-Tree interpret its byte signature as a 64bit INTEGER.
Login
Yeah this is just weird. I mean, if you don't need it to be the ROWID then of course just make a REAL pk. But if you do need it to be a rowid, then you must want the autoinc feature or else what's the point.  And if that's the case you certainly don't want to +1 the raw bits of a real because that's not going to give you anything like +1.

If we had a feature where you could +whatever for the rowid  you could pick the magic value that increments the mantissa by one and then assuming you could start at some base value you could arrange for some range of reals but now this is even weirder.  You'll have to do weird memory aliasing to get the real back when you pull it out.

It's far easier to just say "the integer is fixed point" then you do `real_value = rowid/scale + offset` when you pull it out and it all works fine. This is much less weird than the memory stuff you'd have to do to store the real as an int.