Skip to content

Issue #2694 - concatOf: type mismatch in STRING_AGG on SQL Server when the separator has type nvarchar#2696

Merged
01es merged 12 commits into2.3.0-SNAPSHOTfrom
Issue-#2694
Apr 6, 2026
Merged

Issue #2694 - concatOf: type mismatch in STRING_AGG on SQL Server when the separator has type nvarchar#2696
01es merged 12 commits into2.3.0-SNAPSHOTfrom
Issue-#2694

Conversation

@homedirectory
Copy link
Copy Markdown
Member

@homedirectory homedirectory commented Mar 31, 2026

Resolve #2694

To be completed by the pull request creator

This section should be completed with reference to section Preparing PR of the Code and PR reviews wiki page.

  • Create the pull request as a draft by tapping the dropdown arrow on the 'Create pull request' button under the pull request description (below the text box where this description is being edited) and changing the default Create pull request to Draft pull request.
    Or, if the pull request has already been created, convert it to draft by tapping the "Convert to draft" link beneath the "Reviewers" section.

  • A self-review of all changes has been completed, and the changes are in sync with the issue requirements.

  • Changes to the requirements have been reflected in the issue description.

  • Any "leftovers" such as sysouts, printing of stack traces, and any other "temporary" code, have been removed.

  • Minor refactorings, such as renamings, extraction of constants, etc., have been addressed.

  • Developer documentation (e.g., comments, Javadoc), have been provided where required.

  • New Java tests have been written or existing tests adjusted, if required, to cover the new functionality.

  • All existing and new Java tests pass successfully by running them with Maven.

  • All existing and new Web tests pass successfully.

  • Changes have been inspected for possible NPE situations, and the changes are sufficiently defensive.

  • The correct base branch has been selected for these changes to be merged into.

  • The latest changes from the base branch have already been merged into this feature branch (and tested).

  • Added a change overview to the issue description or as a wiki page, referenced in the issue description.
    Some issues might be very descriptive and serve in place of a wiki page.
    In such cases consider adding label Wiki like to the issue.

  • This pull request does not contain significant changes, and at least one appropriate reviewer has been selected.

  • The In progress label has been removed from the issue.

  • The Pull request label has been added to the issue.

  • The pull request has been made ready for review by tapping the "Ready for review" button below the list of commits on the pull request page.

To be completed by the pull request reviewer

This section should be completed with reference to section Performing PR review of the Code and PR reviews wiki page.

  • The In progress label has been added to the pull request in GitHub.

  • The issue requirements have been read and understood (along with any relevant emails and/or Slack messages).

  • The correct base branch is specified, and that base branch is up-to-date in the local source.

  • The issue branch has been checked out locally, and had the base branch merged into it.

  • All automated tests pass successfully.

  • Ensure the implementation satisfies the functional requirements.

  • Ensure that code changes are secure and align with the established coding practices, including code formatting and naming conventions.

  • Ensure that code changes are documented and covered with automated tests as applicable.

  • Ensure that code changes are well-suited for informal reasoning.

  • Ensure that changes are documented for the end-user (a software engineer in the case of TG, or an application user in the case of TG-based applications).

  • If there are significant changes (described above), special attention has been paid to them.
    Marked the task items in section "Significant changes" as completed to indicate that corresponding changes have been reviewed, improved if necessary, and approved.

  • The issue or issues addressed by the pull request are associated with the relevant release milestone.

To be completed by the pull request reviewer once the changes have been reviewed and accepted

  • The changes have been merged into the base branch (unless there is a specific request not to do so, e.g., they are to be released to SIT).

  • The issue branch has been deleted (unless the changes have not been merged - see above, or there is a specific request not to do so).

  • The In progress label has been removed from the pull request.

  • The Pull request label has been removed from the issue.

The previous code would generate `CAST x as VARCHAR`.
In PostgreSQL, this would be interpreted as a varchar with unlimited length.
In SQL Server, the default length of 30 would be used.
To prevent the possibility of data loss, it is necessary to explicitly specify unlimited length.
H2, it seems, does not have a character type with unlimited length.
Also, the previously used length of 10 was insufficient for extreme
negative values, which could require 11 characters because of the sign.
@homedirectory homedirectory requested a review from 01es March 31, 2026 08:26
@homedirectory homedirectory marked this pull request as ready for review March 31, 2026 08:26
This improves the developer experience during debugging.
Until now, only complete EQL queries had a readable string representation, while incomplete ones included
a lot of noise, such as token positions generated by ANTLR.
01es added 4 commits April 6, 2026 12:41
CLOB would be the natural unlimited string type for Oracle, but Oracle does not support CAST(... AS CLOB) — it requires TO_CLOB(...) instead.
Using TO_CLOB would bypass dbVersion().castSql() and break consistency with the other fromAny implementations.

VARCHAR2(4000) is Oracle's maximum VARCHAR2 length and works directly with CAST, covering the vast majority of use cases.
…ng and long-to-string casts.

The actual maximums are:
  - Integer: 4 bytes, 10 digits + sign = 11 characters
  - Long: 8 bytes, 19 digits + sign = 20 characters
…ng and long-to-string casts.

The actual maximums are:
  - Integer: 4 bytes, 10 digits + sign = 11 characters
  - Long: 8 bytes, 19 digits + sign = 20 characters
@01es 01es merged commit 18f2a02 into 2.3.0-SNAPSHOT Apr 6, 2026
@01es 01es deleted the Issue-#2694 branch April 6, 2026 04:00
@01es 01es removed the In progress label Apr 6, 2026
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.

concatOf: type mismatch in STRING_AGG on SQL Server when the separator has type nvarchar

2 participants