You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by GitBox <gi...@apache.org> on 2022/05/26 03:34:25 UTC
[GitHub] [incubator-age] jihot2000 opened a new issue, #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
jihot2000 opened a new issue, #223:
URL: https://github.com/apache/incubator-age/issues/223
When I was just getting into AGE, I wrote a mixed SQL statement. It caused the server crash. But I don't know why.
Here, I write the SQL statement into a sql file. You can execute the file using ```psql``` command line.
```sql
CREATE SCHEMA test01;
SET search_path = test01, ag_catalog, "$user";
SELECT create_graph('mygraph');
SELECT create_vlabel('mygraph', 'node');
SELECT * FROM cypher('mygraph', $$
CREATE (:node {name: 'a'})
$$) AS (a agtype) WHERE NOT EXISTS (
SELECT * FROM cypher('mygraph', $$
MATCH (v:node {name: 'a'})
RETURN v
$$) AS (b agtype)
);
SELECT drop_graph('mygraph', true);
DROP SCHEMA test01 CASCADE;
```
The output is
```
...
psql:xx.sql:17: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
psql:xx.sql:17: fatal: connection to server was lost
...
```
Does my SQL file has an illegal SQL or OpenCypher grammar?
PS:
Now, I know MERGE clause can create an entity when it does not exist. But, it is still difficult to write when the condition is complicated.
I've tested the sql file in PostgreSQL 11 and AGE commit id 12edd3e .
--
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: dev-unsubscribe@age.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] jrgemignani commented on issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #223:
URL: https://github.com/apache/age/issues/223#issuecomment-1180868685
I don't see how the following is more complicated than what was put above -
MERGE (u:node {name: 'a'}) RETURN u;
I checked and, neither Neo4j nor AGE currently allow a syntax like (or similar in function to) the command that crashed above, except as MERGE. It is true that we will need to look and correct that crash. But, what you defined above is exactly MERGE, without all of the extra SQL.
The WHERE clause, on the other hand, is not currently supported in conjunction with CREATE or MERGE in AGE. We will need to look into that.
Hope 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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] jrgemignani commented on issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #223:
URL: https://github.com/apache/age/issues/223#issuecomment-1180836731
I will take a look
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] jihot2000 commented on issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
Posted by GitBox <gi...@apache.org>.
jihot2000 commented on issue #223:
URL: https://github.com/apache/age/issues/223#issuecomment-1184978323
Yes. It is difficult for AGE to detect the weird usage as the two cypher statements are in different parts of a single SQL.
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] jihot2000 closed issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
Posted by GitBox <gi...@apache.org>.
jihot2000 closed issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
URL: https://github.com/apache/age/issues/223
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] jrgemignani commented on issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #223:
URL: https://github.com/apache/age/issues/223#issuecomment-1184630482
As I stated above, we will need to address that crash.
Your command isn't syntactically incorrect, but the usage of some command like CREATE (blah) WHERE NOT EXISTS (MATCH (blah)) is not valid in either AGE or Neo4j - it will generate a syntax error - at least as far as I could tell.
The difference here is that you wrapped the two parts (create & match) into two separate cypher queries and glued them together with SQL's WHERE NOT EXISTS. That is legal and the two command separately are also legal. However, for whatever reason - and we will need to address it - they don't play well together.
Unfortunately, making that generate a syntax error isn't necessarily easy because they are separately valid commands AND we have no access to the PG parser.
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] jihot2000 commented on issue #223: "CREATE ... WHERE NOT EXISTS MATCH..." caused the server crash
Posted by GitBox <gi...@apache.org>.
jihot2000 commented on issue #223:
URL: https://github.com/apache/age/issues/223#issuecomment-1181047196
I have used MERGE to replace CREATE ... WHERE. After all, psql did not complain that the grammar was illegalI. So I opened this issue to indicate that. It would be better to tell the user via an exception that the WHERE clause is not supported for CREATE now.
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org