Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwdTC-0006rh-83 for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jul 2013 19:21:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UwdTB-0005Jq-Ls for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jul 2013 19:21:01 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwdTB-0005Jk-1N for pgsql-bugs@postgresql.org; Tue, 09 Jul 2013 19:21:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwdT8-0003mo-Ng for pgsql-bugs@postgresql.org; Tue, 09 Jul 2013 19:21:00 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r69JKv41002129; Tue, 9 Jul 2013 15:20:57 -0400 (EDT) From: Tom Lane To: potapov.dmitry@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8289: pg_stat_statements incorrect query text when executing multiple queries in a single PQexec In-reply-to: References: Comments: In-reply-to potapov.dmitry@gmail.com message dated "Tue, 09 Jul 2013 15:05:19 -0000" Date: Tue, 09 Jul 2013 15:20:56 -0400 Message-ID: <2128.1373397656@sss.pgh.pa.us> X-Pg-Spam-Score: 0.5 (/) 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 potapov.dmitry@gmail.com writes: > The testcase runs five UPDATE commands with two PQexec calls. > First PQexec call runs: "UPDATE t1 SET a=101 WHERE id=0; UPDATE t1 SET a=102 > WHERE id=1; UPDATE t1 SET a=103 WHERE id=2" > Second PQexec call runs: "UPDATE t2 SET b=1 where a=0; UPDATE t2 SET a=2 > WHERE b=3" > I expect pg_stat_statements to contain three records with following query > texts: > 1) UPDATE t1 SET a=? WHERE id=? > 2) UPDATE t2 SET b=? where a=? > 3) UPDATE t2 SET a=? WHERE b=? > Instead it contains three records with following query texts: > 1) "UPDATE t2 SET b=1 where a=0; UPDATE t2 SET a=? WHERE b=?" > 2) "UPDATE t1 SET a=? WHERE id=?; UPDATE t1 SET a=102 WHERE id=1; UPDATE t1 > SET a=103 WHERE id=2" > 3) "UPDATE t2 SET b=? where a=?; UPDATE t2 SET a=2 WHERE b=3" Yeah, that's what's going to happen, because there is no infrastructure for determining which portion of the source text string belongs to which query. I suspect there are some other infelicities in pg_stat_statements' behavior for multi-query strings, too. At least for now, that combination is best avoided. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs