Skip to content

[Bug]: ValueMetaUuid generates UUID instead of UNIQUEIDENTIFIER for the non-native SQL Server connection #8217

Description

@fskorgen

Apache Hop version?

2.19

Java version?

21

Operating system

Windows

What happened?

Hop correctly recognizes SQL Server's uniqueidentifier type in
BaseDatabaseMeta.customizeValueFromSqlType()
(core/src/main/java/org/apache/hop/core/database/BaseDatabaseMeta.java:1971) and changes the field
to Hop UUID metadata. DDL generation then loses the SQL Server dialect:

String def = "UUID";
if (iDatabase.isMsSqlServerNativeVariant()) {
  def = "UNIQUEIDENTIFIER";
}

ValueMetaUuid therefore returns UNIQUEIDENTIFIER for the MSSQLNATIVE connection, but returns
UUID for the regular MSSQL connection. SQL Server has no UUID data type, so a
uniqueidentifier column read through the regular connection cannot be recreated with Hop's
generated DDL.

Only MsSqlServerNativeDatabaseMeta overrides isMsSqlServerNativeVariant() to return true
(MsSqlServerNativeDatabaseMeta.java:188); the jTDS-based MsSqlServerDatabaseMeta inherits
false from BaseDatabaseMeta:1683, so it takes the UUID branch.

Steps to reproduce

Create or clone UUID value metadata, call getDatabaseColumnType() with each SQL Server database
meta, and compare:

MSSQLNATIVE -> UNIQUEIDENTIFIER
MSSQL       -> UUID

Expected: UNIQUEIDENTIFIER from both — they target the same engine.
Actual: the regular MSSQL connection generates DDL SQL Server rejects.

Suggested fix

Emit UNIQUEIDENTIFIER for every SQL Server database-meta variant, not only
isMsSqlServerNativeVariant(), and add a test for both connection types.

Issue Priority

Priority: 3

Issue Component

Component: Database

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions