I am trying to delete some tables in Retool DB but it is not allowing me to. I keep getting a:
"Cannot drop table "MR_Equipment" because other objects depend on it"
But i am unsure what other objects depend on it.. Is it another Table another App? I have a few i want to delete but i am unable to do so. Some help would be appreciated.
The error message you're receiving indicates that the MR_Equipment table is being referenced by other objects in your Retool database. This could be another table, a view, or even a trigger.
To identify which objects are depending on the MR_Equipment table, you can use the following SQL query:
SELECT
object_name,
object_type
FROM
information_schema.dependents
WHERE
referenced_object_name = 'MR_Equipment';
This will return a list of all objects that are referencing the MR_Equipment table, along with their type.
Once you have identified the dependent objects, you can either drop them first, or use the CASCADE option to drop the MR_Equipment table along with its dependents.
To drop the dependent objects first:
Drop each of the dependent objects, one by one.
Once all of the dependent objects have been dropped, you will be able to drop the MR_Equipment table without any errors.
To drop the MR_Equipment table with the CASCADE option:
Run the following SQL query:
DROP TABLE MR_Equipment CASCADE;
This will drop the MR_Equipment table and all of its dependents.
Thats a great idea Patrick! So with retool how can i do that? i tried running that query in retool and it also connected it to azure data studio to see around and could get it to work.
i got the error: error: "relation "information_schema.dependents" does not exist"
@PadenM You should be able to check any foreign key dependents in the UI as well. Table columns that contain foreign keys from other tables are denoted with a .
Clicking on the column and selecting Settings will bring up the column information, which includes the referenced table.
Ok i went to edit the primary key and it then showed the error of which other table it was referenced by. it was a sample one i used one a while ago and forgot about.. It was difficult to find with just looking at columns of other tables with quite a few of them to go through.