Once again a short notice about some nifty PostgreSQL feature you might not be aware of. It’s quire simple to copy the structure of a table with:
CREATE TABLE table2 ( like table1 INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES );
Now you can copy data with or without some sort of filter:
INSERT INTO table2 SELECT * FROM table LIMIT 100;
Hope that helps.