Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should there be a proper error message when using RETURN * without any variable in scope ? #1030

Open
MuhammadTahaNaveed opened this issue Jul 13, 2023 · 8 comments
Labels
override-stale To keep issues/PRs untouched from stale action question Further information is requested

Comments

@MuhammadTahaNaveed
Copy link
Member

For the question above, neo4j returns the following error

MATCH () RETURN *
ERROR: RETURN * is not allowed when there are no variables in scope

But age generates

ERROR:  return row and column definition list do not match

Should we also generate a proper error message in transformation stage catching this invalid use ?

@MuhammadTahaNaveed MuhammadTahaNaveed added the question Further information is requested label Jul 13, 2023
@talhahahae
Copy link

Displaying proper error messages indicating a specific problem is helpful in debugging the code and solving the issue easily and efficiently. Since it enhances the user experience a proper error message indicating the main reason why it occurred should be displayed for the said command.

@RahimullahShaheen
Copy link
Contributor

I suppose the complete query that you have run and has caused the error is as below.

SELECT * FROM cypher('graph', $$
    MATCH ()
    RETURN *                                                                  
$$) AS (v agtype);

The error is not because of the RETURN clause. It is because of the mismatch of number of columns returned by the cypher query (MATCH()) and the number of columns defined in the column definition list (v agtype). The match() clause return no column while there is one column defined in column definition list (v agtype). There is mismatch of column therefore you have encountered the error.

Basically in age there is a function by the name of analyze_cypher_and_coerce which is responsible for comparing the number of columns defined in the column definition list with the number of columns returned by the analyzed query. If the number of columns do not match then it will throw the error 'row and column definition list do not match'.
So according to the cause of the error this error message make sense.

The following query also cause the same error:

SELECT * FROM cypher('emp_graph', $$
    MATCH (v:employee)
    RETURN v.name                                                                  
$$) AS (v agtype, x agtype);

Error messages are always generalized.

@rafsun42
Copy link
Member

There are other places where error messages are not proper. For example, when age_load tries loading vertices into a non-existing label, it throws 'label id must between x and y,' instead of saying 'label does not exist'.

I think a project can be created to rewrite some of these error messages from end users point of view.

@M4rcxs
Copy link
Contributor

M4rcxs commented Jul 19, 2023

It's a good idea to rewrite some error messages in AGE. I have also encountered issues while coding and debugging agtype.c. Some errors need to be more detailed and descriptive to provide better guidance for troubleshooting and resolving problems effectively.

When I tried to use the function that I developed toFloatList() I wasted a lot of time trying to solve erros in the code, but the error was in the cypher query

@titoausten
Copy link

The error: "Return row and column definition list do not match." occurs when the number of values returned does not match the expected output defined by the RETURN clause. Hence it's appropriate for that query.

However, there are other cases in AGE where generating specific errors would help users easily understand the cause of errors. Hence, I think there should be a project for that.

@jrgemignani
Copy link
Contributor

I think that we should attempt to fix, or align, our messages with, say, Neo4j, where it is necessary or makes sense.

@jrgemignani
Copy link
Contributor

@MuhammadTahaNaveed Is this still an issue or can this be closed?

Copy link

This issue is stale because it has been open 60 days with no activity. Remove "Abondoned" label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale Stale issues/PRs label Jun 17, 2024
@MuhammadTahaNaveed MuhammadTahaNaveed added override-stale To keep issues/PRs untouched from stale action and removed Stale Stale issues/PRs labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
override-stale To keep issues/PRs untouched from stale action question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants