apache / age

Graph database optimized for fast analysis and real-time data processing. It is provided as an extension to PostgreSQL.
https://age.apache.org
Apache License 2.0
3.16k stars 413 forks source link

Attribute values of object types cannot be modified #239

Open wqxs opened 2 years ago

wqxs commented 2 years ago

I created a point SELECT * FROM ag_catalog.cypher('zjdata_graph', $$ CREATE (a:a {id:1,map:{name:'a'}}) RETURN id(a), properties(a) $$) as (id ag_catalog.agtype,properties ag_catalog.agtype)

results are as follows image

I modify the map property value SELECT * FROM ag_catalog.cypher('zjdata_graph', $$ MATCH (a:a) WHERE a.id = 1 SET a.map = '{"name":"b"}' RETURN id(a), properties(a) $$) as (id ag_catalog.agtype,properties ag_catalog.agtype)

This is not the result I want, please tell me how to solve it AY6K8H4WW~_58$(JSEE1ISV

JoshInnis commented 2 years ago

Hi, SET a.map = '{"name":"b"}' is setting the value of a.map to a string, not a map. remove the surrounding 's SELECT * FROM ag_catalog.cypher('zjdata_graph', $$ MATCH (a:a) WHERE a.id = 1 SET a.map = {"name":"b"} RETURN id(a), properties(a) $$) as (id ag_catalog.agtype,properties ag_catalog.agtype)

wqxs commented 2 years ago

嗨,正在将a.map的值设置为字符串,而不是map。去除周围的SET a.map = '{"name":"b"}' ``'``SELECT * FROM ag_catalog.cypher('zjdata_graph', $$ MATCH (a:a) WHERE a.id = 1 SET a.map = {"name":"b"} RETURN id(a), properties(a) $$) as (id ag_catalog.agtype,properties ag_catalog.agtype)

I want to change the values in the map, but I can't image

JoshInnis commented 2 years ago

Ahh, sorry for the oversight. Property names don't need to be wrapped with ".

SELECT * FROM ag_catalog.cypher('zjdata_graph', $$ MATCH (a:a) WHERE a.id = 1 SET a.map = {name:"b"} RETURN id(a), properties(a) $$) as (id ag_catalog.agtype,properties ag_catalog.agtype)

wqxs commented 2 years ago

啊,抱歉疏忽了。属性名称不需要用 包装。"

SELECT * FROM ag_catalog.cypher('zjdata_graph', $$ MATCH (a:a) WHERE a.id = 1 SET a.map = {name:"b"} RETURN id(a), properties(a) $$) as (id ag_catalog.agtype,properties ag_catalog.agtype)

It still doesn't work. image

JoshInnis commented 2 years ago

What version of AGE are you using? I am testing on Master.

image
wqxs commented 2 years ago

What version of AGE are you using? I am testing on Master.

image

How to query the version

JoshInnis commented 2 years ago

The bug fix is not in an official release, its only in master https://github.com/apache/age/commit/ab70781b4b311922f14f2bcb1b2144f1df9a9da1 how did you get AGE, through a release, docker, or did you download the source code?

wqxs commented 2 years ago

The bug fix is not in an official release, its only in master ab70781 how did you get AGE, through a release, docker, or did you download the source code?

I used Docker to download it around the end of April,how do I replace this plugin if I want to use the latest version

JoshInnis commented 2 years ago

Try to pull the docker image again docker pull apache/age for this bug fix you should be able to restart the session and the bug will be fixed. However, if you can lose the data in the database, I recommend dropping the extension and recreating it.

JoshInnis commented 2 years ago

Without upgrading, there is a workaround that was found. https://github.com/apache/age/issues/44 Basically if you wrap the map in an array, the first element in the array will be what the property is set to.

wqxs commented 2 years ago

Try to pull the docker image again docker pull apache/age for this bug fix you should be able to restart the session and the bug will be fixed. However, if you can lose the data in the database, I recommend dropping the extension and recreating it.

After using the latest version, the error is fixed, but the Docker mapping directory cannot be used on the latest version of Docker

wqxs commented 2 years ago

Try to pull the docker image again docker pull apache/age for this bug fix you should be able to restart the session and the bug will be fixed. However, if you can lose the data in the database, I recommend dropping the extension and recreating it.

After using the latest version, the error is fixed, but the Docker mapping directory cannot be used on the latest version of Docker

Can an upgrade version be made without affecting the data?

sorrell commented 2 years ago

Try to pull the docker image again docker pull apache/age for this bug fix you should be able to restart the session and the bug will be fixed. However, if you can lose the data in the database, I recommend dropping the extension and recreating it.

After using the latest version, the error is fixed, but the Docker mapping directory cannot be used on the latest version of Docker

Can you describe what mapping directory this is or share the exact error you are seeing?