Postgre has everything a relational database should have (foreign key cyclic, domains etc).

How do you use table valued parameters in postgre? Basically, I'm trying to pass a "table" of members to be created. Below is the TSQL for SQL 2008. How would you convert this to plpgsql? I know that Postgre has functions that are stored procedures.

CREATE TYPE members_datatype AS TABLE
(
username VARCHAR(25),
email VARCHAR(255)
PRIMARY KEY (username)
)

CREATE PROCEDURE CreateMembers
(
@members member_table_datatype
)
AS
INSERT INTO members
BEGIN
SELECT * FROM @members;
END


And in the main code:
DECLARE @members AS member_table_datatype;
INSERT INTO @members
('jdoe', 'jdoe@email'), ('jdoe2', 'jdoe2@email') etc