On Thu, Jul 28, 2011 at 2:27 PM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
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'.
Michael Nolan <htfoot@xxxxxxxxx> writes:It told you why not:
> Why does this query succeed:
> select count(*) from tablename where xmin = 2
> while this query fails:
> select count(*) from tablename where xmin != 2
You could do "where not (xmin = 2)", I suppose.
> ERROR: operator does not exist: xid <> integer
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