Re: IGNORE/RESPECT NULLS can be specified for (prokind == 'f').

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: li(dot)evan(dot)chao(at)gmail(dot)com, jian(dot)universality(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: IGNORE/RESPECT NULLS can be specified for (prokind == 'f').
Date: 2026-06-18 00:16:26
Message-ID: CAHGQGwH7VY_0GkhycyYZ4czkPGL0uGzDyOxk3uuFOSRR7wFY3g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 17, 2026 at 12:58 PM Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>
> Hi Chao,
>
> > Hi Tatsuo-san,
> >
> > Sorry for jumping in. I didn’t review the patch, but while browsing recent commits, I noticed that this commit has a small issue: the errmsg should start with a lowercase character, according to the error style guide [1]:
> > ```
> > Primary error messages: Do not capitalize the first letter. Do not end a message with a period. Do not even think about ending a message with an exclamation point.
> > ```
> >
> > The attached diff is a quick fix that changes “Only” to “only” and updates the expected output accordingly.
> >
> > [1] https://www.postgresql.org/docs/current/error-style-guide.html
>
> You are right. I don't know why I forgot the rule. Patch pushed.
> Thank you!

Thanks for working on this!

I have a couple of comments.

When executing a non-existent function with IGNORE NULLS, for example,

SELECT no_such_func() IGNORE NULLS;

previously we got:

ERROR: function no_such_func() does not exist

but now we get:

ERROR: only window functions accept RESPECT/IGNORE NULLS

Isn't the previous error more helpful in this case? It makes me wonder
whether the IGNORE NULLS check is being performed too early. Perhaps
it would be better to move the check to other place.

I also noticed that when using an aggregate function as a window
function, for example,

SELECT sum(i) IGNORE NULLS OVER() FROM ...;

we now get:

ERROR: only window functions accept RESPECT/IGNORE NULLS

whereas previously the error was:

ERROR: aggregate functions do not accept RESPECT/IGNORE NULLS

The new message seems confusing because `sum()` is being used as
a window function in this case, so saying "only window functions accept ..."
doesn't seem accurate.

/*
* NULL TREATEMENT is only allowed for window functions per spec.
*/

Also, I noticed a typo: TREATEMENT should be TREATMENT.

The attached patch implements these changes. Thoughts?

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Refine-NULL-treatment-checks-for-non-window-funct.patch application/octet-stream 4.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-06-18 01:23:18 Re: Fix ALTER DOMAIN VALIDATE CONSTRAINT locking
Previous Message David Rowley 2026-06-17 23:37:18 Re: Fix tuple deformation with virtual generated NOT NULL columns