Output serialization for strings seems to be incorrect at times
- Dominant language
- C
- Stars
- 4.8k
- Forks
- 523
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
Output serialization for strings seems to be incorrect at times.
**How are you accessing AGE (Command line, driver, etc.)?**
With `psql` from the docker image. One container for the server and another one for the client.
**What data setup do we need to do?**
```sql
select * from ag_catalog.create_graph('g');
```
**What is the necessary configuration info needed?**
Just the docker image built from master branch.
**What is the command that caused the error?**
```sql
postgres=# SELECT * FROM ag_catalog.cypher('g', $$ with { id: 42, label: "label_name", properties: {} }::vertex as v return { a: "ASDF", v: v } $$) AS (c ag_catalog.agtype);
c
---------------------------------------------------------------------------------
{"a": "ASDF", "v": {"id": 42, "label": "label_name", "properties": {}}::vertex}
(1 row)
postgres=# SELECT * FROM ag_catalog.cypher('g', $$ with { id: 42, label: "label_name", properties: {} }::vertex as v return { z: "asdf", v: v } $$) AS (c ag_catalog.agtype);
c
-----------------------------------------------------------------------------
{"v": {"id": 42, "label": "label_name", "properties": {}}::vertex, "z": ""}
(1 row)
postgres=# SELECT * FROM ag_catalog.cypher('g', $$ with { id: 42, label: "label_name", properties: {} }::vertex as v return { a: "ASDF", z: "asdf", v: v } $$) AS (c ag_catalog.agtype);
c
----------------------------------------------------------------------------------------------
{"a": "ASDF", "v": {"id": 42, "label": "label_name", "properties": {}}::vertex, "z": " asd"}
(1 row)
```
The first query in the above listing is correct while the last two serialize `"z"` incorrectly.
Note that `"a"` seems to be serialized correctly, so the order wrt the vertex `"v"` seems to be relevant here.
Similarly for edges:
```sql
postgres=# SELECT * FROM ag_catalog.cypher('g', $$ with { id: 42, start_id: 42, end_id: 42, label: "label_name", properties: {} }::edge as e return { a: "ASDF", e: e } $$) AS (c ag_catalog.agtype);
c
-------------------------------------------------------------------------------------------------------------
{"a": "ASDF", "e": {"id": 42, "label": "label_name", "end_id": 42, "start_id": 42, "properties": {}}::edge}
(1 row)
postgres=# SELECT * FROM ag_catalog.cypher('g', $$ with { id: 42, start_id: 42, end_id: 42, label: "label_name", properties: {} }::edge as e return { z: "asdf", e: e } $$) AS (c ag_catalog.agtype);
c
---------------------------------------------------------------------------------------------------------
{"e": {"id": 42, "label": "label_name", "end_id": 42, "start_id": 42, "properties": {}}::edge, "z": ""}
(1 row)
postgres=# SELECT * FROM ag_catalog.cypher('g', $$ with { id: 42, start_id: 42, end_id: 42, label: "label_name", properties: {} }::edge as e return { a: "ASDF", z: "asdf", e: e } $$) AS (c ag_catalog.agtype);
c
--------------------------------------------------------------------------------------------------------------------------
{"a": "ASDF", "e": {"id": 42, "label": "label_name", "end_id": 42, "start_id": 42, "properties": {}}::edge, "z": " asd"}
(1 row)
```
**Expected behavior**
All of the strings should be serialized correctly.
**Environment (please complete the following information):**
- env: docker
- branch: master
- commit: 5ded59f
Contributor guide
Assessment
This issue has not been assessed yet.