Okay, the db type "bytea" is in fact binary data... So, with this in place, how can I persist a Guid in that?
2009/7/1 Kenneth Siewers Møller <[email protected]> > Hmm, unfortunately there isn't any binary column. I guess theres a byte > array ("bytea"), but i don't know if that's any good. > I can see your point in using character(36) is a bad idea, but I was simply > just copying the guid generated from .NET (which includes the dashes), > thinking that a plain character string in the same length would be enough. > My current implementation isn't that advanced, so indexing isn't a real > issue at the moment. > > My point is also that I need to be able to convert the column to a "real" > uuid when we make a switch to the new version at some point (8.3)... > > 2009/7/1 Ken Egozi <[email protected]> > > a guid is a 128bit numbercharacter(36) is 288. even if you skip the '-' >> chars you're still at 256. and if characters() is unicode ... >> using a too large field for indexing, especially for PK, might not be such >> a good idea. >> is there any kind of a binary[128] field you can use instead? then we'll >> discuss the mapping >> >> 2009/7/1 Kenneth Siewers Møller <[email protected]> >> >> Hi >>> >>> This might be a simple question to answer, but here goes. >>> >>> We're running a PostgreSQL 8.1 DBMS, which doesn't support UUID. My idea >>> is therefore to continue using GUID's as PK's in my domain model, but simply >>> persist them as character(36) in the database. Is this possible? I've tried >>> just changing the column to character(36), but this causes NH to produce the >>> error "operator does not exist: character = uuid", which is resonable... >>> Changing the mapping to type "string" creates a conversion exception - again >>> quite understandable... >>> >>> I'd rather avoid creating a custom usertype as the DBMS probably will be >>> upgraded at some point, making this a somewhat irellevant implementation... >>> >>> Any ideas? >>> >>> >>> >> >> >> -- >> Ken Egozi. >> http://www.kenegozi.com/blog >> http://www.delver.com >> http://www.musicglue.com >> http://www.castleproject.org >> http://www.gotfriends.co.il >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
