[PATCH] respect/ignore nulls for lag,lead,first_value,last_value and nth_value and from first/last for nth_value

From: Krasiyan Andreev <krasiyan(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] respect/ignore nulls for lag,lead,first_value,last_value and nth_value and from first/last for nth_value
Date: 2020-02-29 15:54:51
Message-ID: CAN1PwokqW6Nb1CiV6hMqcsz5JvnTscgvegXS1OW8++EeSFi6nQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I want to continue development of Oliver Ford's respect/ignore nulls for
lag,lead,first_value,last_value and nth_value
and from first/last for nth_value patch, but I am not sure how to proceed
with it and any feedback will be very useful.

I have dropped support of from first/last for nth_value(), but also I
reimplemented it in a different way,
by using negative number for the position argument, to be able to get the
same frame in exact reverse order.
After that patch becomes much more simple and major concerns about
precedence hack has gone,
but maybe it can be additionally simplified.

I have not renamed special bool type "ignorenulls", because it is probably
not acceptable way for calling extra version
of window functions (because it makes things very easy, and it can reuse
frames), but I removed the other special bool type "fromlast".

So, that is the major question, can someone give me an better idea or
example that I can use,
for something, that can be more acceptable as implementation and I will try
to do it in a such way.

Attached file is for PostgreSQL 13 (master git branch) and I will add it
now to a March commit fest, to be able to track changes.
Everything works and patch is in very good shape, make check is passed and
also, I use it from some time for SQL analysis purposes
(because ignore nulls is one of the most needed feature in OLAP/BI area and
Oracle, Amazon Redshift and Informix have it).

After patch review and suggestions about what to do with special bool type
and unreserved keywords, I will reimplement it, if needed.

Attachment Content-Type Size
pg13_ignore_nulls.patch text/x-patch 51.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-02-29 16:52:58 Re: ALTER tbl rewrite loses CLUSTER ON index
Previous Message Dave Cramer 2020-02-29 15:44:44 Re: Binary support for pgoutput plugin