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 CDC66D7E3C for ; Mon, 29 Aug 2005 15:39:36 -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 62283-08 for ; Mon, 29 Aug 2005 18:39:34 +0000 (GMT) Received: from exch01smtp10.hdi.tvcabo (smtp4.netcabo.pt [212.113.174.31]) by svr1.postgresql.org (Postfix) with ESMTP id 0058BD7E3F for ; Mon, 29 Aug 2005 15:39:32 -0300 (ADT) Received: from www.calmetric.pt ([213.22.54.4]) by exch01smtp10.hdi.tvcabo with Microsoft SMTPSVC(6.0.3790.211); Mon, 29 Aug 2005 19:39:33 +0100 Received: from plexus ([192.168.1.1]) (authenticated bits=0) by www.calmetric.pt (8.12.8/8.12.8) with ESMTP id j7TIYdmh003899 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 29 Aug 2005 19:34:48 +0100 Reply-To: From: "Silvio Macedo" To: Subject: COPY FROM STDIN fails inside Pl/pgSQL function or in PgAdmin , but ok in psql Date: Mon, 29 Aug 2005 19:43:05 +0100 Organization: Calmetric Lda Message-ID: <000501c5acc9$83747aa0$0501a8c0@plexus> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-OriginalArrivalTime: 29 Aug 2005 18:39:33.0194 (UTC) FILETIME=[FF9E7AA0:01C5ACC8] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.153 required=5 tests=[AWL=-0.104, FORGED_RCVD_HELO=0.05, UPPERCASE_25_50=0.207] X-Spam-Level: X-Archive-Number: 200508/51 X-Sequence-Number: 5722 Hi, (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 would appreciate if anybody could explain me why this doesn't work: -- create table CREATE TABLE temp_data ( xx float, yy float, ww float, hh float) WITHOUT OIDS; -- create function CREATE OR REPLACE FUNCTION check_data(text) RETURNS integer AS $func$ BEGIN EXECUTE 'COPY temp_data(xx,yy,ww,hh) FROM STDIN WITH DELIMITER ''|'';' ||'\n' || $1 || '\n\\.'; -- just to get something out return length($1); END; $func$ LANGUAGE plpgsql; and then: select check_data('1.0|2.0|3.0|4.0'); It gives out: ERROR: syntax error at or near "1.0" at character 60 QUERY: COPY temp_data(xx,yy,ww,hh) FROM STDIN WITH DELIMITER '|'; 1.0|2.0|3.0|4.0 \. CONTEXT: PL/pgSQL function "check_data" line 8 at execute statement Actually, if I do the COPY within a pgAdmin SQL command prompt, it also fails. For example, the following, alone, without any plpgsql - COPY temp_data(xx,yy,ww,hh) FROM STDIN WITH DELIMITER '|'; 1.0|2.0|3.0|4.0 \. will fail. If on the other hand, I execute these lines on a psql prompt, it works just fine. Any help will be appreciated. Regards Silvio