This is how I do this in sql server.
insert into users(name) values('jhon');
set @id = @@identity; -- last serial
insert into usersroles(@id, 1)
insert into usersroles(@id, 2)
insert into usersroles(@id, 3)
How can I do the same in postgres (withouth creating a function)?