age icon indicating copy to clipboard operation
age copied to clipboard

Attribute values of object types cannot be modified

Open wqxs opened this issue 2 years ago • 13 comments

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

wqxs avatar Jul 09 '22 08:07 wqxs

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)

JoshInnis avatar Jul 11 '22 06:07 JoshInnis

嗨,正在将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

wqxs avatar Jul 11 '22 06:07 wqxs

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)

JoshInnis avatar Jul 11 '22 07:07 JoshInnis

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

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

wqxs avatar Jul 11 '22 07:07 wqxs

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

image

JoshInnis avatar Jul 11 '22 07:07 JoshInnis

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

image

How to query the version

wqxs avatar Jul 11 '22 07:07 wqxs

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?

JoshInnis avatar Jul 11 '22 07:07 JoshInnis

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

wqxs avatar Jul 11 '22 07:07 wqxs

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 avatar Jul 11 '22 07:07 JoshInnis

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.

JoshInnis avatar Jul 11 '22 08:07 JoshInnis

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 avatar Jul 11 '22 08:07 wqxs

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?

wqxs avatar Jul 11 '22 08:07 wqxs

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?

sorrell avatar Jul 11 '22 23:07 sorrell