Re: using xmin in a query?

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: using xmin in a query?
Date: 2011-07-28 21:55:31
Message-ID: CAOzAqu+cbc-hx7gEAEeTafzx46rOXHX0aFvrqxvXdoLThXp51g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jul 28, 2011 at 2:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Michael Nolan <htfoot(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-07-28 22:09:09 Re: using xmin in a query?
Previous Message Tom Lane 2011-07-28 19:27:45 Re: using xmin in a query?