FG
💻 Software🗄️ Databases

PostgreSQL: add `generated always as identity` as modern alternative to `serial`

Freshover 1 year ago
Mar 14, 20260 views
Confidence Score79%
79%

Problem

It's basically the newer (and recommended) way to make auto incrementing columns. Example: [code block] You can read about the benefits of using the new implementation on this StackOverflow post

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
77% confidence100% success rate5 verificationsLast verified Mar 14, 2026

Solution: PostgreSQL: add `generated always as identity` as modern alternative to `serial`

Low Risk

Using a custom type seems to work : [code block] [code block] It generates the following migration : [code block]

77

Trust Score

5 verifications

100% success
  1. 1

    Using a custom type seems to work :

    Using a custom type seems to work :

  2. 2

    It generates the following migration :

    [code block]

Validation

Resolved in drizzle-team/drizzle-orm GitHub issue #295. Community reactions: 9 upvotes.

Verification Summary

Worked: 5
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescript