From: Karel Zak <zakkr@zf.jcu.cz>
To: Oliver Jowett <oliver@opencloud.com>
Cc: alvherre@dcc.uchile.cl
Cc: tgl@sss.pgh.pa.us
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [HACKERS] Weird prepared stmt behavior
Date: Thu, 6 May 2004 10:25:45 +0200
Message-ID: <20040506082544.GF6749@zf.jcu.cz> (raw)
In-Reply-To: <40941FF2.4080903@opencloud.com>
References: <40941FF2.4080903@opencloud.com>
On Sun, May 02, 2004 at 10:08:50AM +1200, Oliver Jowett wrote:
> If PREPARE can roll back, the driver must maintain a set of all
> statements that were sucessfully PREPAREd in the current transaction,
> and fix up the corresponding query object state whenever a transaction
> rolls back.
>
> From that point of view, it's much simpler to keep PREPARE (or at least
> Parse) as it currently is. I suspect the same argument applies to any
> interface layer that uses PREPARE or Parse automatically.
Exactly.
Tom, will work these two scenarios:
1/ I have web application that uses persistent connetions to PostgreSQL
backend. After the connection opening the application prepares all
queries and the rest of the application code uses EXECUTE statement
only. It means the EXECUTE statemens are used in next arbitrary
transactions.
2/ The other way which my application uses is "prepare query first
time when some code needs it" -- and it's independend on actual
transaction of course. I use this way now, beacuse it's more
effective for me than prepare all queries after the connection startup.
If I good understand your idea the case 1/ will work, but case 2/ not.
I have no care about
BEGIN;
CREATE TABLE xxx (id serial);
PREPARE q AS SELECT * FROM xxx;
ABORT;
EXECUTE q;
ERROR: relation with OID 38242 does not exist
because I can detect it by error message and it's too academic problem
for me. I don't change DB schema in stable and production server and I
think ALTER/DROP/CREATE is nothing often in running and good designed
databases.
Karel
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: zakkr@zf.jcu.cz, oliver@opencloud.com, alvherre@dcc.uchile.cl, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Weird prepared stmt behavior
In-Reply-To: <20040506082544.GF6749@zf.jcu.cz>
References: <40941FF2.4080903@opencloud.com> <20040506082544.GF6749@zf.jcu.cz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox