0

We are having an issue while execution of the queries that contains join conversed subquery from apache age's parser to PostgreSQL's parser

OPTIONAL MATCH with MATCH cause that error

The following query

SELECT * FROM cypher('cypher_match', $$
    MATCH (u:opt_match_v)
    OPTIONAL MATCH (u)-[m]-(l)
    RETURN u.name as u, type(m), l.name as l
    ORDER BY u, m, l
$$) AS (u agtype, m agtype, l agtype);

Throws

ERROR:  unrecognized RTE kind: 2

Modifications done o transform_cypher_optional_match_clause function After setting up the rtindex as we are expecting that to be modified based on addRangeTableEntryForJoin call I am getting into the following error, it is being thrown from the executor

    jnsitem = addRangeTableEntryForJoin(pstate,
                                        res_colnames,
                                        NULL,
                                        j->jointype,
                                        0,
                                        res_colvars,
                                        NIL,
                                        NIL,
                                        j->alias,
                                        NULL,
                                        false);
    j->rtindex = jnsitem->p_rtindex;
I have added the following after that above line
    RangeTblRef* rtr = (RangeTblRef*)j->rarg;
    rtr->type = j->rarg->type;
    rtr->rtindex = j->rtindex;
What was the output before adding my modifications:
ERROR:  graph_oid and label_id must not be null
What am trying to solve?

Resolving the new added rteperminfos attribute on the PNSI struct of PostgreSQL to make it compatible with Apache AGE.

What is the struggling we ran into?
  • Having a correct value for rtindex for the constructed subquery from cypher function call
  • Having a correct value for ParseState/ParseNamespaceItem (p_rteperminfos) (same for above)
  • Also we got ran into some cases lead to invalid perminfoindex 1 in RTE
Versions

PostgreSQL version: 16betav1
AGE version: 16

References:

0 Answers0