fskorgen opened a new issue, #8217:
URL: https://github.com/apache/hop/issues/8217
### 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:
```java
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]