Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Postgresql Hstore support

Help
2013-11-28
2013-12-09
  • Niels Kristian
    Niels Kristian
    2013-11-28

    The generated syntax of the sql from a table that includes hstore values is wrong/not valid. Anyone who has experience with using jailer together with an Hstore enabled postgresql database?

    It's outputting syntax like this:

    Update public.some_table set brand='Ford', model_name='Focus', additional_attrs={engine_size=1.6, weight=1100}, created_at=timestamp '2013-11-05 17:21:38.667085', updated_at=timestamp '2013-11-05 17:21:38.667085' Where id=246747;
    

    Where is should output:

    Update public.some_table set brand='Ford', model_name='Focus', additional_attrs='"engine_size"=>"1.6", "weight"=>"1100"', created_at=timestamp '2013-11-05 17:21:38.667085', updated_at=timestamp '2013-11-05 17:21:38.667085' Where id=246747;
    
     
    Last edit: Niels Kristian 2013-11-29
  • Ralf Wisser
    Ralf Wisser
    2013-11-30

    I've added support for the hstore data type and uploaded release 4.1.

     
  • Niels Kristian
    Niels Kristian
    2013-12-06

    Great!

    However there is still a small bug unfortunately: When a column of the hstore type is empty, it throws an error, because the representation in the SQL output is just an empty string (''). Here is an example of the error:

    ERROR:  column "additional_attrs" is of type hstore but expression is of type text
    

    And here is an example of the SQL that generated it:

    Update public.some_table set brand='Ford', model_name='Focus', additional_attrs='', created_at=timestamp '2013-11-05 17:21:38.667085', updated_at=timestamp '2013-11-05 17:21:38.667085' Where id=246747;
    

    I think you might want to add something like ::hstore to the outputted strings (this both works for: ''::hstore and '"key"=>"value"'::hstore):

    Update public.some_table set brand='Ford', model_name='Focus', additional_attrs=''::hstore, created_at=timestamp '2013-11-05 17:21:38.667085', updated_at=timestamp '2013-11-05 17:21:38.667085' Where id=246747;
    
     
    Last edit: Niels Kristian 2013-12-06
  • Ralf Wisser
    Ralf Wisser
    2013-12-06

    Thank for the bug report. I will fix it asap.

     
  • Ralf Wisser
    Ralf Wisser
    2013-12-09

    Fixed with release 4.1.1. Please have a try.