-- Show current sequence val
select currval('nodefolder_id_seq'::regclass);
-- Let insert the data with currval as value
BEGIN;
insert into node (name,parent,type, project_id)
values ('TEST_Name',null,1,currval('nodefolder_id_seq'::regclass));
COMMIT;
-- Reference
-- 1. http://www.postgresql.org/docs/9.1/static/transaction-iso.html
-- 2. http://www.postgresql.org/docs/9.1/static/functions-sequence.html
-- 3. http://stackoverflow.com/questions/241003/how-to-get-a-value-from-the-last-inserted-row