hi it works thank you
andrej On Sunday, September 23, 2012 12:18:32 AM UTC+2, Massimo Di Pierro wrote: > > Looks like postgres is picky and wants in groupby all the selected fields > in distinct. This should work: > > rows = db(data.id==tag.record_id)\ > (tag.name.belongs(tags)).select( > data.ALL, > orderby=data.id, > groupby=data.id|data.value, > distinct=True) > > On Saturday, 22 September 2012 15:00:07 UTC-5, andrej burja wrote: >> >> the code with problem: >> >> rows = db(data.id==tag.record_id)\ >> (tag.name.belongs(tags)).select( >> data.ALL, >> orderby=data.id, >> groupby=data.id, >> distinct=True) >> >> >> >> On Saturday, September 22, 2012 10:26:27 AM UTC+2, andrej burja wrote: >>> >>> hi >>> >>> i would like to use idea in book Application Development Cookbook - >>> Efficienty search by tag. >>> there are two functions: 'search_or' and 'search_and' >>> everything is working fine on sqlite >>> when i switch to postgres, there seems to be problem with 'groupby'. >>> i got an error >>> >>> <class 'psycopg2.ProgrammingError'> column "data.value" must appear in >>> the GROUP BY clause or be used in an aggregate function LINE 1: SELECT >>> DISTINCT data.id, data.value FROM tag, data WHERE ((d... ^ >>> when i remove 'groupby=....id" there is no error, but (of course) >>> 'search_and' function doesn't work properly >>> >>> is this a bug related to postgres? >>> >>> andrej >>> >> --

