I am trying to make a fuction for create a large table from file using COPY.
My function create the *.csv file properly.
After, my function generate the query, who calls to a postgres function that uses COPY command.

This is the postgres function:

Qt Code:
  1. CREATE OR REPLACE FUNCTION importar_copy(
  2. _nombretabla character varying,
  3. _ruta character varying)
  4. RETURNS boolean AS
  5. $BODY$
  7. texto text;
  8. BEGIN
  9. texto = FORMAT ('COPY %I FROM %s DELIMITER %s NULL AS ''NULL''', _nombretabla, quote_literal(_ruta), quote_literal(chr(9)));
  10. execute (texto);
  11. raise notice '%',texto;
  12. return true;
  13. END;
  14. $BODY$
  16. COST 100;
To copy to clipboard, switch view to plain text mode 

As well as I have said, the function in Qt generate the query properly. And the file is also properly generate. If I copy the query generate in Qt and paste in pgAdmin, the query works, but if I try to exec from my Qt application, is like if it can manage a large file and stop to read in any place of it.

Maybe someone knows what could happens?
Thank you very much!