The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Postgres 8.3 and Guid

Last post 04-28-2008, 6:42 PM by Mike.Griffin. 3 replies.
Sort Posts: Previous Next
  •  02-20-2008, 8:19 AM 8146

    Postgres 8.3 and Guid

    Hi,

     The new version of postgres is here, and it now have an integrated uuid type.

    I've tryed to use entityspaces with the new uuid support. i've mapped the uuid type to Guid in MyGeneration.

    The generation worked fine but i have some problem when trying to execute a request on a uuid column.
    The error was something like 'bad request at ...' i could see that the guid was not between simple quote ...

    What surprise me first was that it wasn't a bind request ... i found later that it is the postgres .net driver that make the transformation.

    So i tracked the creation of the request and found that the NpgsqlParameter has an Int DbType ...
    I then tracked the creation of the NpgsqlParameter and it seemed that Entityspaces set the DbType to Int instead of using the type defined in the esQueryItem ...
    I think that there is a bug ...

    So to reproduce the issue you need Postgres 8.3, and Npgsql 2.0 (it's a beta).

    For now i found a workaround :
    In the Npgsql driver when the value is set on the NpgsqlParameter i check if the value is a Guid, if so, i force the replacement of the mapped DbType.

    Best Regards,

     
    --
    Yann
     

  •  02-20-2008, 10:21 AM 8149 in reply to 8146

    Re: Postgres 8.3 and Guid

    Yes, there is no way for EntitySpaces to somehow make new types work automatically when DB systems add them without us updating our code, ie, the new DbType is required. Thanks for bringing this to our attention, we will add it to ES2008. We will be announcing when our first beta will be out soon, tonight is our team meeting, watch our blog for an announcement soon.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  02-20-2008, 12:44 PM 8150 in reply to 8149

    Re: Postgres 8.3 and Guid

    Ok. But maybe you should offer an overload of the constructor of the esQueryItem that let us specify the DbType we wanna use. Or you should throw an error saying you don't know the specified type ...

    The weird thing is that when you do an ExecuteQuery in text mode you're able to map the type (i think that in this mode you map using the object type). Anyway, can't wait for the new announcment !
     

  •  04-28-2008, 6:42 PM 9082 in reply to 8150

    Re: Postgres 8.3 and Guid

    Support for the new NpgsqlDbType.Uuid was added tonight, I tested reading and writing guids and it works just fine. It will be in the next beta for sure, of course, it requires the new Npgsql 2.0 driver which is in beta3 but it works.

    See http://npgsql.projects.postgresql.org/ 

     


    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML