Skip site navigation (1) Skip section navigation (2)

Re: [Re] Re: PREPARE and transactions

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [Re] Re: PREPARE and transactions
Date: 2004-07-02 21:51:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Hash: SHA1
> So again, I'd like to hear any comments about my pattern-matching
> proposal.  Is there any problem here that it would not solve?
> Does anyone see a problem in implementing them?
Quoting. Extra parsing work.
Specifically, your proposal (if I read it correctly) would require me
to send in the full SQL statement every time, thus negating a major
benefit of prepared statements in that I do not have to quote the
values myself, but can let the server handle it. It would also be a lot
of work for the server to parse the statement and find a "match".
Maybe enough work to make the "solution" worse than the cure.
If, on the other hand, you are suggesting sending the statement and
parameters separately, that would be slightly better, but (like above)
it would be quite a bit of extra traffic to send the whole query and
variables for every single execute.
Finally, I am still not convinced there is a problem at all. While the
current behavior is a bit quirky, I think it does work out overall.
A prepared statement will throw an error on two conditions:
1) The name is already in use.
This is trivial to solve by the client, so it should never arise.
(with the caveat that middleware should clearly document its naming
scheme, and request and/or enforce that the client not creating
conflicting names). So we really should remove this from the debate.
2) The statement is invalid.
This one is very common, and it /should/ throw an error. With the fact
that statements cannot be shared across connections, and the handy
PQtransactionStatus function, the client should easily be able to
handle any situation that arises smoothly.
Having the statement exist even on rollback is a little harder to
accept, but I have yet to see a better alternative. Prepare statements
already "break the rules" anyway, by the fact that a commit() after a
prepare does not make them available to any other people viewing
the database.
- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200407021729

In response to


pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2004-07-02 22:03:13
Subject: Re: Nested Transactions, Abort All
Previous:From: Jeroen T. VermeulenDate: 2004-07-02 21:51:01
Subject: Re: Nested Transactions, Abort All

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group