Hi Ayush, On Fri, May 15, 2026 at 6:55 PM Ayush Tiwari <[email protected]> wrote: > > Hi, > > > On Fri, 15 May 2026 at 16:07, Ayush Tiwari <[email protected]> > wrote: >> >> Hi, >> >> On Thu, 14 May 2026 at 19:37, zengman <[email protected]> wrote: >>> >>> > The patch needs a test. graph_table.sql already has some view >>> > definitions, some of them using elements with multiple labels. Can you >>> > please add a test using those views? For example after CREATE VIEW >>> > customer_us, you could add a statement dropping label list_items from >>> > all of the elements associated with that label. I guess >>> > pg_get_viewdef() itself should throw an error with the fix, but you >>> > could select from that view as well, if necessary. We also need a test >>> > for drop property. Remember that the property is completely dropped >>> > from a property graph only when it is dropped from all the labels >>> > containing that property. Please apply patches from [1] before adding >>> > tests to your patch. With those patches added your test queries above >>> > will throw a different error. >>> > >>> > [1] >>> > https://www.postgresql.org/message-id/caexhw5tccqhgdefbtkwqe7bdqcuxhppsqogipl7vpf0epck...@mail.gmail.com >>> > >>> >>> Hi Ashutosh, >>> >>> Thank you for the review and sorry for the late reply. I'm currently busy >>> with company projects and may not have time to work on this right now. >>> If this is urgent, would you mind handling it? If it can wait, I'll come >>> back and fix it when I have more availability. >> >> >> Thanks for the report. >> >> I went through the thread and have attached a small patch for this. >> >> The issue is that views/rules over GRAPH_TABLE store GraphLabelRef and >> GraphPropertyRef nodes in the pg_rewrite parsetree, but dependency.c did >> not record dependencies for those node types. So a view could depend on >> label/property OIDs that were later removed by ALTER PROPERTY GRAPH, and >> then fail at execution with "cache lookup failed for label". >> >> The patch adds dependency walker cases for GraphLabelRef and >> GraphPropertyRef. I didn't add any special traversal for RTE_GRAPH_TABLE. >> query_tree_walker() already descends into rte->graph_pattern and >> rte->graph_table_columns, so recognizing those two leaf nodes should be >> enough?
WFM. >> >> I also added regression coverage for both cases: >> >> DROP LABEL of a label used by a GRAPH_TABLE view >> DROP PROPERTIES of a property used by a GRAPH_TABLE view >> >> Both now fail with the normal dependency error until the view is dropped. >> >> Thoughts? I'd suggest adding two stmts to the regression that can cover that walk of graph_table_columns is also working. [local] zhjwpku@postgres:5432-52789=# ALTER PROPERTY GRAPH myshop ALTER VERTEX TABLE customers ALTER LABEL customers DROP PROPERTIES (name); ALTER PROPERTY GRAPH Time: 1.312 ms [local] zhjwpku@postgres:5432-52789=# ALTER PROPERTY GRAPH myshop ALTER VERTEX TABLE products ALTER LABEL products DROP PROPERTIES (name); ERROR: cannot drop property name of property graph myshop because other objects depend on it DETAIL: view customers_us depends on property name of property graph myshop HINT: Use DROP ... CASCADE to drop the dependent objects too. Time: 2.231 ms >> > > Attaching v2 that uses existing views for test cases. > > Regards, > Ayush -- Regards Junwang Zhao
