diff options
| author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-01-22 17:01:09 -0300 |
|---|---|---|
| committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-01-22 17:01:09 -0300 |
| commit | 972bf7d6f13005dfe89ae3f8a3b937a4a0580c85 (patch) | |
| tree | 320210b9dac82fbf5850c4debb1eb915aea5bfb5 /src/backend/access/brin/brin_minmax.c | |
| parent | b04d69161354f7cfc3d8153b67145dbebc4a4698 (diff) | |
| download | postgresql-972bf7d6f13005dfe89ae3f8a3b937a4a0580c85.tar.gz | |
Tweak BRIN minmax operator class
In the union support proc, we were not checking the hasnulls flag of
value A early enough, so it could be skipped if the "allnulls" flag in
value B is set. Also, a check on the allnulls flag of value "B" was
redundant, so remove it.
Also change inet_minmax_ops to not be the default opclass for type inet,
as a future inclusion operator class would be more useful and it's
pretty difficult to change default opclass for a datatype later on.
(There is no catversion bump for this catalog change; this shouldn't be
a problem.)
Extracted from a larger patch to add an "inclusion" operator class.
Author: Emre Hasegeli
Diffstat (limited to 'src/backend/access/brin/brin_minmax.c')
| -rw-r--r-- | src/backend/access/brin/brin_minmax.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/backend/access/brin/brin_minmax.c b/src/backend/access/brin/brin_minmax.c index 68ea7d5335..299d6f7bf6 100644 --- a/src/backend/access/brin/brin_minmax.c +++ b/src/backend/access/brin/brin_minmax.c @@ -256,23 +256,24 @@ brin_minmax_union(PG_FUNCTION_ARGS) Assert(col_a->bv_attno == col_b->bv_attno); - /* If there are no values in B, there's nothing to do */ + /* Adjust "hasnulls" */ + if (!col_a->bv_hasnulls && col_b->bv_hasnulls) + col_a->bv_hasnulls = true; + + /* If there are no values in B, there's nothing left to do */ if (col_b->bv_allnulls) PG_RETURN_VOID(); attno = col_a->bv_attno; attr = bdesc->bd_tupdesc->attrs[attno - 1]; - /* Adjust "hasnulls" */ - if (col_b->bv_hasnulls && !col_a->bv_hasnulls) - col_a->bv_hasnulls = true; - /* - * Adjust "allnulls". If B has values but A doesn't, just copy the values - * from B into A, and we're done. (We cannot run the operators in this - * case, because values in A might contain garbage.) + * Adjust "allnulls". If A doesn't have values, just copy the values + * from B into A, and we're done. We cannot run the operators in this + * case, because values in A might contain garbage. Note we already + * established that B contains values. */ - if (!col_b->bv_allnulls && col_a->bv_allnulls) + if (col_a->bv_allnulls) { col_a->bv_allnulls = false; col_a->bv_values[0] = datumCopy(col_b->bv_values[0], |
