0
COPY des_unificado (cedula, grupo, nivel, insti, sector, dpto, zona, ccorres, apel_corto, digito_id, nombre, cargo, pres_act, turno, tipo_rubro, catego_psp, cant_rubro, presupuesto_ant, devenga_ant, aporte_ips, aporte_bnt, ac_meses, ac_aguinal, f_mm_ing_c, f_aa_ing_c, opera_lqd, tipo_rgtro, status_crg, aa_plan, mm_plan, jubilac, rec_ant, ccorr, orden, antece_nro, resolu_nro, estado, insti_ant, id_grado_c, seccion, id_especia, multa, judicial, afemec, otros_dec, presupuesto, afemec_1, liquido, dcto_jub, monto_defi, aux, linea)
FROM '/home/arturo/Escritorio/des_unificado1.csv' 
WITH DELIMITER ';'
CSV HEADER

Can someone help me, when you run these commands, I get the following error:

ERROR:  could not open file "/home/arturo/Escritorio/des_unificado1.csv" for reading: No such file or directory

********** Error **********

ERROR: could not open file "/home/arturo/Escritorio/des_unificado1.csv" for reading: No such file or directory
SQL state: 58P01
10
  • As the error suggests, did you see if /home/arturo/Escritorio/des_unificado1.csv indeed exists ? verify the file does exist by doing ls /home/arturo/Escritorio/des_unificado1.csv Commented Oct 21, 2014 at 17:23
  • You need to include more information -- what user are you running the command as, what machine are you running the command on, what machine is postgres running on, what are the permissions, owner and group of the file you are trying to import? Commented Oct 21, 2014 at 17:24
  • tells me not existeel file, but if I have it on the desktop @karthikr Commented Oct 21, 2014 at 17:34
  • @EdKing can you help me, I need so much an answer Commented Oct 21, 2014 at 17:55
  • if it tells you file does not exist, you need to address that first. Are you trying to copy from the database or to the database ? Commented Oct 21, 2014 at 19:06

1 Answer 1

1

COPY expects the file to be on the database server, not the database client. So if you're connecting to a server on a different computer and the file is on your computer, the file doesn't exist for the server.

If you want the file to be on the database client, you can use the psql command \copy. See \? for details.

This is a part of the psql command line client, not the server. Internally it uses COPY ... FROM STDIN and reads the file then sends it to the server over the PostgreSQL connection.

Sign up to request clarification or add additional context in comments.

7 Comments

@Matias Use \copy in psql.
Can you give me your email, I want to send a screenshot @karthikr please
Can you give me your email, I want to send a screenshot @craig-ringer please
You can just paste a link to an upload of the image.
@Matias You do not appear to be listening. Your screenshot shows that you are using COPY via pgadmin. Use \copy in psql. If you are using pgadmin you do not have \copy. You must instead use pgadmin's "import" command, or use the psql command-line client.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.