Re: Missing update of all_hasnulls in BRIN opclasses

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Matthias van de Meent <boekewurm+postgres@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-01-07T00:37:54Z
Lists: pgsql-hackers
On Fri, Dec 30, 2022 at 01:18:36AM +0100, Tomas Vondra wrote:
> +		 * Does the range already has NULL values? Either of the flags can

should say: "already have NULL values"

> +		 * If we had NULLS, and the opclass didn't set allnulls=true, set
> +		 * the hasnulls so that we know there are NULL values.

You could remove "the" before "hasnulls".
Or say "clear hasnulls so that.."

> @@ -585,6 +587,13 @@ brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
>  	{
>  		int			i;
>  
> +		/*
> +		 * Make sure to overwrite the hasnulls flag, because it was initialized
> +		 * to true by brin_memtuple_initialize and we don't want to skip it if
> +		 * allnulls.

Does "if allnulls" mean "if allnulls is true" ?
It's a bit unclear.

> +		 */
> +		dtup->bt_columns[keyno].bv_hasnulls = hasnulls[keyno];
> +
>  		if (allnulls[keyno])
>  		{
>  			valueno += brdesc->bd_info[keyno]->oi_nstored;

-- 
Justin



Commits

  1. Show empty BRIN ranges in brin_page_items

  2. Fix handling of empty ranges and NULLs in BRIN

  3. Fix handling of NULLs when merging BRIN summaries

  4. Move IS [NOT] NULL handling from BRIN support functions