BTW, the perl module for postgres is about done:
andrew=# select query_to_json('select usename, usecreatedb, valuntil,usesysid from pg_user limit 2');
query_to_json
---------------------------------------------------------------------------------------------------------------------------------------------------
[{"usesysid":10,"usecreatedb":true,"valuntil":null,"usename":"andrew"},{"usesysid":16392,"usecreatedb":false,"valuntil":null,"usename":"blurfl"}]
Its very nice for doing ajax calls with - including tables.