473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

XID Data Types

Hello everyone,

Take the query below:

select *,xmin from settings where xmin > '187167023'::xid limit 5;

Although the docs say this is a 32 bit datatype, I have casted the
integer '187167023' also to an xid type, but it seems that there is no
operator to do a comparison, since I get this error:

didit=# select *,xmin from settings where xmin > '187167023'::xid limit 5;
ERROR: operator does not exist: xid > xid

Any pointers or suggestions?

- Ericson
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
9 5078
On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <er**@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.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2
On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <er**@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.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #3
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 <er**@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.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #4
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 <er**@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.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #5
Manfred Koizar wrote:
On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <er**@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.


Slony contains an xxid data type that follows exactly the xid semantics.
It comes with a full operator class so that you can even put indexes on
xxid type columns. Shouldn't be too hard to define those operators for
the builtin xid type instead.
Jan

--
#================================================= =====================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #6
Jan Wieck wrote:
Manfred Koizar wrote:
On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <er**@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.


Slony contains an xxid data type that follows exactly the xid semantics.
It comes with a full operator class so that you can even put indexes on
xxid type columns. Shouldn't be too hard to define those operators for
the builtin xid type instead.


Should we just get that into our CVS so Slony doesn't have to distribute
its own?

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #7
Bruce Momjian wrote:
Jan Wieck wrote:
Manfred Koizar wrote:
> On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <er**@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.


Slony contains an xxid data type that follows exactly the xid semantics.
It comes with a full operator class so that you can even put indexes on
xxid type columns. Shouldn't be too hard to define those operators for
the builtin xid type instead.


Should we just get that into our CVS so Slony doesn't have to distribute
its own?


It has to anyway, at least as long as it is supposed to be a version
upgrade aid that supports replicating from 7.3.x or 7.4.x to a newer
version so that the upgrade downtime reduces to a few seconds for a
master->slave switchover.
Jan

--
#================================================= =====================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #8
Jan Wieck <Ja******@Yahoo.com> writes:
Bruce Momjian wrote:
Should we just get that into our CVS so Slony doesn't have to distribute
its own?
It has to anyway, at least as long as it is supposed to be a version
upgrade aid that supports replicating from 7.3.x or 7.4.x


No doubt ... but I agree that we *should* push full comparison support
for type XID into CVS.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #9
Tom Lane wrote:
Jan Wieck <Ja******@Yahoo.com> writes:
Bruce Momjian wrote:
Should we just get that into our CVS so Slony doesn't have to distribute
its own?

It has to anyway, at least as long as it is supposed to be a version
upgrade aid that supports replicating from 7.3.x or 7.4.x


No doubt ... but I agree that we *should* push full comparison support
for type XID into CVS.


Yes, let's at least match it so we can have testing of the code in both
places, and prevent the need to load them in if the version is new
enough.

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: GGG | last post by:
I have a situation where at tool is passing me a large array of strings that I need to process in a particular type of data. Each item in the array gets to me as a pair of std::strings, basically,...
13
by: Shailesh Humbad | last post by:
I wrote a short page as a quick reference to c++ integer data types. Any feedback welcome: http://www.somacon.com/blog/page11.php
11
by: theshowmecanuck | last post by:
As a matter of academic interest only, is there a way to programmatically list the 'c' data types? I am not looking for detail, just if it is possible, and what function could be used to...
8
by: ramu | last post by:
Hi, I want to call a vc++ function from a c program on linux. So when I do this dosen't the VC++ datatypes differ with c datatypes. Because we don't have some vc++ data types in c. I have to...
11
by: mesut demir | last post by:
Hi All, When I create fields (in files) I need assign a data type like char, varchar, money etc. I have some questions about the data types when you create fields in a file. What is the...
7
by: Arpan | last post by:
The .NET Framework 2.0 documentation states that An Object variable always holds a pointer to the data, never the data itself. Now w.r.t. the following ASP.NET code snippet, can someone please...
18
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning...
3
by: psbasha | last post by:
Hi , When ever we read any data from file ,we read as a single line string ,and we convert the respective field data available in that string based on the data type ( say int,float ). ...
1
by: Alex | last post by:
Hi, I have three different data types coming out of my SQL tables that I need to align with my VB code and the data set properties. I'm getting an error message that reads "SQL exception...
0
by: Hags007 | last post by:
I have a XML file I am working with. This file has been created by hand and I now need to develop a PHP script that will create it in the same format. Here is what I have thus far: $query =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.