insert/update/delete statements returning a query response

From: Barry Lind <barry(at)xythos(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Cc: stuart(at)zapata(dot)org
Subject: insert/update/delete statements returning a query response
Date: 2001-11-26 21:01:37
Message-ID: 3C02ADB1.5090000@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Is this behavior intended in the backend? The problem is that when you
create a rule on an object that calls a stored function and invoke that
rule on an insert/update/delete statement your insert/update/delete
statement will now return a query result to the front end over the FE/BE
protocol. (I am not sure this is the exact senerio, but something
similar). This means that the user now needs to perform a
executeQuery() call when using these insert/update/delete statements in
JDBC because the JDBC driver isn't able to accept a query response when
issuing a insert/update/delete call.

thanks,
--Barry

-------- Original Message --------
Subject: Re: CallableStatements
Date: Mon, 26 Nov 2001 12:14:32 -0800 (PST)
From: Stuart Robinson <stuart(at)zapata(dot)org>
To: Rene Pijlman <rene(at)lab(dot)applinet(dot)nl>
CC: <pgsql-jdbc(at)postgresql(dot)org>

There are various circumstances where you might want to call a stored
procedure with an executeUpdate method. For example, let's suppose you
have a view that combines a couple of tables and you want an application
you're building to be able to write to it. Since views are read-only, you
would create a rule that intercepts the inserts and updates and fires off
a stored procedure instead. Since the application is doing an insert or an
update, it will use executeUpdate, but the stored procedure will have to
use select and return a result, causing the application to error out.

-Stuart

On Mon, 26 Nov 2001, Rene Pijlman wrote:

> On Mon, 26 Nov 2001 10:40:52 -0800 (PST), you wrote:
> >But if you use the executeUpdate method, you'll get an error, because it
> >isn't expecting a result, no? So, how do you call a stored procedure
using
> >executeUpdate?
>
> You don't. In the current implementation you need to use a
> SELECT statement. Why is that a problem?
>
> Regards,
> René Pijlman <rene(at)lab(dot)applinet(dot)nl>
>

--
Stuart Robinson [stuart(at)zapata(dot)org]
http://www.nerdindustries.com
http://www.tzeltal.org

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-11-26 21:45:41 DEBUG lines in server log
Previous Message Bruce Momjian 2001-11-26 20:22:55 Re: Minor buglet in update...from (I think)

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nate Gelbard 2001-11-26 21:02:53 Re: JDBC bug?
Previous Message Bruce Momjian 2001-11-26 20:53:56 Re: JDBC bug?