Home > Archive > PostgreSQL Bugs > December 2005 > Re: BUG #2102: Backend reports wrong number of affected rows for a









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: BUG #2102: Backend reports wrong number of affected rows for a
bfraci@aol.com

2005-12-27, 9:23 am

Thanks for your response.

Let me see if I understand this correctly. If the original query is an update and the instead rule replaces it with an update, then I should get a return status that is not zeros. And if the original query was an update and the instead rule replaced it
with something other than an update, then I should expect the return status to be zeros.

In my case we have an unconditional instead rule. The original query was an update and the instead rule replaced it with an update of another table; an update was replaced with an update. Then I should expect to see the status of the last query that was
inserted by the instead rule. So I should not see a status of zero.

Is that correct?

Thanks for all your help,

Brent





-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brent Reid <bfraci@aol.com>
Cc: pgsql-bugs@postgresql.org
Sent: Fri, 09 Dec 2005 11:41:26 -0500
Subject: Re: [BUGS] BUG #2102: Backend reports wrong number of affected rows for a table that uses rules


"Brent Reid" <bfraci@aol.com> writes:
> Our Java application depends upon the return values from the various JDBC
> insert, update, and delete routines. We noticed that the value is always
> zero when the table that is referenced has rules associated with it.


Have you read
http://www.postgresql.org/docs/8.0/...les-status.html

regards, tom lane

Tom Lane

2005-12-27, 9:24 am

bfraci@aol.com writes:
> In my case we have an unconditional instead rule. The original query was an update and the instead rule replaced it with an update of another table; an update was replaced with an update. Then I should expect to see the status of the last query that w

as inserted by the instead rule. So I should not see a status of zero.

Well, you'll see the status of the last UPDATE executed due to a rule
.... but that doesn't mean it couldn't have updated zero rows. It might
be worth pointing out here that conditional rules insert queries that
have the condition added to their WHERE clause; if the condition is
false then no rows are going to get processed.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com