473,396 Members | 1,965 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,396 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 5097
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.