2017-05-24 10 views
6

मैं

psql -E -U siteportal -d portal -h 172.19.242.32 -c "COPY externals (id,logo_path,favicon_path,cover_path,header,description,sign_enable,sign_text,footer_logo_enable,footer_logo_path,footer_text,created_at,updated_at) FROM '/Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv' DELIMITER ',' csv;" 

मैं

ERROR: could not open file "/Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv" for reading: No such file or directory 

मिला चलाने लेकिन मैं निश्चित रूप से पता फ़ाइल, वहाँ है becase जब मैंpsql निर्यात लौट ऐसी कोई फ़ाइल या निर्देशिका जब फ़ाइल मौजूद

चलाने
cat /Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv 

मुझे

1,"/images/account/operator/logo.png","/images/account/operator/favicon.png","/images/account/operator/external.png","site Portal","Log in using your credentials",1,"This is a secure page",1,"/images/account/operator/footer_logo.png","© 2017 site Networks Inc.","2016-12-22 13:37:42","2017-01-31 14:22:11" 
मिला

क्या यह अनुमति की वजह से है?

[email protected] 1 site staff 307 May 24 13:46 externals.csv 

मैं भी chomd 777 कोशिश करते हैं और sudo साथ चलाते हैं। लेकिन कुछ भी मदद नहीं करता है!

+0

तरह stdin से पढ़ा है? –

उत्तर

6

copy से \copy (https://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-META-COMMANDS-COPY) बदलें। थोड़ा अलग कमांड जो आपको फ़ाइल से/आपके सर्वर पर कॉपी करने देता है।

यहां अंतर का कारण यह है कि आप किसी दूरस्थ सर्वर से कनेक्ट हो रहे हैं (मुझे लगता है), लेकिन स्थानीय फ़ाइल आयात करना।


एक और विकल्प में अपनी फ़ाइल गुजरती हैं और SELinux फ़ाइल पहुँच को अवरुद्ध है psql

-c "copy externals (id,logo_path,favicon_path,cover_path,header,description,sign_enable,sign_text,footer_logo_enable,footer_logo_path,footer_text,created_at,updated_at) from STDIN with delimiter as ','" < /Applications/MAMP/htdocs/code/benu/ssc-portal/public/csv/externals.csv 
संबंधित मुद्दे