Search Postgresql Archives

Re: Getting rows in statement-level triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 3, 2008 at 11:42 AM, Artacus <artacus@xxxxxxxxxxx> wrote:

So the manual says there is no way for a statement-level trigger to examine the row(s) modified by the statement.

Is there any way to get the xmin or cmin of the transaction that fired the trigger? Or can I look up the last xid for a table some where?

Ok, so it took a lot of googling to figure this one out, but you can do it with something like so.

SELECT *
FROM strand_scores
WHERE xmin::text = txid_current()::text

It appears you can't convert a xid type to int or bigint, not sure why. I guess I should leave a comment on the manual page.

That's an interesting find, i'd say.

xmin::bigint doesn't work because that implicit CAST doesn't exist. If needed, I'd use xmin::text::bigint; that should work.

Best regards,
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB      http://www.enterprisedb.com

Mail sent from my BlackLaptop device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux