Repository navigation
Replies: 1 comment 1 reply
|
The PostgreSQL UUID type can accept UUIDv7 values but versions before v18 can't generate them. Therefore, if you use PostgreSQL and supplied the user's id to KC (via REST) in UUIDv7 format it might work. I haven't tested this myself yet though. Update: I asked Claude and had this suggestion, although hacky:
// Generate UUIDv7 (using a library like github.com/google/uuid with v7 support)
userID := uuidv7.New()
// Try partial import
response := keycloakClient.PartialImport(realm, PartialImport{
IfResourceExists: "FAIL",
Users: []UserRep{{
ID: userID.String(),
Username: "test@example.com",
Email: "test@example.com",
Enabled: true,
}},
})
// Verify KC actually used your UUID
createdUser := keycloakClient.GetUser(realm, userID)
if createdUser.ID == userID.String() {
fmt.Println("Success! KC accepted UUIDv7")
} |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Keycloak currently generates UUID v4 strings for the user_entity.id column.
In high-write workloads this causes index fragmentation and hurts performance on common RDBMSes (PostgreSQL, MySQL, etc.).
Is there any supported way to switch new user IDs to UUID v7 instead of UUID v4?
All reactions