Re: XID Data Types

Ericson Smith <eric@did-it.com>

From: Ericson Smith <eric@did-it.com>
To:
Cc: pgsql-general@postgresql.org
Date: 2004-05-03T21:31:51Z
Lists: pgsql-general

Attachments

I've been reading about the CREATE OPERATOR command.

Apparently there is an operator to test equality between an xmin type 
and an integer type, how do it go about creating another type to make a 
 > or < comparison ?

The documents are pretty straightforward about creating other types, but 
I was not able to find much information about the xid type. In pg_proc, 
I found that there are the following comparators:

xideqint4
xideq

Which would make a equal comparison between an xid = int4, or xid=xid. 
This seems to work ok. My goal is to find a decent way of syncing 
records with an external cache. The xmin field that exists within every 
table is updated whenever a transaction is successful on record(s). I 
have a process that will run, and look at the last xmin value (I stored 
in another table), and grab records that have an xmin greater than  the 
last stored value. We think that this is a better way to sync data than 
the old way of using triggers that updated a sync table on inserts and 
deletes. Only certain tables need to be sync'd with our external caches.

Any suggestions if this is the right way to go, or is there another way 
that this particular problem could be solved?

Any suggestions would be really appreciated.

Regards
- Ericson Smith


Manfred Koizar wrote:

>On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <eric@did-it.com>
>wrote:
>  
>
>>didit=# select *,xmin from settings where xmin > '187167023'::xid limit 5;
>>ERROR:  operator does not exist: xid > xid
>>    
>>
>
>There might be better solutions, but when I ran into the same problem,
>the age(xid) function helped at lot.
>
>
>  
>