Re: Getting rows in statement-level triggers

From: Artacus <artacus(at)comcast(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting rows in statement-level triggers
Date: 2008-10-03 16:21:59
Message-ID: 48E646A7.90907@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>> 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
Well the good news there is that it won't break during the period we
have to provide free bug fixes :)
Inserting a row to get the xid seems pretty kludgy.

If you wouldn't mind answering a few more questions Tom:

* So what exactly happens at the 4 billion mark?
* Why can't I cast an xid to int or bigint?
* The table in question is the largest in the db. How performative
is it to query based on xmin? Is xmin indexed? Can it be?

BTW, if there were no demand for a convenient way to get your xid, then
there shouldn't be a "traditional" way :)

Artacus

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Richardson 2008-10-03 16:40:32 Re: How do I save data and then raise an exception? -- solved
Previous Message Blazej 2008-10-03 16:10:37 Re: How do I save data and then raise an exception?