"Is Unique" Toggle is Hidden on Column that is Part of a Table's Composite Primary Key #16911
Replies: 5 comments
-
@MildTomato we'll need to keep this in mind when we get to relooking at the UI of the table editor |
Beta Was this translation helpful? Give feedback.
-
@raparri01 @joshenlim So in Front-end currently there is this key icon to indicate the column as a primary key. |
Beta Was this translation helpful? Give feedback.
-
Hey @aayushdura! Thanks so much for this - but this doesnt solve the issue that this ticket is mentioning though. Atm our table grid doesnt support composite column stuffs that well (e.g foreign keys and in this context, setting "unique" across composite columns) On the topic of having an icon to denote the unique property of the column on the other hand, I personally dont think we should as it'll add clutter to the table editor (pertaining to UX). As much as possible we should only be showing the important information at the first level, all else could be found on the second level. (Cc @MildTomato if you might have opinions here too) For your case specifically you can check if a column has is unique toggled by right clicking on the column and editing it. You'll see a checkbox there which denotes is the column is unique or not, and you can edit it accordingly too. |
Beta Was this translation helpful? Give feedback.
-
I just ran into this issue. Had to delete the table and re-add, which is less than ideal. I'm sure SQL could be ran to fix, but the UI blocks removing the contraint |
Beta Was this translation helpful? Give feedback.
-
Anyone hitting this issue, you can use the SQL editor for now if you wish to remove a constraint from a table. ALTER TABLE table_name
DROP CONSTRAINT constraint_name; If you don't know the constraint name, you can run another query to get all constraints on that table: SELECT con.*
FROM pg_catalog.pg_constraint con
INNER JOIN pg_catalog.pg_class rel
ON rel.oid = con.conrelid
INNER JOIN pg_catalog.pg_namespace nsp
ON nsp.oid = connamespace
WHERE nsp.nspname = 'public'
AND rel.relname = 'table name'; |
Beta Was this translation helpful? Give feedback.
-
Bug report
Describe the bug
When a column is designated as a Primary Key, the "Is Unique" flag does not appear in the Table Editor settings. This behavior makes sense when a single column is the Primary key, but is frustrating to deal with when you are using a composite primary key where a unique combination of 2 or more columns is the primary key.
Since the "Is Unique" flag is hidden, you can run into a uniqueness violations when writing to the table and not know why.
To Reproduce
Expected behavior
System information
Web Table Editor
Beta Was this translation helpful? Give feedback.
All reactions