graphql-engine: Cannot drop column from table that has update permissions
Version Information
Server Version: 2.6.0-beta.1
Environment
Cloud / OSS
What is the expected behaviour?
Users should be able to drop columns from tables, as long as the column is not explicitly used in any of the table permissions.
Keywords
Hasura drop inconsistency permissions
What is the current behaviour?
When update permissions exist on a table, columns cannot be dropped from the table.
An error is throw cannot drop due to the following dependent objects : permission talbe_name.role_name.update in source "pg1"
The user is allowed to “continue by dropping dependent items”, but this will delete the entire update permission for the table.
How to reproduce the issue?
- Create and track the following table
CREATE TABLE test (id INT, name TEXT);
- Create update permissions for it. Do not reference the
namecolumn
- Attempt to delete the
namecolumn - An error is thrown
cannot drop due to the following dependent objects : permission test.user.update in source "pg1"
Possibly related, but choosing to delete the inconsistent metadata as well runs into #8414 and the entire update permission is deleted.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 22 (6 by maintainers)
Facing this issue in 2.8.4
Fixed by https://github.com/hasura/graphql-engine/commit/7634be3216b6ef16a7983ca3d2f043fddf47bc6d. Closing this now, please feel free to re-open if the issue still exists.
Fixed in 2.10.0
@srflorea1 there are two ways to work around this:
Option 1
Keep in mind that if you mess up step 1 your metadata will be inconsistent and you will need to fix it by removing any references to the column.
Option 2
@tirumaraiselvan - Additional info v2.6.2-cloud
Problem: Dropped column is still referenced in mutation root result.
{“exec_status”:“FatalError”,“hint”:null,“message”:“column _0_root.base.settings does not exist”,“status_code”:“42703”,“description”:null}
Steps:
Thanks!
Also facing this in v2.9.0
@BenoitRanque Looking into this.
@BenoitRanque I checked it again today and either the issue was resolved by recent updates or else it was user error to begin with. Thanks for following up.
Experiencing this on v2.5.1 as well