Re: In a partition why 1st time encounter NULL then call minvfunc

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: In a partition why 1st time encounter NULL then call minvfunc
Date: 2022-08-26 06:28:27
Message-ID: CAKFQuwaqn9CPFF7oT0RP0VWjVjuFns-Lpztk7MwxG4W_jH7-qQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday, August 25, 2022, jian he <jian(dot)universality(at)gmail(dot)com> wrote:

>
>
> _row | nstrict | nstrict----------+-----------+----------------
> 1,1:NULL | [[null]] | MI
> 1,2:a | a | MI+'a'
> 1,3:b | a+'b' | MI+'a'+'b'
> 1,4:NULL | a+'b'-'a' | MI+'a'+'b'-'a'
> 1,5:NULL | [[null]] | MI
> 1,6:c | c | MI+'c'
> 2,1:NULL | [[null]] | MI
> 2,2:x | x | MI+'x'
> 3,1:z | z | MI+'z'
> (9 rows)
>
>
> For now I don't understand row 1,4:NULL | a+'b'-'a' | MI+'a'+'b'-'a'.
>
>
> I am not sure why the 1st time you encounter NULL then it will call inverse
> transition function Overall, not sure about the idea of inverse
> transition function.
>

This has nothing to do with the null. The null just happens to be the
third (ignoring the leading null) row and so this is the first time
“preceding 1” has resulted in a row being forgotten and its value removed
from the state. And it would add a new value but the transition function
is strict.

A moving aggregate function adds and removes individual values from its
state as the aggregate moves across the data. You provide functions to
handle both.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James Vanns 2022-08-26 08:50:26 Re: Restriction on table partition expressions
Previous Message Christophe Pettus 2022-08-26 05:49:57 Re: Two questions about "pg_constraint"