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

Parsing failure in extended query protocol #28

Closed
emotionbug opened this issue Mar 2, 2021 · 13 comments
Closed

Parsing failure in extended query protocol #28

emotionbug opened this issue Mar 2, 2021 · 13 comments

Comments

@emotionbug
Copy link
Contributor

Hello.

i trying to use AGE with JDBC.

and, i faced failure when Message Flow is extended query mode with CREATE clause.
has any solution with this issue or guide?

cheers.

failure query

SELECT * from cypher('my_graph_name', $$
  CREATE (a:Part {part_num: '123'}), 
         (b:Part {part_num: '345'}), 
         (c:Part {part_num: '456'}), 
         (d:Part {part_num: '789'})
$$) as (a agtype);

error message

Type : Error
Length : 98
Severity: ERROR
Code: XX000
Message: unrecognized node type : -1944838080
File : copyfuncs.c
Line: 5658
Routine: copyObjectImpl

environment
Docker : sorrell/agensgraph-extension-alpine

Cheers.

reference link : https://www.postgresql.org/docs/12/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY

@JoshInnis
Copy link
Contributor

Hello,

Judging from the reference link you attached, I am assuming you are using prepared statements in Postgres' JDBC driver. Is this correct?

Unfortunately, the CREATE clause is not currently compatible with prepared statements, even if there are no params passed to the Cypher section of the query. We are looking to add this feature in future releases.

@emotionbug
Copy link
Contributor Author

Yes, but it just happened on statement too.
because, Postgres JDBC's default Message Flow is extended mode.
not in Simple query mode like Node.js or Python.

OK. thank you for replying. :)

@jrgemignani
Copy link
Contributor

jrgemignani commented Mar 2, 2021 via email

@jrgemignani
Copy link
Contributor

jrgemignani commented Mar 2, 2021 via email

@Remi-C
Copy link

Remi-C commented Mar 24, 2021

Having the same problem folks.
I'm using the Open source DBeaver to run my queries, and I can not create a graph properly.
It works when using psql though.
DBeaver also works when running data querying that does not involves changing the data.
This is a big problem for us, as our users won't use the command line / psql under any circumstances.

Workaround : I'm thinking about writing a wrapper in Plpython that runs query inside a bash terminal.
That is pretty ugly though.

@JoshInnis
Copy link
Contributor

Hi Remi,

This issue is about creating vertices and edges. Is that the issue you are having or can you not create a graph at all in DBeaver?

@Remi-C
Copy link

Remi-C commented Mar 24, 2021

Hey @JoshInnis , thanks for answering :-)
I just followed exactly the query from the doc:

SELECT * from cypher('my_graph_name', $$
  CREATE (a:Part {part_num: '123'}), 
        (b:Part {part_num: '345'}), 
        (c:Part {part_num: '456'}), 
        (d:Part {part_num: '789'})
$$) as (a agtype);

The previous queries worked fine (create extension, set search path, create graph object, ...)

@JoshInnis
Copy link
Contributor

We are working on a fix for this right now. I was able to recreate the issue with DBeaver and will test to verify the fix works there as well.

@Remi-C
Copy link

Remi-C commented Mar 24, 2021

Wow you work fast folks !
I was very interested by the seminar today, I'm super curious to use this extension with medium to large graphs and see what I can do with it.

@JoshInnis
Copy link
Contributor

Hi @emotionbug the JDBC driver is now compatible with Prepared Statements.

@Remi-C, we also tested on DBeaver and the patch should make that compatible to. Btw, glad to hear you enjoyed the presentation.

@Remi-C
Copy link

Remi-C commented Apr 1, 2021

Thanks @JoshInnis !
Can I simply pull on master to try it, or do I have to use a specific branch / tag?

@JoshInnis
Copy link
Contributor

Currently this patch is only in master.

@emotionbug
Copy link
Contributor Author

emotionbug commented Apr 1, 2021

I tested it then, this issue is solved.

Thanks @JoshInnis and, @jrgemignani.

Zainab-Saad added a commit to Zainab-Saad/age that referenced this issue Oct 7, 2023
code changes done to reflect this change are:

 * Modify the SQL function -  _agtype_build_edge to include start and end vertex
   label ids and names in edge object

 * Modify executor, age_vle and edge typecasting to pass label id and name
   when constructing the edge object or retrieve these values while unpacking
   an edge

 * Update MATCH to work without using _extract_label_id (removed this function)

Update the regression tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants