Allow SQL/plpgsql functions to accept record

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Allow SQL/plpgsql functions to accept record
Дата
Msg-id 553425DC.4050009@BlueTreble.com
обсуждение исходный текст
Ответы Re: Allow SQL/plpgsql functions to accept record  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
Is there a fundamental reason SQL/plpgsql functions won't accept record 
as an input type? If not, can someone point me at a patch that might 
show how much work would be involved in adding support?

My particular use case is a generic function that will count how many 
fields in a record are NULL. I can do it in pure SQL (below), but was 
hoping to wrap the entire thing in a function. Right now, I have to add 
a call to row_to_json() to the function call.

SELECT count(*)  FROM json_each_text( row_to_json($1) ) a  WHERE value IS NULL
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Bug with specific-schema extensions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug with specific-schema extensions