Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vw9Hv-0002j3-WB for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2013 11:39:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vw9Hu-0005pU-Bt for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2013 11:39:38 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vw9Ht-0005pO-CP for pgsql-bugs@postgresql.org; Thu, 26 Dec 2013 11:39:37 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vw9Hq-0003SM-4g for pgsql-bugs@postgresql.org; Thu, 26 Dec 2013 11:39:36 +0000 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 2D1A62094A for ; Thu, 26 Dec 2013 06:39:32 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 26 Dec 2013 06:39:32 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=imap.cc; h= message-id:date:from:mime-version:to:subject:content-type :content-transfer-encoding; s=mesmtp; bh=yILyjG2cU6bv57o5/8tqLvw I1NM=; b=QAckmVYWqXKZs70fgvABbddnuRmhkZ8mk4Z9ylAurwiCKEnejjCGE5y pLlKUK+6SPiUXvsVfujXbIvIiv1+UyzakZImXKbIaTUF5yYZCHynqXKTQfeQ/xpj jWDb6cvf4sl1XpVqry4XkfSWSPTTmS2vnL+amaKbwUhyu0s7HM3o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:content-type:content-transfer-encoding; s=smtpout; bh=y ILyjG2cU6bv57o5/8tqLvwI1NM=; b=Yz7r6TpYK2pMU3IY+qKmHGZqzyllQLCxt aX1uyRaPkCKTcHC1zh5dh0jyoTAJsnoQurAUWHRayhUWIyy5aIAMKeZoSFoPO1Op dOOZZDzsMiLn0Absran+2e+JMDuDJ5dQfl47r3sTjGfBOOuuqKue3Z1gyXenh30R 6fNLvE1lW8= X-Sasl-enc: 2mRBv8x3C5aJ7m1Z5QXwgR7hDiJAlTcSY9tq8bbamhpt 1388057971 Received: from [192.168.1.23] (unknown [195.91.155.97]) by mail.messagingengine.com (Postfix) with ESMTPA id B82A9C00E88 for ; Thu, 26 Dec 2013 06:39:31 -0500 (EST) Message-ID: <52BC1572.9050201@imap.cc> Date: Thu, 26 Dec 2013 15:39:30 +0400 From: Alexey Bashtanov User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: postgresql tries to reuse plan but fails because the (dynamic) query has changed Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, all! The following behavior found. [ACTIONS] execute the following code: do $$ declare a text; cur record; begin foreach a in array array['p'] loop for cur in execute 'select ' || a || ' r from generate_series(3, 3) p' loop raise notice '%', cur.r; end loop; end loop; foreach a in array array['p||'',''||p*p'] loop for cur in execute 'select ' || a || ' r from generate_series(3, 3) p' loop raise notice '%', cur.r; end loop; end loop; foreach a in array array['p', 'p||'',''||p*p'] loop for cur in execute 'select ' || a || ' r from generate_series(3, 3) p' loop raise notice '%', cur.r; end loop; end loop; end; $$; [EXPECTED] NOTICE: 3 NOTICE: 3,9 NOTICE: 3 NOTICE: 3,9 DO [RECEIVED] NOTICE: 3 NOTICE: 3,9 NOTICE: 3 ERROR: type of parameter 4 (text) does not match that when preparing the plan (integer) CONTEXT: PL/pgSQL function inline_code_block line 18 at RAISE [VERSION] PostgreSQL 9.3.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3), 64-bit Linux 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux also reproduced at postgresql 9.1.9, 9.3.2 [ALSO] If current behavior is OK, please treat this bugreport as a bugreport on documentation. In what cases record variable is allowed or is not allowed to change its structure? Regards, Alexey Bashtanov -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs