Error when using JSONField() with case()
Postgres is actually right in this case, and this isn't a bug in peewee. It looks like the value returned by the attribute lookup is not numeric. You can cast it, but you have to cast both return values it seems.

One way that seemed to work was:

``` sql
SELECT 
CASE "t1"."price_info"->>'currency' 
WHEN 'EUR' THEN ("t1"."price_info"->>'value')::float 
WHEN 'RON' THEN (("t1"."price_info"->>'value')::float * 1.5) 
END AS price 
FROM "xxtest" AS t1;
```

To accomplish this with peewee, you can do something like this. It's not super elegant, but it should work.

``` python
from peewee import Clause, SQL, fn

def to_float(node):
    return fn.CAST(Clause(node, SQL('AS float')))

price = case(
    Posting.price_info['currency'],
    (
        ('EUR', to_float(Posting.price_info['value'])),
        ('RON', to_float(Posting.price_info['value']) * 1.5),
    )
).alias('price')
```
 With 73cfdc1824f4161db062fc74fc77a5a13660888e it should be possible to now write:

```
price = case(
        Posting.price_info['currency'],
        (
            ('EUR', Posting.price_info['value'].cast('float')),
            ('RON', Posting.price_info['value'].cast('float') / ONE_EURO_IN_RON)
        )
).alias('price')
```
 Works! Thanks for the syntax sugar.

Here's my simplified model:

``` python
from peewee import *
from playhouse.postgres_ext import *

db = PostgresqlExtDatabase('mobster')

class Posting(BaseModel):
    class Meta:
        database = db

    price_info = JSONField()
```

And here's a query I'm trying to make:

``` python
from playhouse.shortcuts import case

ONE_EURO_IN_RON = 4.4407

price = case(
        Posting.price_info['currency'],
        (
            ('EUR', Posting.price_info['value']),
            ('RON', Posting.price_info['value'] / ONE_EURO_IN_RON)
        )
).alias('price')

query = Posting.select(price)

postings = list(query)
```

And here's the error:

```
DataError: invalid input syntax for type numeric: "value"
LINE 1: ...o"->>'value' WHEN 'RON' THEN ("t1"."price_info"->>'value' / ...
```

Full query info:

```
<class 'Posting'> SELECT CASE "t1"."price_info"->>%s WHEN %s THEN "t1"."price_info"->>%s WHEN %s THEN ("t1"."price_info"->>%s / %s) END AS price FROM "posting" AS t1 ['currency', 'EUR', 'value', 'RON', 'value', 4.4407]
```

Versions:
- Postgres 9.4.4
- psycopg2 2.6.1
- peewee 2.6.4
