Bug #60945 | Unwanted GUID conversion that causes Unrecognized Guid format exception | ||
---|---|---|---|
Submitted: | 21 Apr 2011 12:04 | Modified: | 2 May 2011 18:38 |
Reporter: | Salvatore Pellegriti | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 6.2.4.0 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | Guid |
[21 Apr 2011 12:04]
Salvatore Pellegriti
[22 Apr 2011 20:36]
Reggie Burnett
This is not a bug. After reviewing your data, the line that is causing the problem has a zero length string for the second guid, not NULL. If you change the '' in the line to NULL, then it will work as expected.
[22 Apr 2011 20:57]
Salvatore Pellegriti
Thank you for you answer. I cannot make more test now since I'm not at work, but your answer let me dubious. Do you mean that raising that exception is the right way to handle zero length string, then? Why I don't get it if I change the size of the attribute from 36 to 37, isn't that pretty strange behavior? Thank you a lot for your help. Regards, Salvatore Pellegriti
[28 Apr 2011 10:38]
Salvatore Pellegriti
The problem persists with zero length string only if the attribute has size of 36 chars.
[2 May 2011 16:59]
Reggie Burnett
No it is not strange behavior at all. If the string has a length of 36 then it tries to convert it to a GUID. A zero length string is invalid for a GUID where a string with length 37 is treated as simply a string value. We chose to declare char(36) as always containing guids. If your column can contain nulls, I suggest you use NULL instead of '' to represent that. If the column is not containing guids, then use char(37) or some other length.
[4 Aug 2016 13:51]
Tim Velo
But what if a column is set to char(36) for other reasons than a GUID? This seems like horrible practice; to let the API dictate how you need to store/query your data. There should at least be an option/setting somewhere to turn this feature off, instead of forcing it automatically and forcing a data column change. This is like saying "All red cars are fast."