You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using nanoids as a primary key on a real-time table—instead of the default uuidv4 values—it breaks all real-time functionality on that table in various ways (see below).
Configure a real-time table to use those nanoids as primary keys (e.g. id char(21) PRIMARY KEY DEFAULT generate_nano_id() NOT NULL)
Notice how the real-time listeners break (e.g. inserts no longer get called and for deletes it trims the id down to a single char versus showing the full 21 chars)
Expected behavior
Real-time should be agnostic to the type of primary key as long as it's a valid SQL primary key type
Screenshots
In the below delete callback, it trimmed the old id down to a single character (regardless of if it starts with a number or letter) when the original id was a 21 character nanoid
System information
OS: macOS
Browser (if applies): Arc
Version of supabase-js: ^2.39.3
Version of Node.js: v21.6.2
Additional context
Switching back to uuidv4 as primary keys immediately resolved the issue, but is not ideal for indexing.
The text was updated successfully, but these errors were encountered:
Bug report
Describe the bug
When using nanoids as a primary key on a real-time table—instead of the default uuidv4 values—it breaks all real-time functionality on that table in various ways (see below).
To Reproduce
id char(21) PRIMARY KEY DEFAULT generate_nano_id() NOT NULL
)id
down to a single char versus showing the full 21 chars)Expected behavior
Real-time should be agnostic to the type of primary key as long as it's a valid SQL primary key type
Screenshots
In the below delete callback, it trimmed the
old
id down to a single character (regardless of if it starts with a number or letter) when the original id was a 21 character nanoidSystem information
Additional context
Switching back to uuidv4 as primary keys immediately resolved the issue, but is not ideal for indexing.
The text was updated successfully, but these errors were encountered: