Skip to content

fixed offset logic in psycopg parametersCypher array, fixes #2657#2658

Merged
robfrank merged 2 commits intoArcadeData:mainfrom
ExtReMLapin:fix_cypher_param
Oct 15, 2025
Merged

fixed offset logic in psycopg parametersCypher array, fixes #2657#2658
robfrank merged 2 commits intoArcadeData:mainfrom
ExtReMLapin:fix_cypher_param

Conversation

@ExtReMLapin
Copy link
Contributor

fixes #2657

To be frank, considering the "complexity" of the commit, I just tested it, didn't bother running all tests

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ExtReMLapin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug related to the construction of parameter arrays for Cypher queries executed through the PostgreSQL interface. The change ensures that parameters are correctly mapped and passed, preventing potential issues with query execution due to incorrect data indexing. This fix directly addresses the problem described in issue #2657.

Highlights

  • Cypher Parameter Array Fix: Corrected an indexing error in the getParams method when constructing the parametersCypher array for Cypher language queries, specifically addressing an offset logic issue.
  • Correct Parameter Pairing: Ensured that parameter names and their corresponding values are correctly paired and assigned within the parametersCypher array by adjusting the array indices from i and i + 1 to i * 2 and i * 2 + 1.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a critical bug in the construction of parameters for Cypher queries via the PostgreSQL protocol. The previous logic incorrectly indexed the parameter array, causing parameters to be overwritten. The fix corrects the index calculation, ensuring that all parameters are correctly passed. The change is correct and effectively resolves the issue. I've added one minor suggestion to improve code clarity by using String.valueOf() for type conversion.

@ExtReMLapin
Copy link
Contributor Author

To be frank, the less modifications I have, the better I feel, not sure if the gemini suggestions are good or not, as either way it wasn't there before I commited, and it probably had the opportunity to give those suggestions to the previous commiter.

@robfrank
Copy link
Collaborator

do you think we can add a test on https://github.com/ArcadeData/arcadedb/blob/main/e2e-python/tests/test_arcadedb.py to enrich the suite? Or it's so minor that is covered by actual tests?

@ExtReMLapin
Copy link
Contributor Author

ExtReMLapin commented Oct 15, 2025

Done

And it reveals another issue :v

psycopg.errors.InternalError_: Error on executing query: class java.lang.Short cannot be cast to class java.lang.String (java.lang.Short and java.lang.String are in module java.base of loader 'bootstrap')

@robfrank
Copy link
Collaborator

The proposed fix has been validated; all tests are passing in the continuous integration (CI) environment.

Please note that the test suite depends on a new Docker image that is built by the CI pipeline, so a local build of the image is required to replicate these results.

To build a fresh image locally without executing all the tests:

mvn clean install -DskipTests -Pdocker

@robfrank robfrank merged commit 6b5b232 into ArcadeData:main Oct 15, 2025
11 of 13 checks passed
@robfrank
Copy link
Collaborator

Thank you very much @ExtReMLapin

@robfrank robfrank added this to the 25.10.1 milestone Oct 15, 2025
robfrank pushed a commit that referenced this pull request Nov 10, 2025
)

Co-authored-by: CNE FICHEPOIL Pierre <pierre-1.fichepoil@gendarmerie.interieur.gouv.fr>
(cherry picked from commit 6b5b232)
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

Successfully merging this pull request may close these issues.

PSYCOPG drivers turns param into null

2 participants