Chris Browne <[EMAIL PROTECTED]> writes: > create or replace function build_table (integer) returns integer as ' > begin > execute ''copy foo to stdout;''; > return 1; > end' language plpgsql;
> The result: > /* [EMAIL PROTECTED]/dba2 in=*/ select try_copy(1); > ERROR: unexpected error -2 in EXECUTE of query "copy dups to stdout;" > CONTEXT: PL/pgSQL function "try_copy" line 2 at execute statement In CVS tip I get ERROR: cannot COPY to/from client in PL/pgSQL CONTEXT: PL/pgSQL function "build_table" line 2 at execute statement There are some protocol-level reasons for not supporting this, IIRC. You're already inside a SELECT and the client library would probably get terribly confused. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match