waterWang opened a new pull request, #2543:
URL: https://github.com/apache/age/pull/2543

   Fixes #2542
   
   ## Problem
   
   `r0 IN relationships(p0)` fails with `unknown type of agtype container 
1610612736`:
   
   ```sql
   MATCH ()-[r0]->()
   MATCH p0 = (:L)-[:R]->()
   RETURN r0 IN relationships(p0) AS member
   ```
   
   The same applies to vertex membership: `a IN nodes(p0)`.
   
   ## Root cause
   
   `agtype_in_operator` reads the item argument (an edge or vertex variable) 
with `AG_GET_ARG_AGTYPE_P(1)`, which assumes the argument is already a 
well-formed agtype varlena. A matched edge/vertex variable is not passed as a 
self-contained agtype datum here, so reading its root container header yields 
garbage (e.g. `0x60000000` — both array and object flags set), and 
`agtype_iterator_init` raises `unknown type of agtype container`.
   
   ## Fix
   
   Use `get_one_agtype_from_variadic_args(fcinfo, 1, 1)` for the item argument 
in both the VLE-path branch and the plain-array branch of `agtype_in_operator`. 
It performs proper type categorization + `datum_to_agtype` coercion when the 
argument is not already an agtype, so an edge/vertex item is wrapped into a 
valid agtype raw-scalar array before iterator initialization. NULL handling is 
preserved (returns NULL for both SQL NULL and agtype null).
   
   ## Tests
   
   Added regression tests in `regress/sql/expr.sql`:
   - `r0 IN relationships(p0)` — edge membership, previously crashed with 
`unknown type of agtype container`
   - `a IN nodes(p0)` — vertex membership, same class of bug
   
   All existing tests pass (42/43; the `age_load` failure is a pre-existing 
environment/path issue unrelated to this change).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to