\c companion select * from (select pnfsid, count(pool) from cacheinfo group by pnfsid) as a where a.count >= 2;
a.count is a number of replicas.
In case of a nix shell you can use
psql -U postgres companion -c ' select * from (select pnfsid, count(pool) from cacheinfo group by pnfsid) as a where a.count >= 2;'
[io] /pnfs/hep.kbfi.ee/cms > . /usr/etc/pnfsSetup [io] /pnfs/hep.kbfi.ee/cms > PATH=$PATH:$pnfs/tools [io] /pnfs/hep.kbfi.ee/cms > pathfinder 0005000000000000000223E0 0005000000000000000223E0 file9ed370a2-20a1-4240-84e3-130478818506 0005000000000000000220E8 2006-12-19 000500000000000000001090 generated 000500000000000000001060 ops 000000000000000000001080 usr 000000000000000000001040 fs 000000000000000000001020 root 000000000000000000001000 - 000000000000000000000100 - 000000000000000000000000 - /root/fs/usr/ops/generated/2006-12-19/file9ed370a2-20a1-4240-84e3-130478818506