Anthony <lists(at)a1(dot)org(dot)uk> writes:
> I think it's time to get Mr. Sysadmin to upgrade to v7 ;)
That's a good idea on many grounds, not only this one ;-)
However, if you really need a 6.5.* solution, you could do
SELECT DISTINCT foo INTO TEMP TABLE mytemp FROM ...
SELECT COUNT(*) FROM mytemp;
DROP TABLE mytemp;
regards, tom lane