Share a postgres sequence between tables as a primary key?

It seems that Postgres allows to share a single sequence to generate IDs between several tables. Does Django provide a way to do that or should I manually write SQL?

I can’t find anything in core Django, django.contrib.postgres or django-postgres-extra to do this. My guess is that you would need to do it “manually”, perhaps as part of a custom migration.

1 Like