GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Match with order by can not return the node · Issue #189 · apache/age

Match with order by can not return the node  #189

New issue
Copy link
New issue
Copy link
Closed
Closed
Match with order by can not return the node #189
Copy link
Labels
bugSomething isn't working

Description

@kevintruong
kevintruong
opened on Feb 19, 2022
Issue body actions

Describe the bug
A clear and concise description of what the bug is.

How are you accessing AGE (Command line, driver, etc.)?

  • [e.g. JDBC]

What data setup do we need to do?

SELECT * from cypher('agegraph', $$ MATCH (n) RETURN n $$) as (n agtype);
+-----------------------------------------------------------------------+
| n                                                                    |
|-----------------------------------------------------------------------|
| {"id": 281474976710662, "label": "", "properties": {"id": 1}}::vertex |
| {"id": 281474976710663, "label": "", "properties": {"id": 2}}::vertex |
| {"id": 281474976710664, "label": "", "properties": {"id": 3}}::vertex |
+-----------------------------------------------------------------------+

...

What is the necessary configuration info needed?

  • [e.g. Installed PostGIS]

What is the command that caused the error?

memflask_dev> SELECT * from cypher('agegraph', $$ MATCH (n) ORDER BY n.id RETURN n $$) as (n agtype);

syntax error at or near "ORDER"
LINE 1: SELECT * from cypher('agegraph', $$ MATCH (n) ORDER BY n.id ...```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**
- Version: [e.g. 0.7.0]

**Additional context**
Add any other context about the problem here.

Activity

  1. kevintruong
    added
    bugSomething isn't working
    on Feb 19, 2022
  2. jberzy commented on Feb 19, 2022

    @jberzy
    jberzy
    on Feb 19, 2022
    Contributor
    More actions

    I believe order by is just a sub-clause of a projection clause i.e. return or with. Try placing order by clause after the return clause.

    Reacted by John Gemignani
  3. kevintruong commented on Feb 19, 2022

    @kevintruong
    kevintruong
    on Feb 19, 2022
    Author
    More actions
    SELECT * from cypher('agegraph', $$ MATCH (n) RETURN n ORDER BY n.id $$) as (n agtype);
    

    Tried, but still not work . Thanks for your rsp

  4. kevintruong commented on Feb 19, 2022

    @kevintruong
    kevintruong
    on Feb 19, 2022
    Author
    More actions

    Ok. got it

    Note that you cannot sort on nodes or relationships, just on properties on these. ORDER BY relies on comparisons to sort the output, see Ordering and comparison of values.
    
  5. kevintruong
    closed this as completedon Feb 19, 2022
  6. jrgemignani
    reopened this on Feb 22, 2022
  7. jrgemignani commented on Feb 22, 2022

    @jrgemignani
    jrgemignani
    on Feb 22, 2022
    Contributor
    More actions
    SELECT * from cypher('agegraph', $$ MATCH (n) RETURN n ORDER BY n.id $$) as (n agtype);
    

    Tried, but still not work . Thanks for your rsp

    This does work. What version of AGE are you using?

    `psql-11.5-5432-pgsql=# SELECT * from cypher('cypher_vle', $$ MATCH (u) return u $$) as (result agtype);
    result

    {"id": 844424930131972, "label": "begin", "properties": {"id": 100, "name": "vertex 100"}}::vertex
    {"id": 1407374883553290, "label": "middle", "properties": {"id": 2, "name": "vertex 2"}}::vertex
    {"id": 1407374883553291, "label": "middle", "properties": {"id": 3, "name": "vertex 3"}}::vertex
    {"id": 1407374883553292, "label": "middle", "properties": {}}::vertex
    {"id": 1688849860263940, "label": "end", "properties": {}}::vertex
    (5 rows)

    psql-11.5-5432-pgsql=# SELECT * from cypher('cypher_vle', $$ MATCH (u) RETURN u ORDER BY u.id $$) as (result agtype);
    result

    {"id": 1407374883553290, "label": "middle", "properties": {"id": 2, "name": "vertex 2"}}::vertex
    {"id": 1407374883553291, "label": "middle", "properties": {"id": 3, "name": "vertex 3"}}::vertex
    {"id": 844424930131972, "label": "begin", "properties": {"id": 100, "name": "vertex 100"}}::vertex
    {"id": 1407374883553292, "label": "middle", "properties": {}}::vertex
    {"id": 1688849860263940, "label": "end", "properties": {}}::vertex
    (5 rows)

    psql-11.5-5432-pgsql=# SELECT * from cypher('cypher_vle', $$ MATCH (u) RETURN u ORDER BY u.id DESC $$) as (result agtype);
    result

    {"id": 1407374883553292, "label": "middle", "properties": {}}::vertex
    {"id": 1688849860263940, "label": "end", "properties": {}}::vertex
    {"id": 844424930131972, "label": "begin", "properties": {"id": 100, "name": "vertex 100"}}::vertex
    {"id": 1407374883553291, "label": "middle", "properties": {"id": 3, "name": "vertex 3"}}::vertex
    {"id": 1407374883553290, "label": "middle", "properties": {"id": 2, "name": "vertex 2"}}::vertex
    (5 rows)

    psql-11.5-5432-pgsql=# SELECT * from cypher('cypher_vle', $$ MATCH (u) RETURN u ORDER BY u.name $$) as (result agtype);
    result

    {"id": 844424930131972, "label": "begin", "properties": {"id": 100, "name": "vertex 100"}}::vertex
    {"id": 1407374883553290, "label": "middle", "properties": {"id": 2, "name": "vertex 2"}}::vertex
    {"id": 1407374883553291, "label": "middle", "properties": {"id": 3, "name": "vertex 3"}}::vertex
    {"id": 1407374883553292, "label": "middle", "properties": {}}::vertex
    {"id": 1688849860263940, "label": "end", "properties": {}}::vertex
    (5 rows)

    psql-11.5-5432-pgsql=# SELECT * from cypher('cypher_vle', $$ MATCH (u) RETURN u ORDER BY u.name DESC $$) as (result agtype);
    result

    {"id": 1407374883553292, "label": "middle", "properties": {}}::vertex
    {"id": 1688849860263940, "label": "end", "properties": {}}::vertex
    {"id": 1407374883553291, "label": "middle", "properties": {"id": 3, "name": "vertex 3"}}::vertex
    {"id": 1407374883553290, "label": "middle", "properties": {"id": 2, "name": "vertex 2"}}::vertex
    {"id": 844424930131972, "label": "begin", "properties": {"id": 100, "name": "vertex 100"}}::vertex
    (5 rows)

    psql-11.5-5432-pgsql=#
    `

  8. jrgemignani
    closed this as completedon Apr 11, 2022
  9. dehowef
    added a commit that references this issue on Feb 21, 2024

    Implement list comprehension (#1610)

    3b2b394
  10. Zainab-Saad
    added a commit that references this issue on Mar 6, 2024

    Implement list comprehension (apache#1610)

    81b9fba
  11. dehowef
    added 4 commits that reference this issue on Apr 9, 2024

    Implement list comprehension (#1736)

    c967c64

    Implement list comprehension (#1737)

    64b509d

    Implement list comprehension (#1738)

    080126f

    Implement list comprehension (#1739)

    a69e5a2
  12. WendelLana
    added a commit that references this issue on Apr 17, 2024

    Added integer conversion in toBoolean functions

    c36fa06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.