count_nulls(VARIADIC "any")

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: count_nulls(VARIADIC "any")
Date: 2015-08-12 17:18:41
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I'd like to suggest $SUBJECT for inclusion in Postgres 9.6. I'm sure
everyone would've found it useful at some point in their lives, and the
fact that it can't be properly implemented in any language other than C
I think speaks for the fact that we as a project should provide it.

A quick and dirty proof of concept (patch attached):

=# select count_nulls(null::int, null::text, 17, 'bar');
(1 row)

Its natural habitat would be CHECK constraints, e.g:

CHECK (count_nulls(a,b,c) IN (0, 3))

Will finish this up for the next CF, unless someone wants to tell me how
stupid this idea is before that.


Attachment Content-Type Size
count_nulls.patch text/plain 3.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Gideon Dresdner 2015-08-12 17:21:10 Re: can't coax query planner into using all columns of a gist index
Previous Message Robert Haas 2015-08-12 17:00:25 Re: Raising our compiler requirements for 9.6