diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-01 21:53:49 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-01 21:53:49 +0000 |
commit | 29c4ad98293e3c5cb3fcdd413a3f4904efff8762 (patch) | |
tree | 4e4eeea2655e87eca4d3d0dd97f3e2b7d5f1e032 /src/backend/access/common/scankey.c | |
parent | 15faca259651c065bb20e746777f5fb9eb9d50a1 (diff) | |
download | postgresql-29c4ad98293e3c5cb3fcdd413a3f4904efff8762.tar.gz postgresql-29c4ad98293e3c5cb3fcdd413a3f4904efff8762.zip |
Support "x IS NOT NULL" clauses as indexscan conditions. This turns out
to be just a minor extension of the previous patch that made "x IS NULL"
indexable, because we can treat the IS NOT NULL condition as if it were
"x < NULL" or "x > NULL" (depending on the index's NULLS FIRST/LAST option),
just like IS NULL is treated like "x = NULL". Aside from any possible
usefulness in its own right, this is an important improvement for
index-optimized MAX/MIN aggregates: it is now reliably possible to get
a column's min or max value cheaply, even when there are a lot of nulls
cluttering the interesting end of the index.
Diffstat (limited to 'src/backend/access/common/scankey.c')
-rw-r--r-- | src/backend/access/common/scankey.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/access/common/scankey.c b/src/backend/access/common/scankey.c index 2524369abe4..f066becf012 100644 --- a/src/backend/access/common/scankey.c +++ b/src/backend/access/common/scankey.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/scankey.c,v 1.32 2009/01/01 17:23:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/scankey.c,v 1.33 2010/01/01 21:53:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,7 +21,7 @@ * ScanKeyEntryInitialize * Initializes a scan key entry given all the field values. * The target procedure is specified by OID (but can be invalid - * if SK_SEARCHNULL is set). + * if SK_SEARCHNULL or SK_SEARCHNOTNULL is set). * * Note: CurrentMemoryContext at call should be as long-lived as the ScanKey * itself, because that's what will be used for any subsidiary info attached @@ -45,7 +45,7 @@ ScanKeyEntryInitialize(ScanKey entry, fmgr_info(procedure, &entry->sk_func); else { - Assert(flags & SK_SEARCHNULL); + Assert(flags & (SK_SEARCHNULL | SK_SEARCHNOTNULL)); MemSet(&entry->sk_func, 0, sizeof(entry->sk_func)); } } |