jrgemignani commented on issue #1000:
URL: https://github.com/apache/age/issues/1000#issuecomment-1673500992
@vladiksun In the following query -
```
select
any_profile
from ag_catalog.cypher('test_graph',$$
EXPLAIN ANALYZE MATCH (any_profile:`profile` { hidden: false })
WHERE any_profile.pet = 'dog'
RETURN any_profile
$$
) as (any_profile ag_catalog.agtype);
```
The cypher component -
```
MATCH (any_profile:`profile` { hidden: false })
WHERE any_profile.pet = 'dog'
RETURN any_profile;
```
any_profile is a vertex
In your first index below, I'm not sure if this has been set up. We will
need to debug this specific index to find out how it is resolved.
> ```
> -- does not work in the where clause
> CREATE INDEX profile_pet_btree_idx1 ON test_graph."profile" USING BTREE
((properties -> 'pet'));
> ```
In your second index below, `agtype_access_operator` aka `.` understands how
to work with whatever value is sent to it. The `properties()` function isn't
used as `agtype_access_operator` has to be able to accept any object or array.
So, any `.` operation just takes the variable used.
> ```
> -- does not work in the where clause
> CREATE INDEX profile_pet_btree_idx2 ON test_graph."profile" USING BTREE
(ag_catalog.agtype_access_operator(properties, '"pet"'::ag_catalog.agtype));
> ```
That is why this index worked -
```
CREATE INDEX profile_pet_btree_idx3 ON test_graph."profile" USING BTREE
(agtype_access_operator(VARIADIC ARRAY[_agtype_build_vertex(id,
_label_name('16954'::oid, id), properties), '"pet"'::agtype]));
```
I should note, this is **after** adjusting the volatility flag for the
functions used in the index.
Our team needs to look into changing the volatility flag for the functions
used in this index and similar ones for edges. Part of the problem originally
was that some wanted to blanketly change that flag without bothering to truly
understand if it can be changed. Changing the flag obviously works but does it
pose other issues?
For you, as a temporary fix, all you need to do is change the volatility
flag of the functions involved in `age--1.3.0.sql` and then rebuild the
extension. Or, possibly, alter their entries through sql.
We will be looking into the issue with the volatility flag to see if it can
be updated with a patch, sometime this week.
Hopefully, this is helpful.
--
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]