2009/8/19 Newton Teixeira do Nascimento Júnior <[email protected]>: > > alguém tem um exemplo de código de como executar um COPY (a partir de um > arquivo presente na maquina requisitante) > > para um servidor Postgresql via um programa em C (utilizando a libpq) ? > > O programa em C fica na minha maquina (localhost win XP) e o servidor > postgres 8.2.4 em Linux. >
Do manual: "Files named in a COPY command are read or written directly by the server, not by the client application. Therefore, they must reside on or be accessible to the database server machine, not the client. They must be accessible to and readable or writable by the PostgreSQL user (the user ID the server runs as), not the client. When STDIN or STDOUT is specified, data is transmitted via the connection between the client and the server." http://www.postgresql.org/docs/current/interactive/sql-copy.html Creio que a forma mais transparente seja seu programa C ler o arquivo e transmiti-lo logo após o comando COPY STDIN (que é o que faz o \copy do psql). Não esquecer de finalizar com uma linha contendo apenas "\." (sem as aspas). Osvaldo _______________________________________________ pgbr-geral mailing list [email protected] https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
