how to get id of currently executed query? - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject how to get id of currently executed query?
Date
Msg-id 20070816113011.GA15919@depesz.com
Whole thread Raw
Responses Re: how to get id of currently executed query?
List pgsql-general
hi,
i need something to distinguish two separate calls for some select.

i tried to use c functions GetCurrentTransactionId() and
GetCurrentCommandId(),
but there is a problem:
if i'll make plpgsql function, which uses GetCurrentTransactionId() and
GetCurrentCommandId() - getCurrentCommandId changes ( sql's from
functions also increment the command-id-counter).

so my question is - is there any way, to be able to tell "one query from
another"?

i would like to write a plpgsql function that would be able to
differentiate somehow it's calls from one statement to another.

i'm not sure if my description is correct - if you dont understand
something, please let me know.

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)

pgsql-general by date:

Previous
From: Rainer Bauer
Date:
Subject: Re: Yet Another COUNT(*)...WHERE...question
Next
From: Gregory Stark
Date:
Subject: Re: Yet Another COUNT(*)...WHERE...question