As PostgreSQL v10, it is no longer recommended to use the "serial" type for primary keys, and instead using the identity type, to avoid a bunch of weirdness.
One of many dangers with the serial type is the fact that Postgres does not complain when a record is inserted with the primary key field provided by the user. If a record is somehow inserted with a primary key value that is above the current sequence value, the table will eventually no longer allow inserts because the sequence will not be updated to reflect the new max value created by the insert.
ActiveRecord (postgres adaptor) still defaults to use the bigint serial type when generating primary keys, and lacks any documented support for the recommended identity type.
Can ActiveRecord be forced to use the type of "identity" as a primary keys, instead of using serial?