Re: count_nulls(VARIADIC "any")

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: count_nulls(VARIADIC "any")
Дата
Msg-id CAFj8pRDW18xhTrVDTDKdomHEcAjmFZrojkAGgpvyjbw8gyoB_w@mail.gmail.com
обсуждение исходный текст
Ответ на count_nulls(VARIADIC "any")  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
Hi

2015-08-12 19:18 GMT+02:00 Marko Tiikkaja <marko@joh.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.

 It is not bad idea

+1

Pavel



.m


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: count_nulls(VARIADIC "any")
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: count_nulls(VARIADIC "any")