planetfederal / workshops

Workshop materials relating to open source projects that we participate in or products we support.
58 stars 62 forks source link

issue with use of round in a few examples #8

Closed ischneider closed 10 years ago

ischneider commented 10 years ago

demonstrated in the join-and-summarize example but this appears elsewhere, too. Specifically, the column computation::

Round(100.0 * Sum(popn_white) / Sum(popn_total), 1)

The error is::

No function matches the given name and argument types. You might need to add explicit type casts.

I fixed this using::

Round( (100.0 * Sum(census.popn_white) / Sum(census.popn_total))::numeric, 2)

I suppose there could be another way...

pramsey commented 10 years ago

I thought I'd fixed most of those. I'm tempted to just remove the round() rather than expand the query.

ischneider commented 10 years ago

I found a few hits in the repo and they were present in the online materials, too.

While I discovered the issue before the workshop, it gave me an opportunity to speak about diagnosing SQL errors and casting, but I understand that's not the goal necessarily.

pramsey commented 10 years ago

I've committed changed to github, should be in next website rollout.