I'm with the same problem of this post. But I'm using Rails and don't know how to do this workaround in activerecord.
I'm inserting some data using seeds.rb:
device_platforms = DevicePlatform.create([{id: 1, name: 'Android'}, {id: 2, name: 'IOS'}, {id: 3, name: 'Windows Phone'}])
When I insert another DevicePlatform, I get this exception:
Failure/Error: @device_platform = FactoryGirl.create(:device_platform)
ActiveRecord::RecordNotUnique:
PG::UniqueViolation: ERRO: duplicar valor da chave viola a restrição de unicidade "device_platforms_pkey"
DETAIL: Chave (id)=(2) já existe.
: INSERT INTO "device_platforms" ("created_at", "name", "updated_at") VALUES ($1, $2, $3) RETURNING "id"
The message is in portuguese, it says that a row with that ID already exists.
Thanks.