The following is an example in bash of applying a query to every table in the public schema on database template1:
for table in `psql -qAt -c "select tablename from pg_tables where schemaname in ('public');" template1` ; do psql -c "alter table public.$table drop column if exists lastedit" template1 ; done
No comments:
Post a Comment