Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0lUL-0003Xk-6O for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Dec 2014 06:20:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y0lUK-0002hY-Mt for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Dec 2014 06:20:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y0lUJ-0002hQ-Iw for pgsql-bugs@postgresql.org; Tue, 16 Dec 2014 06:20:03 +0000 Received: from mail-la0-x232.google.com ([2a00:1450:4010:c03::232]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y0lUG-0002hp-Kz for pgsql-bugs@postgresql.org; Tue, 16 Dec 2014 06:20:01 +0000 Received: by mail-la0-f50.google.com with SMTP id pn19so10576378lab.23 for ; Mon, 15 Dec 2014 22:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:date:to:subject:mime-version:content-transfer-encoding :from:message-id:user-agent; bh=TlAcPBqzhKFBOoiu+gRP9/l16U+Kw9OvEBfcnp9eh2c=; b=qs2RVKXXQ352/TCmSSYN43XY7ZtSA+4yt8eXqaRYJ742+pWYPH9JS3udo6eT0eK0kr qQEeEc2gqKfHlGpw30c7LNqaRRLD8XQjdj35XrJLPg3VBNfov9gZWabvfybqK2i1GsGf lsdbr7OV+Q1iuklv84HP0PVZ2Ub0xoUY3Hystn8bHsW7cd5wVY/3kpeIcFlkJLWR+i9d W6LTUlKla/vrbQKACMPMGYoOOR5iQSQhJIiPEwrxle+3qqDuYqoM4xQeDoXNJ2e9ZCyR yWoPGNnIoQ+/WueTk3UP1EdFo+6IeMEpAK3+el0FY9TfhYtqgKR2WZGsMmcVdWGIOy8+ sJKg== X-Received: by 10.152.5.67 with SMTP id q3mr33774372laq.73.1418710797809; Mon, 15 Dec 2014 22:19:57 -0800 (PST) Received: from pushkinsv.ood.local (pp.sfo.rosinv.ru. [93.157.241.40]) by mx.google.com with ESMTPSA id pz3sm3165526lbb.27.2014.12.15.22.19.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 22:19:55 -0800 (PST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Date: Tue, 16 Dec 2014 13:19:52 +0700 To: pgsql-bugs@postgresql.org Subject: execution plan and record variable in dynamic sql MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: =?utf-8?B?0J/Rg9GI0LrQuNC9INCh0LXRgNCz0LXQuQ==?= Message-ID: User-Agent: Opera Mail/12.16 (Linux) 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 Hello! The following code results in error, if executed in one session: create or replace function exec(sql text) returns void language plpgsql as $_$ declare r record; begin execute sql into r; -- works ok everytime raise notice 'r %', r; -- fails if type of r.status differs from first exec invocation -- making r.status inaccessible raise notice 'r.status %', r.status; end; $_$; select * from exec($$ select 1 as status $$); select * from exec($$ select 'test' as status $$); Results: NOTICE: r (1) NOTICE: r.status 1 exec ------ (1 row) NOTICE: r (test) ERROR: type of parameter 4 (unknown) does not match that when preparing the plan (integer) Context: PL/pgSQL function exec(text) line 8 at RAISE Version: PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-2) 4.9.2, 64-bit also checked on PostgreSQL 9.1.9 Thanks! -- Serge Pushkin -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs