Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit972bf7d

Browse files
committed
Tweak BRIN minmax operator class
In the union support proc, we were not checking the hasnulls flag ofvalue A early enough, so it could be skipped if the "allnulls" flag invalue B is set. Also, a check on the allnulls flag of value "B" wasredundant, 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'spretty difficult to change default opclass for a datatype later on.(There is no catversion bump for this catalog change; this shouldn't bea problem.)Extracted from a larger patch to add an "inclusion" operator class.Author: Emre Hasegeli
1 parentb04d691 commit972bf7d

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

‎src/backend/access/brin/brin_minmax.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,24 @@ brin_minmax_union(PG_FUNCTION_ARGS)
256256

257257
Assert(col_a->bv_attno==col_b->bv_attno);
258258

259-
/* If there are no values in B, there's nothing to do */
259+
/* Adjust "hasnulls" */
260+
if (!col_a->bv_hasnulls&&col_b->bv_hasnulls)
261+
col_a->bv_hasnulls= true;
262+
263+
/* If there are no values in B, there's nothing left to do */
260264
if (col_b->bv_allnulls)
261265
PG_RETURN_VOID();
262266

263267
attno=col_a->bv_attno;
264268
attr=bdesc->bd_tupdesc->attrs[attno-1];
265269

266-
/* Adjust "hasnulls" */
267-
if (col_b->bv_hasnulls&& !col_a->bv_hasnulls)
268-
col_a->bv_hasnulls= true;
269-
270270
/*
271-
* Adjust "allnulls". If B has values but A doesn't, just copy the values
272-
* from B into A, and we're done. (We cannot run the operators in this
273-
* case, because values in A might contain garbage.)
271+
* Adjust "allnulls". If A doesn't have values, just copy the values
272+
* from B into A, and we're done. We cannot run the operators in this
273+
* case, because values in A might contain garbage. Note we already
274+
* established that B contains values.
274275
*/
275-
if (!col_b->bv_allnulls&&col_a->bv_allnulls)
276+
if (col_a->bv_allnulls)
276277
{
277278
col_a->bv_allnulls= false;
278279
col_a->bv_values[0]=datumCopy(col_b->bv_values[0],

‎src/include/catalog/pg_opclass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ DATA(insert (3580float8_minmax_opsPGNSP PGUID 4070 701 t 0 ));
252252
DATA(insert (3580abstime_minmax_opsPGNSPPGUID4072702t0 ));
253253
DATA(insert (3580reltime_minmax_opsPGNSPPGUID4073703t0 ));
254254
DATA(insert (3580macaddr_minmax_opsPGNSPPGUID4074829t0 ));
255-
DATA(insert (3580inet_minmax_opsPGNSPPGUID4075869t0 ));
255+
DATA(insert (3580inet_minmax_opsPGNSPPGUID4075869f0 ));
256256
DATA(insert (3580bpchar_minmax_opsPGNSPPGUID40761042t0 ));
257257
DATA(insert (3580time_minmax_opsPGNSPPGUID40771083t0 ));
258258
DATA(insert (3580date_minmax_opsPGNSPPGUID40591082t0 ));

‎src/test/regress/expected/brin.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ CREATE INDEX brinidx ON brintest USING brin (
6565
float4col,
6666
float8col,
6767
macaddrcol,
68-
inetcol,
68+
inetcol inet_minmax_ops,
6969
bpcharcol,
7070
datecol,
7171
timecol,

‎src/test/regress/sql/brin.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ CREATE INDEX brinidx ON brintest USING brin (
6868
float4col,
6969
float8col,
7070
macaddrcol,
71-
inetcol,
71+
inetcol inet_minmax_ops,
7272
bpcharcol,
7373
datecol,
7474
timecol,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp