> > EXECUTE 'INSERT INTO '||tablename||' ('||fields||') VALUES
> > ('||vals||') RETURNING currval('''||seqname||''') INTO newid'
You probably were to do:
EXECUTE 'INSERT INTO '||tablename||' ('||fields||') VALUES
('||vals||') RETURNING currval('''||seqname||''')' INTO newid
Note where last quote goes.