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?
>
> 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?
>
>
Attaching v2 that uses existing views for test cases.

Regards,
Ayush

Attachment: v2-0001-SQL-PGQ-Record-dependencies-on-graph-labels-and-p.patch
Description: Binary data

Reply via email to