sudo -u postgres psql puppetdb -c 'delete from catalogs where certname in (select certname from certnames where certname like '%testserver.k2patel.in%');' sudo -u postgres psql puppetdb -c 'delete from catalogs where id in (select id from certnames where certname like '%testserver.k2patel.in%');'