Menu

#224 PostgreSQL UUID params

7.2-beta
closed
2018-03-30
2018-02-08
No

Hi !

Found a problem with TGUID fields with PosgresSQL 9.6. When trying to apply a SELECT filter to those fields, got empty query result:

SELECT * from DATA where DATA.uuidfield = :UUIDVALUE
and Query.ParamByName('UUIDVALUE').AsString := '.....';

Discussion

  • marsupilami79

    marsupilami79 - 2018-02-08

    Hello Alexey,

    honestly - I think this is not supported by the code (yet). All that works is reading and writing TGUIDField. We didn't cover parameters with ftGuid, when we wrote that part. As a workaround I suggest you do a select where the GUID is part of the statement until we can implement the missing feature. If you want to accept the challenge of implementing this, I am willing to support you with necessary information.

    Best regards,

    Jan

     
    • Alexey Nalimov

      Alexey Nalimov - 2018-02-08

      Hi !

      I understand that direct work is not possible as soon as TParam.AsGUID is missing in DB.pas.
      But PostgreSQL works ok with string uuid values, even without specifying direct type case (::uuid), and query text like SELECT * from DATA where DATA.uuidfield = '8a0460d4-f58f-4f07-b4ac-a7b5b6a860a5' works peerfectly.

      And also variant of:
      SELECT * from DATA where DATA.uuidfield = :UUIDVALUE
      Query.ParamByName('UUIDVALUE').AsString := '8a0460d4-f58f-4f07-b4ac-a7b5b6a860a5';
      had been working correct in 7.3 for sure, and possibly even in 7.1 Zeos versions. So, something wrong is exactly in 7.2.

      Btw, will check possible problem with "{" and "}" symbols

       
  • Alexey Nalimov

    Alexey Nalimov - 2018-02-08

    Finally, adding or removing "{" and "}" in the guid value does not match. Resultset is returned empty. If the same query text executed directly on Postgres, result test is ok.
    I was wrong about 7.1 - this version does see GUID fields in the result set at all, but string parameters handling is ok. Possibly I had some older build of 7.2 that worked before.

     

    Last edit: Alexey Nalimov 2018-02-08
    • marsupilami79

      marsupilami79 - 2018-03-09

      Hello Alexey,

      this should be solved in the current SVN version of Zeos 7.2. Could you please test that again?7
      Best regards,

      Jan

       
  • marsupilami79

    marsupilami79 - 2018-03-30
    • status: open --> closed
    • assigned_to: marsupilami79
     
  • marsupilami79

    marsupilami79 - 2018-03-30

    This has been fixed.

     

Log in to post a comment.

MongoDB Logo MongoDB