Open vikramsubramanian opened 4 months ago
Summary: Dropping an RDFGraph when there is a non-RDFGraph rel table leaves the rel table "dangling" causing an error.
Based on the provided information and code snippets, the issue seems to be related to the deletion of an RDFGraph which leaves a non-RDFGraph relationship table (rel table) dangling, causing an error during a MATCH query after the RDFGraph is dropped. The expected behavior is to prevent the drop with a Binder exception if there are dependencies.
To resolve the issue, the following steps should be taken:
dropTableSchema
function in src/catalog/catalog_content.cpp
to include a check for dependencies before dropping a table schema. If the table is an RDFGraph, ensure that no rel tables are referencing it.dropTableSchema
function to throw a BinderException
if an attempt is made to drop an RDFGraph that is still referenced by any rel tables.DROP TABLE
logic in src/binder/bind/bind_ddl.cpp
to use the new dependency check logic from dropTableSchema
before proceeding with the drop operation.test/ddl/e2e_ddl_test.cpp
to verify that attempting to drop an RDFGraph with existing rel table dependencies correctly throws a BinderException
with the message "Cannot delete node table nodeTableX referenced by rel table relTableY."By implementing these changes, the software should correctly handle the deletion of RDFGraphs and maintain the integrity of the relationships within the database.
src/catalog/catalog_content.cpp
This file contains the logic for adding and dropping table schemas, which is directly related to the issue of dropping an RDFGraph and leaving a rel table dangling.
src/binder/bind/ddl/bind_create_rdf_graph.cpp
This file includes the binder logic for creating RDF graphs, which may need to be reviewed to ensure proper handling of dependencies between RDFGraphs and rel tables.
src/parser/transform/transform_ddl.cpp
This file contains the transformation logic for DDL statements, including the creation and dropping of tables, which is relevant to the issue.
src/binder/bind/bind_graph_pattern.cpp
This file contains binding logic for graph patterns, which may be relevant when considering how rel tables are bound to RDFGraphs.
Consider an RDFGraph UniKG and another node table Students and a rel table SameAs from Students to UniKG_r. You can drop UniKG even if that would leave Students around. Normally this would give a Binder exception that says: "Cannot delete node table nodeTableX referenced by rel table relTableY."
To replicate:
Normally, this would happen:
So the system does not allow dropping nodeTable2. )