Re: how to get id of currently executed query?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Decibel! <decibel(at)decibel(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: how to get id of currently executed query?
Date: 2007-08-16 17:21:21
Message-ID: 20070816172120.GA6478@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 16, 2007 at 11:20:30AM -0400, Tom Lane wrote:
> AFAIR, the only state that's guaranteed to work like that is
> statement_timestamp. Of course you have to worry whether your machine
> is fast enough to do more than one client interaction within whatever
> the clock resolution is.

i'll check it, thanks for tip.

> I think the real question here is why you want this behavior at all;
> to me it smells of not having thought the problem through correctly.
> As an example of why this bothers me: what if the user's query is
> rewritten into several queries by a RULE? Should you consider each
> of those to be a separate user-issued SQL command? Does your answer
> change if you know that the user himself prepared the RULE? (Do you
> think users will be happy if statement X followed by statement Y
> acts differently in a rule than elsewhere?)

definitelly. i need this only for some specific functions operating
within selects. i'll blog it as soon as i'll get all the details :)

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Gunther 2007-08-16 17:27:52 automatic rollback?
Previous Message Rodrigo De León 2007-08-16 17:15:19 Re: Function with Integer array parameter