Skip to content

fixes #2091 | Fixing PG driver portal#2114

Closed
ExtReMLapin wants to merge 9 commits into
ArcadeData:mainfrom
ExtReMLapin:portal_fixes_pg_driver
Closed

fixes #2091 | Fixing PG driver portal#2114
ExtReMLapin wants to merge 9 commits into
ArcadeData:mainfrom
ExtReMLapin:portal_fixes_pg_driver

Conversation

@ExtReMLapin

@ExtReMLapin ExtReMLapin commented Mar 31, 2025

Copy link
Copy Markdown
Contributor

fixes #2091 (Same query causing an error)
fixes #2114 (comment)

fixes #2117

@robfrank

Copy link
Copy Markdown
Collaborator

May you add your python code as test in https://github.com/ArcadeData/arcadedb/tree/main/e2e-python/tests ?
These tests are using testconainers https://testcontainers-python.readthedocs.io/en/latest/ and are executed on every build

@ExtReMLapin

Copy link
Copy Markdown
Contributor Author

I started writing tests but for some reasons

  • random_num = random.randint(1, 2**16) no error because no repetition
  • random_num = random.randint(1, 1) no error, systematic repetition
  • random_num = random.randint(1, 2) error, high repetition

@ExtReMLapin

ExtReMLapin commented Apr 2, 2025

Copy link
Copy Markdown
Contributor Author

pg driver is still broken even with thoses fixes, if someone has the willing to fix it, here are more tests that fails :

import psycopg

db_string_test = 'TEST'
import random
with psycopg.connect(user="root", password="rootroot",
                    host='localhost',
                    port='5432',
                    dbname=db_string_test,
                    sslmode='disable'
                    ) as connection:
    
    connection.autocommit = True
    try_count = 128

    with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
        for _ in range(try_count):
            params = {'select_value': random.randint(0,16)}
            query = "SELECT %(select_value)s as out"
            cursor.execute(query, params)
            result = cursor.fetchone()
            assert result["out"] == params['select_value'], f'[SQL] Expected {params["select_value"]} got {result["out"]}'
    print('sql param works')


    with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
        for _ in range(try_count):
            params = {'select_value': random.randint(0,16)}
            query = "{sqlscript}SELECT %(select_value)s as out"
            cursor.execute(query, params)
            result = cursor.fetchone()
            assert result["out"] == params['select_value'], f'[SQLScript] Expected {params["select_value"]} got {result["out"]}'
    print('sqlscript param works')

    with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
        for _ in range(try_count):
            params = {'select_value': random.randint(0,16)}
            query = '{cypher}return $select_value as out'
            cursor.execute(query, params)
            ret = cursor.fetchone()
            assert result["out"] == params['select_value'], f'[CYPHER] Expected {params["select_value"]} got {result["out"]}'


    print('cypher param works')

@robfrank robfrank self-assigned this Apr 6, 2025
@robfrank robfrank added this to the 25.4.1 milestone Apr 6, 2025
@robfrank robfrank requested a review from Copilot April 14, 2025 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

postgresw/src/main/java/com/arcadedb/postgres/PostgresNetworkExecutor.java:605

  • Verify that sourcePortal is not null before copying its properties to avoid a potential NullPointerException. Consider adding an explicit null-check or fallback mechanism.
PostgresPortal sourcePortal = getPortal(sourcePreparedStatement, false);

Comment on lines +438 to +439
System.out.println("ResultSet is null");
return columns; // Return empty columns instead of throwing NPE

Copilot AI Apr 14, 2025

Copy link

Choose a reason for hiding this comment

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

Consider replacing the System.out.println with a proper logging mechanism to maintain consistency with the rest of the codebase.

Suggested change
System.out.println("ResultSet is null");
return columns; // Return empty columns instead of throwing NPE
logger.warning("ResultSet is null");

Copilot uses AI. Check for mistakes.
Comment thread e2e-python/tests/test_arcadedb.py Outdated
Comment thread postgresw/src/main/java/com/arcadedb/postgres/PostgresNetworkExecutor.java Outdated
@robfrank robfrank force-pushed the portal_fixes_pg_driver branch from f17ffb3 to dac6db4 Compare April 15, 2025 07:29
@ExtReMLapin

Copy link
Copy Markdown
Contributor Author

thanks for the help on this @robfrank, we're out of "free time" to allocate on open source at the office

@robfrank

Copy link
Copy Markdown
Collaborator

@ExtReMLapin this doesn't fix the issue, yet. On java side, there's a problem with parameters that I'm trying to solve. Long story short, the problem is in the chyper to gremlin translation and the way JDBC defines the params. A sort of nightmare.

Anyway, thank you for the effort!

@robfrank robfrank modified the milestones: 25.4.1, 25.5.1 Apr 22, 2025
@lvca lvca modified the milestones: 25.5.1, 25.6.1 May 30, 2025
@lvca

lvca commented Jul 4, 2025

Copy link
Copy Markdown
Member

Can I close this PR?

@lvca lvca closed this Jul 4, 2025
@lvca lvca reopened this Jul 4, 2025
@lvca

lvca commented Jul 4, 2025

Copy link
Copy Markdown
Member

@ExtReMLapin does this PR fixes your issues?

fixes #2091 (Same query causing an error)
fixes #2114 (comment)
fixes #2117

@robfrank why this doesn't solve the issues for you?

@lvca lvca added the bug label Jul 4, 2025
@lvca lvca modified the milestones: 25.6.1, 25.7.1 Jul 4, 2025
@ExtReMLapin

Copy link
Copy Markdown
Contributor Author

A the time (and right now as well) I wrote this PR my PG protocol knowledge was limited, we could at least keep the tests I guess

just in case

@ExtReMLapin

ExtReMLapin commented Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

@lvca from memory this PR itself isn't the right solutions but the tests inside are right.

Since @robfrank also added commits I could be wrong

For example, as of today on 25.5.1 #2114 (comment) this code is still showing it's not working, did not test on this branch code, just on master with latest release

@robfrank

robfrank commented Jul 7, 2025

Copy link
Copy Markdown
Collaborator

@ExtReMLapin I added, in python-e2e, some tests with parametric queries too: https://github.com/ArcadeData/arcadedb/blob/main/e2e-python/tests/test_arcadedb.py (

def test_psycopg2_with_named_parameterized_query():
) and these tests are green.

If you have a failing test, please add it to the test suite, in that way it is easier for us to execute them and analyze them.

@robfrank

Copy link
Copy Markdown
Collaborator

Added a test on python test suite with parametrized cypher query. Note, parameters should be written in "python/pg" syntax, e.g.: {cypher} MATCH (b:Beer) WHERE b.name =%(name)s RETURN b

@robfrank robfrank closed this Aug 11, 2025
robfrank added a commit that referenced this pull request Aug 21, 2025
mergify Bot added a commit that referenced this pull request Jun 7, 2026
…5 [skip ci]

Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.14 to 0.8.15.
Release notes

*Sourced from [org.jacoco:jacoco-maven-plugin's releases](https://github.com/jacoco/jacoco/releases).*

> 0.8.15
> ------
>
> New Features
> ------------
>
> * JaCoCo now officially supports Java 26 (GitHub [#2076](https://redirect.github.com/jacoco/jacoco/issues/2076)).
> * Experimental support for Java 27 class files (GitHub [#2004](https://redirect.github.com/jacoco/jacoco/issues/2004)).
> * Compatibility methods generated by Kotlin compiler for functions defined in interfaces are filtered out during generation of report (GitHub [#1905](https://redirect.github.com/jacoco/jacoco/issues/1905)).
> * Compatibility methods generated by Kotlin compiler for exposed boxed inline value classes (JvmExposeBoxed annotation) are filtered out during generation of report (GitHub [#1944](https://redirect.github.com/jacoco/jacoco/issues/1944)).
> * Methods generated by the Kotlin compiler for functions with JvmStatic annotation are filtered out during generation of report (GitHub [#2097](https://redirect.github.com/jacoco/jacoco/issues/2097)).
> * Improved filtering of bytecode generated by Kotlin compiler for when expressions and statements with kotlin.String subject where first branch condition contains string with largest hash (GitHub [#2098](https://redirect.github.com/jacoco/jacoco/issues/2098)).
> * Part of bytecode that javac versions from 24 to 26 generate for switch statements and expressions with selector expression of type java.lang.String inside lambdas is filtered out during generation of report (GitHub [#2023](https://redirect.github.com/jacoco/jacoco/issues/2023)).
> * Improved performance of Kotlin files analysis by parsing SMAPs only once per class (GitHub [#2114](https://redirect.github.com/jacoco/jacoco/issues/2114)).
> * For better performance agent output methods tcpclient and tcpserver use BufferedOutputStream to write execution data to socket. Maven plugin, Ant tasks, CLI, API usage examples, and ExecDumpClient API use BufferedInputStream to read execution data from socket. Third-party integrations should do the same to benefit from this change in agent (GitHub [#2089](https://redirect.github.com/jacoco/jacoco/issues/2089)).
>
> Fixed bugs
> ----------
>
> * Fixed processing of Kotlin SMAP in synthetic classes (GitHub [#1985](https://redirect.github.com/jacoco/jacoco/issues/1985)).
> * Multiple JaCoCo runtimes within one JVM writing to the same output file should not cause data corruption when running on JDK versions from 6 to 10 affected by [JDK-8166253](https://bugs.openjdk.org/browse/JDK-8166253) (GitHub [#2065](https://redirect.github.com/jacoco/jacoco/issues/2065), [#2074](https://redirect.github.com/jacoco/jacoco/issues/2074)).
> * For better performance agent writes to output file via BufferedOutputStream, this fixes regression introduced in version 0.6.2 (GitHub [#2073](https://redirect.github.com/jacoco/jacoco/issues/2073)).
> * Fixed NullPointerException when JaCoCo agent is loaded by non system class loader, for example when loaded by JBoss Modules (GitHub [#1651](https://redirect.github.com/jacoco/jacoco/issues/1651)).
>
> Non-functional Changes
> ----------------------
>
> * JaCoCo now depends on ASM 9.10.1 (GitHub [#2134](https://redirect.github.com/jacoco/jacoco/issues/2134)).


Commits

* [`6c5260a`](jacoco/jacoco@6c5260a) Prepare release v0.8.15
* [`5c05141`](jacoco/jacoco@5c05141) Transfer of execution data through socket should use buffered stream ([#2089](https://redirect.github.com/jacoco/jacoco/issues/2089))
* [`ab5efa9`](jacoco/jacoco@ab5efa9) Remove from Azure Pipelines all builds except with JDK 5 and JDK EA ([#2148](https://redirect.github.com/jacoco/jacoco/issues/2148))
* [`5f6ea38`](jacoco/jacoco@5f6ea38) Use Windows 2025 image in GitHub Actions ([#2130](https://redirect.github.com/jacoco/jacoco/issues/2130))
* [`35a8af2`](jacoco/jacoco@35a8af2) Use Renovate instead of Dependabot for updates of ASM ([#2137](https://redirect.github.com/jacoco/jacoco/issues/2137))
* [`85b8ddf`](jacoco/jacoco@85b8ddf) Upgrade ASM to 9.10.1 ([#2134](https://redirect.github.com/jacoco/jacoco/issues/2134))
* [`2988647`](jacoco/jacoco@2988647) AgentModule should use ClassLoader of agent instead of SystemClassLoader ([#1651](https://redirect.github.com/jacoco/jacoco/issues/1651))
* [`75a4e31`](jacoco/jacoco@75a4e31) Add filter for Kotlin `@JvmExposeBoxed` ([#1944](https://redirect.github.com/jacoco/jacoco/issues/1944))
* [`691fa1d`](jacoco/jacoco@691fa1d) Use Renovate instead of Dependabot for updates of GitHub Actions ([#2132](https://redirect.github.com/jacoco/jacoco/issues/2132))
* [`3e18f17`](jacoco/jacoco@3e18f17) Require at least JDK 21 for build ([#2128](https://redirect.github.com/jacoco/jacoco/issues/2128))
* Additional commits viewable in [compare view](jacoco/jacoco@v0.8.14...v0.8.15)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.jacoco:jacoco-maven-plugin&package-manager=maven&previous-version=0.8.14&new-version=0.8.15)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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.

[PG DRIVER] When using sqlscript : Cannot invoke "java.util.List.iterator()" because "resultSet" is null [Postgres driver] sending 5 queries = error

4 participants