Extract a limit records from a table and restore it on postgresql
- Create a temp table
SELECT p.*
INTO TABLE tmp_my_table
from my_table p
- Dump the table
pg_dump my_database --table tmp_my_table | sed 's/public.tmp_/public./' > tmp_my_table.sql
- Restore the table data on the original table (my_table)
psql -d my_database -U user < tmp_my_table.sql