I've been digging through stackover flow and it seems odd that a powerful database management software such as postgres does not have a simple way to provide this.
The best solution I have so far is
id serial primary key,,
but in the event that you want to do an
INSERT VALUE ON CONFLICT DO NOTHING
(I'm adding this last part b/c postgres cannot do INSERT OR IGNORE), the sequence will count on even after insertions failed.
So The table you get might look something like:
id | name
1 | amy
5 | bob
12 | john
104 | thomas
where the in between indexes were failed insertions. The app works, but I find this annoying. Suggestions?
serialprimary key having gaps. Incidentally, this behavior is true of all databases that have such functionality. It would be very expensive (performance-wise) to remove those gaps.-4635is as good a primary key value as42or107or anything else that is unique in that tableinsert or ignore, is that expensive? forgive me for not up to your speed.