Skip to content

dialect(h2): version checks and fixes, tested on H2 1.4.200 to 2.3.232 - #105

Merged
stbischof merged 1 commit into
eclipse-daanse:mainfrom
dbulahov:main261126_1
Nov 26, 2026
Merged

stbischof merged 1 commit into
eclipse-daanse:mainfrom
dbulahov:main261126_1

Conversation

@dbulahov

Copy link
Copy Markdown
Contributor

What does this PR do?

H2 is embedded and serves no connection: the tests load the jar of each
version (1.4.200, 2.0.206, 2.1.214, 2.2.224, 2.3.232) in a class loader
of its own and connect with that version's driver, the dialect built
from the connection. No container is needed.

H2Dialect:

  • paginationGenerator: an offset alone as OFFSET n ROWS; LIMIT -1, written before, every 2.x refuses ("Invalid value -1 for parameter result FETCH"), 2.2.224 too
  • generateBitAggregation, supportsBitAggregation: BIT_*_AGG from 2.0; 1.4 has BIT_AND and BIT_OR only, the other four are refused there
  • generateListAgg: separator and the NULL's stand-in as string literals, a quote in them ended the literal; ON OVERFLOW TRUNCATE from 2.0; 1.4 orders WITHIN GROUP by one expression without NULLS FIRST/LAST, a list in the order of more is refused there
  • cteGenerator: no recursive expression; H2 runs WITH RECURSIVE only with the list of its columns, which a Cte has not
  • generatePercentileDisc: the standard's first value whose cumulative share reaches p, on the sorted ARRAY_AGG; H2's own PERCENTILE_DISC is the nearest of the positions p (n - 1) in every version, 20 for 10 at 0.25 of 10, 20, 30, 40; PERCENTILE_CONT stays H2's own
  • generateRegularExpression: the expression as it is in '(?-u)\A(?:...)\z'; taking its flags out lost s and u, \Q...\E was unquoted, and H2 folds the case beyond ASCII where Java's (?i) does not

Version tests (versions package, -Dintegration.docker=true):

  • H2Versions: a database in memory of an H2 version, a login to it
  • profile h2-versions: maven-dependency-plugin copies the jars into target/h2-versions, only with -Dintegration.docker=true
  • H2PaginationTest, H2BitAggregationTest, H2ListAggTest, H2RecursiveCteTest, H2PercentileTest, H2RegularExpressionTest (rows as Java's Pattern.matches), H2UsersAndRolesTest (no WITH ADMIN OPTION in any version), H2DdlTest (schema, named primary key, constraints added later, descending index, renames, sequence, IF [NOT] EXISTS and CASCADE, read back through the driver's metadata)
  • H2DialectTest: the new percentile and regular expression forms
  • pom: jdbc.record for the test, to create tables with createTable

  H2 is embedded and serves no connection: the tests load the jar of each
  version (1.4.200, 2.0.206, 2.1.214, 2.2.224, 2.3.232) in a class loader
  of its own and connect with that version's driver, the dialect built
  from the connection. No container is needed.

  H2Dialect:
  - paginationGenerator: an offset alone as OFFSET n ROWS; LIMIT -1,
    written before, every 2.x refuses ("Invalid value -1 for parameter
    result FETCH"), 2.2.224 too
  - generateBitAggregation, supportsBitAggregation: BIT_*_AGG from 2.0;
    1.4 has BIT_AND and BIT_OR only, the other four are refused there
  - generateListAgg: separator and the NULL's stand-in as string
    literals, a quote in them ended the literal; ON OVERFLOW TRUNCATE
    from 2.0; 1.4 orders WITHIN GROUP by one expression without NULLS
    FIRST/LAST, a list in the order of more is refused there
  - cteGenerator: no recursive expression; H2 runs WITH RECURSIVE only
    with the list of its columns, which a Cte has not
  - generatePercentileDisc: the standard's first value whose cumulative
    share reaches p, on the sorted ARRAY_AGG; H2's own PERCENTILE_DISC
    is the nearest of the positions p (n - 1) in every version, 20 for
    10 at 0.25 of 10, 20, 30, 40; PERCENTILE_CONT stays H2's own
  - generateRegularExpression: the expression as it is in
    '(?-u)\A(?:...)\z'; taking its flags out lost s and u, \Q...\E was
    unquoted, and H2 folds the case beyond ASCII where Java's (?i) does
    not

  Version tests (versions package, -Dintegration.docker=true):
  - H2Versions: a database in memory of an H2 version, a login to it
  - profile h2-versions: maven-dependency-plugin copies the jars into
    target/h2-versions, only with -Dintegration.docker=true
  - H2PaginationTest, H2BitAggregationTest, H2ListAggTest,
    H2RecursiveCteTest, H2PercentileTest, H2RegularExpressionTest (rows
    as Java's Pattern.matches), H2UsersAndRolesTest (no WITH ADMIN
    OPTION in any version), H2DdlTest (schema, named primary key,
    constraints added later, descending index, renames, sequence, IF
    [NOT] EXISTS and CASCADE, read back through the driver's metadata)
  - H2DialectTest: the new percentile and regular expression forms
  - pom: jdbc.record for the test, to create tables with createTable

  Signed-off-by: <bulahovdenis@gmail.com>
@stbischof
stbischof merged commit 8906589 into eclipse-daanse:main Nov 26, 2026
30 checks passed
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.

2 participants