Feature or Bug: Text type Foreign-Key unable to be set to NULL through Dashboard UI #27783
Unanswered
henryis300
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are currently working on issue #26648 and were unsure if Supabase’s design was to allow text-type foreign keys to be set to the NULL value. When the foreign key [parent_id] is set to text type and the user is attempting to update the foreign key without typing anything, an error is generated:



Utilizing the table:
We can set the foreign key to NULL through SQL terminal command:
UPDATE my_table SET parent_id = NULL WHERE id = 'B';
Resulting Table:
However, when trying to set the foreign key to NULL through the interface edit-row we get the same 23503 error from above.
We believe this is likely because an empty string is assumed in place of the NULL value when nothing is typed. The empty string can be a viable foreign key if the empty string is a primary key as shown here:

If the foreign key is set to an integer type, then there are no issues since leaving an integer field blank makes sense that it would be NULL.
Therefore, we believe this might not be a bug as mentioned in issue#26648, and wanted to check with the maintainers if this was an intentional design.
Proposed solution that might work:
Beta Was this translation helpful? Give feedback.
All reactions