On Thu, Feb 23, 2006 at 10:26:35PM -0600, Wes wrote: > I found this in the archives: > > <http://archives.postgresql.org/pgsql-interfaces/2004-04/msg00005.php> > > With 8.x, is it still true that with ECPG, it is not possible to use COPY > inline - I'd have to write the data to a file, then 'COPY FROM filename' (or > use direct libpq API calls instead of ECPG)? Looks that way. The ECPGexecute() function in ecpglib/execute.c has the following code: case PGRES_COPY_OUT: ECPGlog("ECPGexecute line %d: Got PGRES_COPY_OUT ... tossing.\n", stmt->lineno); PQendcopy(stmt->connection->connection); break; case PGRES_COPY_IN: ECPGlog("ECPGexecute line %d: Got PGRES_COPY_IN ... tossing.\n", stmt->lineno); PQendcopy(stmt->connection->connection); break; You can see this code being executed if you enable debugging: % cat foo.pgc int main(void) { ECPGdebug(1, stdout); EXEC SQL CONNECT TO test; EXEC SQL COPY foo FROM stdin; EXEC SQL COMMIT; EXEC SQL DISCONNECT; return 0; } % ./foo [33044]: ECPGdebug: set to 1 [33044]: ECPGconnect: opening database test on <DEFAULT> port <DEFAULT> [33044]: ECPGexecute line 6: QUERY: copy foo from stdin on connection test [33044]: ECPGexecute line 6: Got PGRES_COPY_IN ... tossing. [33044]: ECPGtrans line 7 action = commit connection = test [33044]: ecpg_finish: Connection test closed. -- Michael Fuhr