Saurabh Nanda

Results 212 comments of Saurabh Nanda

`toHStore` is [defined in pg-simple](https://github.com/lpsmith/postgresql-simple/blob/master/src/Database/PostgreSQL/Simple/HStore/Implementation.hs) ``` instance ToHStore HStoreMap where toHStore (HStoreMap xs) = Map.foldrWithKey f mempty xs where f k v ys = hstore k v `mappend` ys class...

The core conversion to a lazy bytestring is correct. I checked: ```  toLazyByteString $ H.toHStore $ HStoreMap $ fromList [("a", "b")] "\"a\"=>\"b\""  ```

Ok -- got it. Here's the correct code: ``` pgHStore :: HStoreMap -> Column PGHStore pgHStore h = IPT.castToType "hstore" $ HSD.quote $ IPT.lazyDecodeUtf8 $ toLazyByteString (toHStore h) ```

`import qualified Opaleye.Internal.HaskellDB.Sql.Default as HSD`

so, can we keep this issue open, while I chase down the PR on pg-simple?

I guess it'll be a good idea to include all the [hstore functions](https://www.postgresql.org/docs/9.4/static/hstore.html) in the PGHStore PR as well, right?

@tomjaguarpaw do you have any thoughts on how to deal with https://github.com/phadej/qc-instances/issues/9#issuecomment-310038062 Any tests in Opaleye based on QC would also be affected by this issue, right?

@tomjaguarpaw can you please assign this to Kahlil? He's struggled quite a lot with the Opaleye JSON operators and should be in a position to write better docs to help...

@tomjaguarpaw @kahlil29 was about to pick this up, but we just had an offline discussion about **why** do JSON fields need to be nullable for the operators to work? What's...

Just wondering, can the PG query optimizer itself give us the canonical query back? Or, can we bind to the internal PG library (written in C?) to do this task?