Re: Getting rows in statement-level triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Artacus <artacus(at)comcast(dot)net>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting rows in statement-level triggers
Date: 2008-10-03 12:10:19
Message-ID: 21969.1223035819@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Artacus <artacus(at)comcast(dot)net> writes:
> 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

This will not work, or at least it will stop working after your
installation passes 4 billion transactions.

The traditional way to find out your own XID is to insert a dummy row
somewhere (perhaps in a temp table) and see what its xmin is. I'm not
sure why we don't expose a more convenient way --- maybe just that
there's not been any demand for it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Saito 2008-10-03 12:27:21 Re: error compiling postgres source
Previous Message Leif B. Kristensen 2008-10-03 09:43:58 Re: Import German Number Format