In PostgreSql 9.2.4 I have two tables: user (id, login, password, name) and dealer (id, user_id).
user (id, login, password, name)
dealer (id, user_id)
And I want to insert into both tables ret
You just need to add a RETURNING id to your INSERT ... SELECT:
RETURNING id
INSERT ... SELECT
WITH rows AS (...) INSERT INTO dealer (user_id) SELECT id FROM rows RETURNING id;
Demo: http://sqlfiddle.com/#!12/75008/1