Re: Small question

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <janwieck(at)yahoo(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joep deVocht <joep(at)masktools(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Small question
Date: 2002-03-22 19:25:24
Message-ID: 200203221925.g2MJPOL26910@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jan Wieck wrote:
> Bruce Momjian wrote:
> > Tom Lane wrote:
> > > Jan Wieck <janwieck(at)yahoo(dot)com> writes:
> > > > Joep deVocht wrote:
> > > >> Is there a way to determine whether a transaction
> > > >> is started and not ended yet?
> > >
> > > > I think it's time to add a little boolean function, that
> > > > actually returns IsTransactionBlock(), and have a libpq side
> > > > wrapper around PQfn() calling it.
> > >
> > > If you're in TRANSACTION ABORT state, I do not think that will work.
> > >
> > > Offhand this seems more of a protocol issue. A straightforward solution
> > > would be to add a status indicator (with three states: out of
> > > transaction, in transaction, in aborted transaction) to the
> > > ReadyForQuery message, but we can't do that without a protocol change,
> > > which is probably more trouble than it's worth.
> >
> > Yes, I was wondering if it was worth having the client call the function
> > at the end of every query.
>
> Who said that it'll be called after every query? It will
> only be called when the application asks for the current
> state. Sort of client side
>
> bool PQisTransactionBlock(PGconn *conn);
>
> I don't really see how that functionality could be a problem.

I just thought that most applications that need to know the state need
to know for almost every new query. We had the request to update the
psql prompt with transaction status, and clearly the call would be
needed frequently.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-03-22 19:26:34 Re: Small question
Previous Message Jan Wieck 2002-03-22 19:19:05 Re: Small question