Allow SQL/plpgsql functions to accept record

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Allow SQL/plpgsql functions to accept record
Date: 2015-04-19 22:02:04
Message-ID: 553425DC.4050009@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-04-19 22:08:30 Re: Bug with specific-schema extensions
Previous Message Jim Nasby 2015-04-19 21:37:42 Bug with specific-schema extensions