khibino / haskell-relational-record

This repository includes a joined query generator based on typefull relational algebra, and mapping tools between SQL values list and Haskell record type.
233 stars 36 forks source link

Projected record of `case' is broken #54

Closed khibino closed 7 years ago

khibino commented 7 years ago

HRR code as follows:

import Data.Int
import Database.Relational.Query

caseRecord :: Relation () Int32
caseRecord = relation $ do
  return $
    case'
    (value (1 :: Int32))
    [ (value 1             , (,) |$| value 1 |*| value "foo") ]
    ((,) |$| value 0 |*| value "other")
    ! fst'
    .*.
    value 10

main :: IO ()
main = print caseRecord

output is:

SELECT ALL (CASE 1 WHEN 1 THEN (1, 'foo') ELSE (0, 'other') END * 10) AS f0
khibino commented 7 years ago

Fixed in https://github.com/khibino/haskell-relational-record/commit/4805e10bb5d2698392bddf7882033606c4430dee and https://github.com/khibino/haskell-relational-record/commit/406c42a063ae746786dd4f926c228dfcff30e82a

khibino commented 7 years ago

Fixed versions are uploaded. http://hackage.haskell.org/package/relational-query-0.8.3.8 http://hackage.haskell.org/package/relational-query-0.9.0.2