S3tuit commented on issue #5624:
URL: https://github.com/apache/hop/issues/5624#issuecomment-3266210117
### Immediate workaround (Postgres):
Add a JDBC option on your Hop PostgreSQL connection:
```
Parameter: stringtype
Value: unspecified
```
This makes pgJDBC send string params as “untyped”, so WHERE id = ? can match
a uuid column. It works for me. You can also do it via UI: go over the metadata
tab, select your postgres connection, go over Options.
### Devs: UUID value type plugin (as you quoted)
Since in my company we use a lot of UUIDs this would be a great feature for
us. I’ve started a `ValueMetaUuid` plug-in under plugins/valuetypes so Hop can
carry UUIDs natively (as java.util.UUID) and bind them correctly in JDBC.
I implemented all the basic method of `ValueMetaBase`
(setPreparedStatementValue, hashCode, compare, serialization...). It works fine
with PostgreSQL (native uuid without stringtype=unspecified) and MySQL (no
native uuid so it falls back to string).
However, while testing I noticed that the "Table input" cannot use the new
UUID type (or any other new types). In the current flow:
```
// Database → build row meta from ResultSetMetaData
for (IValueMeta vmClass : valueMetaPluginClasses) {
IValueMeta v = vmClass.getValueFromSqlType(... rm, index, ...);
if (v != null) { use it; break; }
}
```
In `getValueFromSqlType` there's a default that returns the type as String
even if it got no matches. **It “wins” before the UUID plugin sees it, and the
field comes out as String.** I don't think it'd be hard to fix but the code
inside ValueMetaBase should change a tiny bit.
Even if this changes, I have some worries. **Some existing pipelines may
break.** Imagine a "JSON Input" (uuid String) and a "Table input" (uuid native
after the change)... even if the sort and compare worked fine before, with the
new UUID type users will have to change the type inside "JSON Input" to uuid
(edge case, but breaking change).
This can all be handled just by treating the compare and hash inside the new
UUID as a String. I still have to test using H2, MSSQL, and Mongo. If it's ok
for you devs I can continue the implementation.
--
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]