[dev] Re: [cvs] commit: framework/DataTree/DataTree sql.php

Ben Chavet ben at chavet.net
Tue Aug 31 21:10:26 PDT 2004


Quoting Chuck Hagenbuch <chuck at horde.org>:

> chuck       2004-08-31 12:19:28 PDT
>
>   Modified files:
>     DataTree/DataTree    sql.php
>   Log:
>   Add a GROUP BY to prevent duplicate data.
>
>   Submitted by: duck at obala.net
>
>   Revision  Changes    Path
>   1.139     +3 -3      framework/DataTree/DataTree/sql.php
>
>   Chora Links:
>   
> http://cvs.horde.org/diff.php/framework/DataTree/DataTree/sql.php?r1=1.138&r2=1.139&ty=u
>
> --
> To unsubscribe, mail: cvs-unsubscribe at lists.horde.org
>
>


this, or one of the other recent changes, broke my datatree.  I use 
postgresql,
and when I try to get a gallery listing in ansel, it generates the following
query:

www=# SELECT a1.datatree_id, c.datatree_name FROM horde_datatree c LEFT JOIN
horde_datatree_attributes a1 ON a1.datatree_id = c.datatree_id WHERE
c.group_uid = 'horde.shares.ansel' AND ((a1.attribute_name = 'owner' AND
a1.attribute_value = 'admin') OR (a1.attribute_name = 'perm_users' AND
a1.attribute_key = 'admin' AND CASE WHEN CAST(a1.attribute_value AS VARCHAR) ~
'^-?[0-9]+$' THEN (CAST(a1.attribute_value AS INTEGER) & 2) <> 0 ELSE FALSE
END) OR (a1.attribute_name = 'perm_creator' AND CASE WHEN
CAST(a1.attribute_value AS VARCHAR) ~ '^-?[0-9]+$' THEN
(CAST(a1.attribute_value AS INTEGER) & 2) <> 0 ELSE FALSE END) OR
(a1.attribute_name = 'perm_default' AND CASE WHEN CAST(a1.attribute_value AS
VARCHAR) ~ '^-?[0-9]+$' THEN (CAST(a1.attribute_value AS INTEGER) & 2) <> 0
ELSE FALSE END)) AND datatree_parents = '' AND a1.attribute_name =
a1.attribute_name GROUP BY a1.datatree_id ORDER BY c.datatree_order,
c.datatree_name, c.datatree_id;

which returns the following error:

ERROR:  column "c.datatree_name" must appear in the GROUP BY clause or be used
in an aggregate function

I would look into it myself, but this SQL statement is WAY above me :)  
Any help
would be appreciated.

--Ben


More information about the dev mailing list