using xmin in a query?

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: using xmin in a query?
Date: 2011-07-28 16:40:04
Message-ID: CAOzAquJ9oiqLx9iw50V_jUOMw1tt1YT06wPSSnhEdJ5mAt5LEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Why does this query succeed:

select count(*) from tablename where xmin = 2

while this query fails:

select count(*) from tablename where xmin != 2

The latter will generate an error message (using 9.0.4, but it does not seem
to be version specific):

ERROR: operator does not exist: xid <> integer
LINE 1: select count(*) from tablename where xmin != 2;
^
HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.

What cast or comparison operator would work? You cannot cast an xid to an
integer, nor can you cast an integer to an xid.

The only way I can get this to work is:

select count(*) from tablename where not xmin = 2

That seems pretty obscure.
--
Mike Nolan
nolan(at)tssi(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2011-07-28 17:23:15 Re: using xmin in a query?
Previous Message Merlin Moncure 2011-07-28 16:00:22 Re: eval function