UUID fields are mapped as TStringField rather than TWideStringField

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
roberto.schneiders
Posts: 1
Joined: Mon 10 Oct 2016 17:44

UUID fields are mapped as TStringField rather than TWideStringField

Post by roberto.schneiders » Mon 10 Oct 2016 18:05

I have a problem with the field mapping for native uuid fields on PostgreSQL (9.5).

We use UseUnicode=True and UnknownAsString=True, but the field is mapped as TStringField, it should be TWideStringField.

The documentation:
UseUnicode (=True)
When set to True all character data is stored as WideStrings and TStringField is replaced with TWideStringFiled.
UnknownAsString (=True)
If True, fields of unknown data types are mapped to TStringField or TWideStringField depending on the value of the UseUnicode option.
We are migrating the database fields from character(38) to native uuid fields and we expect the field mappings to be the same (or compatible).

I don't see any reason why the uuid fields would be mapped as TStringField on a Unicode database. It looks like a bug.

if anyone knows a way to workaround this, we'll apreciate it.

*A coworker already sent this problem to the support a week ago, but they don't answer.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: UUID fields are mapped as TStringField rather than TWideStringField

Post by azyk » Tue 11 Oct 2016 09:36

The driver represents the UUID value as a string value consisting of the HEX digits of the 128-bit sequence. But UUID in PostgreSQL is not a string data type, that's why this field won't be mapped in WideString when UseUnicode=True. This behavior is correct. For more information on the UUID type, refer to the PostgreSQL documentation: https://www.postgresql.org/docs/9.6/sta ... -uuid.html

Please describe in more detail the reason of the UUID value mapping to WideString.

Post Reply