graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Unexpected dependency-error when trying to delete column

Open happyfloat opened this issue 2 years ago • 8 comments

Version Information

v2.3.1-cloud.1 with postgreSql

What is the expected behaviour?

I should be able to delete my freshly created column again, after realising I choose the wrong type.

Keywords

  • dependency-error
  • cannot drop

What is the current behaviour?

When I try to remove the column (via console or SQL), it fails because of this error:

{
    "path": "$[0]",
    "error": "cannot drop due to the following dependent objects : permission corporate_post.user.update in source \"default\"",
    "code": "dependency-error"
}

I double checked the permission table and I also tried to reload metadata and database without success. Since I just created the column without doing anything else, this was kind of expected. In earlier versions I often created and deleted columns without any problems.

happyfloat avatar Apr 07 '22 09:04 happyfloat

Having the same error and I wonder whether it's due to my device. (Apple Macbook M1) What device do you use? @happyfloat

I updated to: image: hasura/graphql-engine:latest

However, as of recent I am experiencing the same issue as described above. Whenever I create a column locally and try to delete it afterwards, it results in the same dependency error:

{ 
"path": "$[0]", 
"error": "cannot drop due to the following dependent objects : permission shift.client_admin.update in source \"default\"", 
"code": "dependency-error" 
} 

UPDATE: issue does not appear in image: hasura/graphql-engine:v2.2.1.arm64. It seems to have been introduced in a later version.

TEMPORARY SOLUTION: downgrade to image: hasura/graphql-engine:v2.2.1.arm64.

RobSchilderr avatar Apr 22 '22 10:04 RobSchilderr

Hello @happyfloat and @RobSchilderr

Did you folks tried the latest version of hasura cloud v2.6.2-cloud.1 ? Or if you are having issues while running graphql-engine in local, then which version are you using ?

Let us know if you are having the same issue in the latest version.

meetzaveri avatar May 18 '22 03:05 meetzaveri

@RobSchilderr I'm using the cloud version, unrelated to my intel macbook pro. @meetzaveri I tested it with the new cloud version v2.6.1-cloud.1 and it gives me a new error message!

Deleting column failed
{ "path": "$[0]", "error": "the following tracked function(s) cannot be overloaded: cp_reaction_result", "code": "not-supported" }

This is starting to make somewhat sense now, since the function receives the whole row as an input argument (including the column I try to remove). Maybe the order of deletion/creation is wrong here? I'm sure this is something hasura could take care of instead of throwing an error message?

So I'm sure I could delete the function, then delete the column and then add the function again... but I'm not doing this right now.

happyfloat avatar May 18 '22 10:05 happyfloat

I also do not have time to test this at the moment, did cost me a day before and I am stacked with work! (like you probably)

I fixed it by downgrading and continued with that engine. I will come back at this later.

RobSchilderr avatar May 18 '22 10:05 RobSchilderr

Experiencing the same on v2.8.1-cloud.1

error": "cannot drop due to the following dependent objects : permission user.user.update in source \"default\"", "code": "dependency-error"

user.user.update is already ticked off in the permissions tab.

Edit: temporarily deleting user.user.update permissions as a whole, then dropping the column and the re-creating the same permissions again worked for me.

tom2strobl avatar Jun 27 '22 09:06 tom2strobl

I had the same problem on v2.8. It works fine on v2.9.0-beta.3 👌

ofilipowicz avatar Jul 21 '22 12:07 ofilipowicz

@ofilipowicz I think you might just have saved my ass

sanderkooger avatar Jul 21 '22 12:07 sanderkooger

I have a similar issue when adding a new column with v2.9.0-beta.3

fcpauldiaz avatar Aug 08 '22 23:08 fcpauldiaz

Also seeing this issue on v2.10.1. Specifically when modifying/adding/deleting any column on any table I am getting: { "code": "not-supported", "error": "the following tracked function(s) cannot be overloaded: product_full_changelog", "path": "$[0]" }

My computed field full_changelog on the product object is defined as:

CREATE OR REPLACE FUNCTION public.product_full_changelog(product_row products)
 RETURNS SETOF changelog
 LANGUAGE sql
 STABLE
AS $function$
SELECT changelog.*
FROM changelog
WHERE changelog.product_id = product_row.id
UNION ALL
SELECT changelog.*
FROM changelog
         JOIN product_variants pv on changelog.product_variant_id = pv.id
WHERE pv.product_id = product_row.id;
$function$

I can workaround by removing the computed field, making the change I want, then adding the computed field.

EDIT: In case this helps anyone else, I just found that my function has also been registered as a root query (as well as a computed field). When I stop tracking my function as a query the error goes away for me.

Dartoxian avatar Aug 19 '22 14:08 Dartoxian

@Dartoxian I was having the same issue, I think it is when using a row as the function parameter, even when not overloading the function. I tried to stop tracking the function and it worked, thanks.

fcpauldiaz avatar Aug 19 '22 18:08 fcpauldiaz