Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 398ADF172E2 for ; Wed, 4 Jul 2012 00:07:23 -0300 (ADT) Received: from mail-yw0-f46.google.com ([209.85.213.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SmFw1-0005pD-Rm for pgsql-bugs@postgresql.org; Wed, 04 Jul 2012 03:07:22 +0000 Received: by yhmm54 with SMTP id m54so6816050yhm.19 for ; Tue, 03 Jul 2012 20:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=dfq19ttc/yx55/sFYpNOvv0S3Daol+YDUYnK0DD4ZJY=; b=jVKeoLjXBlfcI2/4fOP6tBmoT7zyJ3y+vX91MIL4kbCJ/8OJLzCkX/yDMhOpA/T7AG yHFxj5ACe27TTeWpiaEU5jtjMxD8b7HbMaqd61zZ1WEnKFjl4tGOJnpC8dLAkAvGOjKw wsZFTOK9iVN4MZl79Nm4JRLN7dUqUKettlF5R3P+9dKiW3SyiBuHw2K9aJtpH6jpxztG LxXzUgd6zHCt+spIzTXxJxq5hQ7Vc8JuMCm2buTPSCIjC/DV/waV2zBJxXZg+PSgxASR YHR7Wpfxlf5TWZekSf67fkyNAeIyyDFIAtjtZz6mOm63LxfUD3G/blB+xT0GbN2qHQuS /F2A== Received: by 10.68.200.104 with SMTP id jr8mr13388141pbc.9.1341371228702; Tue, 03 Jul 2012 20:07:08 -0700 (PDT) Received: from [192.168.1.99] ([61.199.203.168]) by mx.google.com with ESMTPS id tj8sm16766281pbc.10.2012.07.03.20.07.07 (version=SSLv3 cipher=OTHER); Tue, 03 Jul 2012 20:07:08 -0700 (PDT) Message-ID: <4FF3B358.9040307@gmail.com> Date: Wed, 04 Jul 2012 12:07:04 +0900 From: Shigeru HANADA User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: digoal@126.com CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6708: pgsql_fdw's foreign table cann't used in plpgsql function References: In-Reply-To: Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201207/15 X-Sequence-Number: 33491 (2012/06/27 9:02), digoal@126.com wrote: > pgsql_fdw's foreign table "cache lookup failed for type 0" bug when used in > function Thanks for the report! I could reproduce the problem. The cause of error was wrong handling of parameters given by PL/pgSQL for PL/pgSQL variables and parameters. They need instantiation with callback routine, and might have InvalidOid (0) for type oid. I fixed pgsql_fdw for two points: 1) instantiate parameters given by PL/pgSQL with callback function 2) use TEXTOID for type-unknown parameters which are not used in remote query Please try HEAD of git. https://sourceforge.net/projects/interdbconnect/develop Regards, -- Shigeru HANADA