Re: using xmin in a query? - Mailing list pgsql-general

From Michael Nolan
Subject Re: using xmin in a query?
Date
Msg-id CAOzAqu+cbc-hx7gEAEeTafzx46rOXHX0aFvrqxvXdoLThXp51g@mail.gmail.com
Whole thread Raw
In response to Re: using xmin in a query?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: using xmin in a query?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general


On Thu, Jul 28, 2011 at 2:27 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Michael Nolan <htfoot@gmail.com> writes:
> Why does this query succeed:
> select count(*) from tablename where xmin = 2

> while this query fails:

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

It told you why not:

> ERROR:  operator does not exist: xid <> integer

You could do "where not (xmin = 2)", I suppose.

I understand that, Tom, and my original posted did cite 'not xmin = 2' as working. 

The parentheses appear to be optional, though in a more complex query they would probably be necessary to make sure it parses properly.

It appears to me that it is doing an implicit cast of the integer '2' into an xid in the first query.

It seems like we're being inconsistent here in allowing 'where xid = integer'
but not allowing 'where xid != integer'.

Is there no explicit 'cast to xid' available?
--
Mike Nolan

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: using xmin in a query?
Next
From: Tom Lane
Date:
Subject: Re: using xmin in a query?