Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UhEnO-0006jQ-5d for pgsql-bugs@arkaria.postgresql.org; Tue, 28 May 2013 07:58:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UhEnM-000538-SA for pgsql-bugs@arkaria.postgresql.org; Tue, 28 May 2013 07:58:12 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UhEnL-000532-V5 for pgsql-bugs@postgresql.org; Tue, 28 May 2013 07:58:12 +0000 Received: from 88-190-26-230.rev.dedibox.fr ([88.190.26.230] helo=sd-30687.dedibox.fr) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UhEnA-0003Z0-4a for pgsql-bugs@postgresql.org; Tue, 28 May 2013 07:58:11 +0000 Received: from [192.168.10.5] (AMontsouris-652-1-222-92.w92-128.abo.wanadoo.fr [92.128.101.92]) by sd-30687.dedibox.fr (Postfix) with ESMTPSA id 7C83B642CC8; Tue, 28 May 2013 09:57:58 +0200 (CEST) Message-ID: <1369727864.2726.4.camel@localhost.localdomain> Subject: Re: bug in Prepared statement with DELETE RETURNING and rule on view From: Guillaume Lelarge To: Amit Kapila Cc: 'Brice =?ISO-8859-1?Q?Andr=E9=27?= , pgsql-bugs@postgresql.org Date: Tue, 28 May 2013 09:57:44 +0200 In-Reply-To: <005101ce5b72$903b5550$b0b1fff0$@kapila@huawei.com> References: <005101ce5b72$903b5550$b0b1fff0$@kapila@huawei.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.6.4 (3.6.4-3.fc18) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: 1.8 (+) 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 On Tue, 2013-05-28 at 12:41 +0530, Amit Kapila wrote: > On Tuesday, May 28, 2013 12:39 AM Brice André wrote: > > Dear all, > > > > I found what I really think is a bug in the postgresql 8.4. > > > > I have an sql database structure in which a real table has a column > > that is used to mark the entries as deleted without really deleting > > them. Then, I have a view that is hiding this to the users, with proper > > rules that perform real actions on the table. So, a ON DELETE rule on > > this view is performing an UPDATE which marks the rows as delete > > without deleting them. The view is hiding the rows tagged as deleted. > > > > This code is working from several years and I have a web-service that > > performs several actions on top of this database. Those actions include > > a "DELETE ... RETURNING ..." command on the view. This web-service was > > implemented by a php script that did not use any prepared statement, > > and everything was working properly. > > > > I had performance issue with this solution and I decided to rewrite the > > service in C++, and to use prepared statements. The SQL commands are > > exactly the same, but they are now executed from a C++ application > > using libpq, and they use prepared statements. > > I had tried in latest 9.3 code with psql using prepared statements and it > worked fine, please see result below. > I shall check your libpq application code as well, but in the mean time can > you please verify whether the below works for you on 8.4 (I don't have 8.4 > setup). > It does work with psql and pgAdmin. The issue is with PQprepare, and PQexecPrepared. So yeah, you need to look at the application code. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs