Received: from smtp4.mail.yahoo.com (smtp4.mail.yahoo.com [128.11.69.101]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f18DJlx06849 for ; Thu, 8 Feb 2001 08:19:48 -0500 (EST) (envelope-from janwieck@yahoo.com) Received: from a5c54.pppool.de (HELO jupiter.greatbridge.com) (213.6.92.84) by smtp.mail.vip.suc.yahoo.com with SMTP; 8 Feb 2001 13:19:42 -0000 X-Apparently-From: Received: (from janwieck@localhost) by jupiter.greatbridge.com (8.9.3/8.9.3) id IAA03647; Thu, 8 Feb 2001 08:10:11 -0500 From: Jan Wieck Message-Id: <200102081310.IAA03647@jupiter.greatbridge.com> Subject: Re: PostgreSQL and PHP persistent connections In-Reply-To: <200102072050.PAA12110@candle.pha.pa.us> from Bruce Momjian at "Feb 7, 2001 03:50:53 pm" To: Bruce Momjian Date: Thu, 8 Feb 2001 08:10:11 -0500 (EST) CC: Tom Lane , "Thies C. Arntzen" , rasmus@php.net, PostgreSQL-interfaces X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/59 X-Sequence-Number: 1012 Bruce Momjian wrote: > > Bruce Momjian writes: > > > We discussed using 'ROLLBACK' before passing a connection to a new user, > > > but the problem was that ROLLBACK with no open transaction causes a > > > server log error message. We discussed adding 'ROLLBACK SILENT' to fix > > > this, but I believe a better, more portable solution is a simple "BEGIN > > > WORK;ROLLBACK". This will do nothing if there is no open transaction, > > > > How is that an improvement? It only changes the case in which you get > > a NOTICE from not-in-transaction to in-transaction ... > > Well, the most common case is that you are not in a transaction. Why not tracing PQcmdStatus(result) on the persistent connection? It allways returns "BEGIN", "COMMIT" or "ROLLBACK" for whatever you issued. Well, it'll not catch the uncommon case that someone might issue multiple queries in one statements (semicolon separated). But that's IMHO bad practice anyway and the above will avoid communication, context switching and eating up of XID's until we have silent rollback in 7.2. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com