vielen Dank Niels, das hat geholfen
hier die fertige Commandline für den export, damit man das selbe Format hat wie für das Import-File....
psql -d "domain_contacts" -c "copy (WITH business AS (select entryid as businessid, number as telephonenumber from numbers where numbertype = 2),
mobile AS (select entryid as mobileid, number as mobile from numbers where numbertype = 3),
home AS (select entryid as homeid, number as homephone from numbers where numbertype = 4),
fax AS (select entryid as faxid, number as facsimiletelephonenumber from numbers where numbertype = 5)
SELECT extanchor,givenname,sn,company,cn as displayname,email,telephonenumber,mobile,homephone,
facsimiletelephonenumber,city,street,postalcode,state,country,privatecity,privatestreet,privatepostalcode,title,
position,department,description,roomnumber,info,url,sip
FROM entries LEFT JOIN business ON entries.id = business.businessid
LEFT JOIN mobile ON entries.id = mobile.mobileid
LEFT JOIN home ON entries.id = home.homeid
LEFT JOIN fax ON entries.id = fax.faxid
LEFT JOIN emails ON entries.id = emails.entryid
ORDER by entries.id) TO '/mnt/sda2/home/admin/export/contacts.csv' DELIMITER ';' CSV HEADER"
Werde das morgen in aller Frische nochmals prüfen, aber sieht auf den ersten Blick ganz gut aus....
Gruss
Marc