I just upgraded Yii, and I started getting this error:
CDbCommand failed to execute the SQL statement: SQLSTATE[42803]: Grouping error: 7 ERROR: column "sample.identifier" must appear in the GROUP BY clause or be used in an aggregate function
I realize this is a Postgresql error, but I was not getting it in my code before I upgraded, so I assume something must have changed with the way relational a/r handles grouping.
Here is the setup for the query:
array(
'sampleRequiredMeasurement' =>
array(
'select' => 'id',
'condition'=>'"sourceLabId" != 1 AND "sampleMeasurementId" IS NULL',
'group' => 'sample.id'
),
'sampleRequiredMeasurement' =>
array(
'select' => '*',
'condition'=>'"sourceLabId" = :sourceLabId AND "sampleMeasurementId" IS NULL',
'params' => array(':sourceLabId' => $_GET['sourceLabId']),
'group' => 'sample.id'
),
'sampleActionMassUpdateLog' =>
array(
'select' => 'actionName',
'on' => ' ( "actionName" = 'adminExternalLabShipments' )',
'condition' => '??."actionName" ' . $nullness,
),
)
);
Of course when I comment out the grouping, I get no errors. Also I am doing a
model()->with( $joins )->together()->findAll();
where $joins is the array above. Any ideas on how to resolve?
Thanks!