aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/access/brin/brin_minmax.c19
-rw-r--r--src/include/catalog/pg_opclass.h2
-rw-r--r--src/test/regress/expected/brin.out2
-rw-r--r--src/test/regress/sql/brin.sql2
4 files changed, 13 insertions, 12 deletions
diff --git a/src/backend/access/brin/brin_minmax.c b/src/backend/access/brin/brin_minmax.c
index 68ea7d53357..299d6f7bf6e 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],
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index f5d0f6eea18..b3acef66de2 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -252,7 +252,7 @@ DATA(insert ( 3580 float8_minmax_ops PGNSP PGUID 4070 701 t 0 ));
DATA(insert ( 3580 abstime_minmax_ops PGNSP PGUID 4072 702 t 0 ));
DATA(insert ( 3580 reltime_minmax_ops PGNSP PGUID 4073 703 t 0 ));
DATA(insert ( 3580 macaddr_minmax_ops PGNSP PGUID 4074 829 t 0 ));
-DATA(insert ( 3580 inet_minmax_ops PGNSP PGUID 4075 869 t 0 ));
+DATA(insert ( 3580 inet_minmax_ops PGNSP PGUID 4075 869 f 0 ));
DATA(insert ( 3580 bpchar_minmax_ops PGNSP PGUID 4076 1042 t 0 ));
DATA(insert ( 3580 time_minmax_ops PGNSP PGUID 4077 1083 t 0 ));
DATA(insert ( 3580 date_minmax_ops PGNSP PGUID 4059 1082 t 0 ));
diff --git a/src/test/regress/expected/brin.out b/src/test/regress/expected/brin.out
index 61a544efedd..f47f3663759 100644
--- a/src/test/regress/expected/brin.out
+++ b/src/test/regress/expected/brin.out
@@ -65,7 +65,7 @@ CREATE INDEX brinidx ON brintest USING brin (
float4col,
float8col,
macaddrcol,
- inetcol,
+ inetcol inet_minmax_ops,
bpcharcol,
datecol,
timecol,
diff --git a/src/test/regress/sql/brin.sql b/src/test/regress/sql/brin.sql
index b1d2c5c8eaa..3aff92529a1 100644
--- a/src/test/regress/sql/brin.sql
+++ b/src/test/regress/sql/brin.sql
@@ -68,7 +68,7 @@ CREATE INDEX brinidx ON brintest USING brin (
float4col,
float8col,
macaddrcol,
- inetcol,
+ inetcol inet_minmax_ops,
bpcharcol,
datecol,
timecol,