Replies: 2 comments 6 replies
-
As of today, happy to say that drizzle-orm 0.33.0 do have support for |
Beta Was this translation helpful? Give feedback.
6 replies
-
@bhuynhdev As far as I know, this feature is supported since 0.32.0, not 0.33.0
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now that we support PostgreSQL Identity Columns
GENERATED ALWAYS AS IDENTITY
viageneratedAlwaysAsIdentity
, why don't we addGENERATED BY DEFAULT AS IDENTITY
, too?#2564
GENERATED ALWAYS AS IDENTITY
does not allow manual updates on the ID column, but sometimes we want to renumber those IDs.In my case, I realized that serial IDs get a huge gap between them when
onConflictDoUpdate
is used. If you increment access counters on a column withonConflictDoUpdate
, the ID number could easily be 1,000~100,000x larger than the number of rows, depending on the update frequency.Now, I have mitigated the issue by changing the code "First, try to SELECT. If record found, UPDATE. If not found, INSERT ON CONFLICT DO UPDATE to deal with pathological case of race condition" — then after this, I wanted to compact the ID space by renumbering the bloated IDs.
So I would run the following script — but this kind of manual modification on ID column is NOT allowed if
GENERATED ALWAYS AS IDENTITY
is specified. What I need is the best of both world —GENERATED BY DEFAULT AS IDENTITY
.Beta Was this translation helpful? Give feedback.
All reactions