473,804 Members | 3,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XID Data Types

Hello everyone,

Take the query below:

select *,xmin from settings where xmin > '187167023'::xi d 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'::xi d 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 5174
On Mon, 03 May 2004 13:38:45 -0400, Ericson Smith <er**@did-it.com>
wrote:
didit=# select *,xmin from settings where xmin > '187167023'::xi d 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 YourEmailAddres sHere" to ma*******@postg resql.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'::xi d 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 YourEmailAddres sHere" to ma*******@postg resql.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'::xi d 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'::xi d 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'::xi d 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'::xi d 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.ph a.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'::xi d 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*******@postg resql.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.ph a.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
1941
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, one string represents the data, one string represents the data type. Here's a quick example of what it sort of looks like string data = { "0.0000002342", "12.00234", "42", "5" }; string types = { "EF", "EF", "I", "I" }; //EF is 64 bit float,...
13
3697
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
3194
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 accomplish it. For example: int main void() { while there are more data types { print next data type; }
8
3274
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 convert the vc++ datatypes into c data types or i have to use eqvivalent data types. Can someone give me some idea how to convert or about the equivalent data types? Thanks in Advance,
11
3443
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 difference between data type 'CHAR' and 'TEXT'? When do you use 'VAR' in your datatype word? e.g. VARCHAR ?
7
2863
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 explain me what does the above statement mean? <script runat="server"> Class Clock
18
2761
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 from the experts. I feel there's a tradeoff between clear, easily readdable and extensible code on one side, and safe code providing early errors and useful tracebacks on the other. I want both! How do you guys do it? What's the pythonic way? Are...
3
3263
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 ). Please suggest me which is the best way of handling the file data. I- Method: ---------------- Store as single line string data's(upto end of file ) in a list and make use of this string list for the entire application.
1
1342
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 unhandled. The data types text and nvarchar are incompatible in the equal to operator." Here is the relevant code. Dim da As New SqlDataAdapter(strSQL, cn) da.SelectCommand.Parameters.AddWithValue("@OrderID", tbOrderID.Text)
0
2964
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 = "select * from " . $table_name . " ORDER BY stateID ASC"; $result = mysql_query($query, $connection) or die("Could not complete database query"); $num = mysql_num_rows($result); if ($num != 0) {
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10319
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9144
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.