X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C4189D7FFF for ; Mon, 29 Aug 2005 20:04:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27039-08 for ; Mon, 29 Aug 2005 23:04:02 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 91E5AD7F7C for ; Mon, 29 Aug 2005 20:04:00 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 853DB30953; Tue, 30 Aug 2005 01:04:03 +0200 (MET DST) From: Chris Browne X-Newsgroups: pgsql.interfaces Subject: Re: COPY FROM STDIN fails inside Pl/pgSQL function or in PgAdmin , but ok in psql Date: Mon, 29 Aug 2005 18:16:26 -0400 Organization: cbbrowne Computing Inc Lines: 36 Message-ID: <60psrw75j9.fsf@dba2.int.libertyrms.com> References: <000501c5acc9$83747aa0$0501a8c0@plexus> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) Cancel-Lock: sha1:DsqhpFbC+/qMZeMI/YX2y8ByY2A= To: pgsql-interfaces@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.103 required=5 tests=[AWL=0.103] X-Spam-Level: X-Archive-Number: 200508/52 X-Sequence-Number: 5723 smacedo@calmetric.pt ("Silvio Macedo") writes: > (Pg 8.0.3 on Windows XP SP2, client psql, ODBC and pgAdmin ) > > Summary: COPY FROM STDIN works on psql, but not inside a Pl/pgSQL > function, nor a pgAdmin SQL window, and not on a ODBC command... I believe that it's because inside "those places," you don't have either a stdin or a stdout. One of our folks ran into the same situation, and the same surprise. See: Bruno Wolfe suggests the problem is because pl/pgsql is considered a "trusted" language, which thus shouldn't be able to read/write files. In a more recent CVS, Tom points out that this elicits a more meaningful error message: ERROR: cannot COPY to/from client in PL/pgSQL CONTEXT: PL/pgSQL function "build_table" line 2 at execute statement He also points out that this is taking place inside a SELECT, and that the client library would likely get confused at this 'abuse' of the protocol... -- let name="cbbrowne" and tld="acm.org" in String.concat "@" [name;tld];; http://cbbrowne.com/info/emacs.html Rules of the Evil Overlord #127. "Prison guards will have their own cantina featuring a wide variety of tasty treats that will deliver snacks to the guards while on duty. The guards will also be informed that accepting food or drink from any other source will result in execution."