metamx/druid — pull request #335 by rays-qpi (2013-12-18 21:12:46+00:00)
Title: Remove unused payload column from sub-select that fails in postgres.  Use ...

...boolean true/false for 'used' column so that queries run in postgres.

I am using postgres instead of mysql for the druid relational store. I found and fixed two issues:

First, in DatabaseRuleManager.java#poll, selecting the payload column in the sub-select causes an error:

druid=> SELECT dataSource, max(version) as version, payload FROM druid_rules GROUP BY dataSource;
ERROR: column "druid_rules.payload" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT dataSource, max(version) as version, payload FROM dru...

The inner payload column doesn't seem to be used so I removed it.

Second, in DatabaseSegmentManager I changed used=0 and used=1 to used=false/used=true. Postgres does not cast 1/0 to true/false.