Issue with count function

Hi,
"Count" function return a error, I override it in postgres library. 
Please fix it if i done this wrong, or check what is wrong in jugglingdb base adapter.