Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
titleTruncate Data Location Tables for Postgres
select 'truncate table SCHEMA.' || tablename || ';' generated_statements
from pg_catalog.pg_tables 
where schemaname = 'SCHEMA' 
and tablename not like 'dl_%'
and tablename like '%ENTITYNAME'
order by substr(tablename,3), tablename;
;


Info

This technique only removes the data, but does not remove the data structures (tables). For that purpose, you must drop the data location. This is great when you really want to start completely fresh, but you must use this option carefully. This is done from the Data Locations tab in the workbench.

...