Re: count_nulls(VARIADIC "any")

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: count_nulls(VARIADIC "any")
Date: 2016-01-03 20:37:41
Message-ID: CAFj8pRCHT9XX1Ab=3wZwqv0uaFT5eorCjtL5Rc906ZoBs_TBdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-01-03 21:37 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

> Hi
>
>
> 2015-08-12 19:18 GMT+02:00 Marko Tiikkaja <marko(at)joh(dot)to>:
>
>> Hi,
>>
>> 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');
>> count_nulls
>> -------------
>> 2
>> (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.
>>
>>
>> .m
>>
>
> I am sending updated version - support num_nulls and num_notnulls
>

and patch

>
> Regards
>
> Pavel
>

Attachment Content-Type Size
num_nulls_v4.patch text/x-patch 12.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Seltenreich 2016-01-03 20:48:50 Re: pg_upgrade in 9.5 broken for adminpack
Previous Message Pavel Stehule 2016-01-03 20:37:15 Re: count_nulls(VARIADIC "any")