I need to export data structure and content from PostgreSQL tables without using pgdump service and without middleware. I wrote a function to export of all tables' data with INSERT queries: http://sqlfiddle.com/#!15/a3609/1/0 .
But how to determine the most effective way for CREATE TABLE queries generation through plpgsql function?