how to get id of currently executed query?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to get id of currently executed query?
Date: 2007-08-16 11:30:11
Message-ID: 20070816113011.GA15919@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-08-16 11:31:14 Re: Yet Another COUNT(*)...WHERE...question
Previous Message Rainer Bauer 2007-08-16 11:09:32 Re: Yet Another COUNT(*)...WHERE...question