TropicalPenguin opened a new issue, #328:
URL: https://github.com/apache/age/issues/328
**Describe the bug**
The MATCH query in the following, short test program, is expected to return
the two vertexes labelled "C", along with a 'deps' value == 1 for each.
Instead, no rows are returned by the query.
TLDR:
`CREATE (a:A)-[:incs]->(:C), (a)-[:incs]->(:C) RETURN a`
If we assume ID(a) of the above were 0, the following query should return
two rows:
`MATCH (a:A) WHERE ID(a)=0 WITH a OPTIONAL MATCH
(a)-[:incs]->(c)-[d:incs]-() WITH a,c,COUNT(d) AS deps WHERE deps<=1 RETURN
c,deps`
Substituting the actual ID, AGE gives no results.
**How are you accessing AGE (Command line, driver, etc.)?**
- Golang Driver, Command Line
**What data setup do we need to do?**
Try the following go program:
```go
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
"github.com/rhizome-ai/apache-age-go/age"
)
func main() {
dsn :=
"postgres://postgres:[email protected]:5434/postgres?sslmode=disable"
db, err := sql.Open("postgres", dsn)
if err != nil {
panic(err)
}
graphName := "test"
_, err = age.GetReady(db, graphName)
if err != nil {
panic(err)
}
tx, err := db.Begin()
defer tx.Commit()
if err != nil {
panic(err)
}
// Clear previous test data, if necessary
cursor, err := age.ExecCypher(tx, graphName, 0, "MATCH (n) DETACH
DELETE n")
if err != nil {
panic(err)
}
// Create test data
cursor, err = age.ExecCypher(tx, graphName, 1, "CREATE
(a:A)-[:incs]->(:C), (a)-[:incs]->(:C) RETURN a")
if err != nil {
panic(err)
}
var row []age.Entity
if cursor.Next() {
row, err = cursor.GetRow()
aid := row[0].(*age.Vertex).Id()
// Match against test data
q := fmt.Sprintf("MATCH (a:A) WHERE ID(a)=%d WITH a OPTIONAL
MATCH (a)-[:incs]->(c)-[d:incs]-() WITH a,c,COUNT(d) AS deps WHERE deps<=1
RETURN c,deps", aid)
fmt.Println("Test query:", q)
cursor, err = age.ExecCypher(tx, graphName, 2, q)
if err == nil {
for cursor.Next() {
row, err = cursor.GetRow()
for _, v := range row {
fmt.Println("V", v)
}
}
} else {
fmt.Println("ERROR:", err)
}
}
_, err = tx.Exec(fmt.Sprintf("SELECT drop_graph('%s', true);",
graphName))
if err != nil {
panic(err)
}
}
```
**What is the necessary configuration info needed?**
- N/A
**What is the command that caused the error?**
Snippet from the above short program:
```go
q := fmt.Sprintf("MATCH (a:A) WHERE ID(a)=%d WITH a OPTIONAL
MATCH (a)-[:incs]->(c)-[d:incs]-() WITH a,c,COUNT(d) AS deps WHERE deps<=1
RETURN c,deps", aid)
cursor, err = age.ExecCypher(tx, graphName, 2, q)
```
**Expected behavior**
Running the equivalent cypher queries in redisgraph gives two results: each
vertex labelled "C" and the value 1 for each 'deps'.
**Environment (please complete the following information):**
- Version: 1.0.0
**Additional context**
N/A
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]