Обсуждение: pg_advisory_unlock(null)

Поиск
Список
Период
Сортировка

pg_advisory_unlock(null)

От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/functions-admin.html
Description:

Hello!
There is no information in documentation about pg_advisory_unlock with NULL
value.
This call: select pg_advisory_unlock(null), returns null without reporting,
but according to the documentation it was expected either false or true.
Maybe add information about null value?
version: 12.10

Re: pg_advisory_unlock(null)

От
"David G. Johnston"
Дата:
On Thu, Jul 14, 2022 at 6:36 AM PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/functions-admin.html
Description:

Hello!
There is no information in documentation about pg_advisory_unlock with NULL
value.
This call: select pg_advisory_unlock(null), returns null without reporting,
but according to the documentation it was expected either false or true.
Maybe add information about null value?
version: 12.10

It is defined as strict because there is nothing meaningful that could be done with a null input.  Saying that seems unnecessary; I'm sure if you look you will find many more places where this complaint applies.

If I did anything it would be to add a comment to the Function and Operators page that says something like:

Many of the functions listed herein cannot produce a meaningful result when supplied with null arguments.  These functions will simply produce a null output without being invoked. These are not explicitly labelled in the documentation, though you may inspect the system catalog to confirm whether a given function is or is not defined as being "strict" (returns null on null input).  In most cases one should assume that unless the behavior regarding null inputs is explained that the function in question is defined to be strict.  Operators likewise tend to produce null outputs if at least one of their inputs are null.  Aggregate and window functions are the most common exception to this rule.

David J.