mathesar
mathesar copied to clipboard
Dynamic defaults can be altered
Description
As noted in this comment by @kgodey on #941 , it's currently possible to alter dynamic default value settings via the API through PATCH
requests. This is a problem, since if this alteration is made in error, it's not possible for the user to recover (since we don't have the functionality allowing creation of dynamic defaults for columns).
Expected behavior
It should be impossible to change the default generator of a column via the API, until we have functionality that would enable the user to recover from doing so in error.
To Reproduce
Give a PATCH
request that to the appropriate columns endpoint that alters the default value of the id
column:
{
"default": {
"value": 3
}
}
@mathemancer I don't think this should be specific to the id
column, we should not allow static defaults for any column with a unique or primary key constraint.
I don't think we need any specific behavior for the id
column, it's fine if users change the name or other attributes.
Okay, I'll alter this issue accordingly.
This issue has not been updated in 90 days and is being marked as stale.
Hi, @mathemancer, @kgodey, it is currently possible to alter dynamic default value settings via the API through PATCH
requests, even for the primary key column, where dynamic default is necessary.
And, after adding a record to the table, the error says The requested insert violates a uniqueness constraint
, therefore breaking the insertion functionality.
So, our task is to
- Restrict the PATCH request such that it can't alter the dynamic default of a column? OR
- Restrict the PATCH request such that it can't alter the dynamic default of a column which has a uniqueness constraint?
Also, can I be assigned to this issue?
Restrict the PATCH request such that it can't alter the dynamic default of a column?
This is what we should do.
Unassigning due to inactivity
Added needs: troubleshooting
since I can't currently reproduce it with the method in the description, but I also don't remember ever solving this bug. Thus, we need to investigate to determine whether this is still occurring or not.