Re: Small question

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jan Wieck <janwieck(at)yahoo(dot)com>, Joep deVocht <joep(at)masktools(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Small question
Date: 2002-03-22 19:11:17
Message-ID: 200203221911.g2MJBHl16196@saturn.janwieck.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Sort of, because that's the only moment when PQfn() will
result in something different than PGRES_COMMAND_OK :-)

>
> 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.
>
> It seems like it might be possible for libpq (or other clients) to keep
> track of the transaction state by paying attention to BEGIN, COMMIT,
> ABORT command-completion tags and ERROR messages, but I haven't worked
> through the details.

PQexec(c, "BEGIN; SELECT now()");

Will there even be a BEGIN command tag sent?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2002-03-22 19:19:05 Re: Small question
Previous Message Joel Burton 2002-03-22 19:08:28 initdb dies during IpcSemaphoreCreate under BSD jail