This query should error out (as shown below) rather than terminating the server because you are trying to reference b which is not preserved by the WITH clause. Read more about WITH clause here.
ERROR: could not find rte for b
LINE 1: ...$$ match (a)-[]->(b) with a, count(*) as c return b $$) as (...
^
The server crash was due to a bug that is fixed recently. See this issue https://github.com/apache/age/issues/329. So until now, the newest release that is v1.2.0 doesn't incorporate this fix.
If you want to access b after WITH, you would have to pass it on
SELECT * FROM cypher('test', $$
MATCH (a)-[]->(b)
WITH b,a, count(*) AS c
RETURN b
$$) as (b agtype);
b
-----------------------------------------------------------------------------------------------------------------
{"id": 281474976710659, "label": "", "properties": {"a": [7, 8, 9], "name": "node3", "type": "vertex"}}::vertex
{"id": 281474976710658, "label": "", "properties": {"a": [4, 5, 6], "name": "node2", "type": "vertex"}}::vertex
(2 rows)
If you want to see the changes (i.e error instead of server crash), you would have to pull recent commits from PG12 branch (since you are using postgres 12) and rebuild age.