From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | siracusa(at)mindspring(dot)com |
Cc: | Postgres Performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Feature request: smarter use of conditional indexes |
Date: | 2004-03-06 21:06:09 |
Message-ID: | 18409.1078607169@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
John Siracusa <siracusa(at)mindspring(dot)com> writes:
> So apparently all I can do is find out if it's a null test, but not if it is
> specifically "IS NOT NULL"
No, because once you have determined that the node really IsA NullTest,
you can cast the pointer to (NullTest *) and look at the
NullTest-specific fields. Think of this as poor man's object-oriented
programming: Node is the supertype of Expr which is the supertype of
NullTest (and a lot of other kinds of nodes, too).
It'd look something like
if (IsA(predicate, NullTest) &&
((NullTest *) predicate)->nulltesttype == IS_NOT_NULL)
{
/* check to see if arg field matches either side of opclause,
* and if so check whether operator is strict ...
*/
}
You can find plenty of examples of this programming pattern throughout
the backend. In fact pred_test_simple_clause is doing exactly this
to check that what it's given is an OpExpr and not some other node type.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | John Siracusa | 2004-03-06 21:55:33 | Re: Feature request: smarter use of conditional indexes |
Previous Message | Tom Lane | 2004-03-06 20:52:26 | Re: Fixed width rows faster? |