On 21 March 2012 11:52, Simon Greener <si...@spatialdbadvisor.com> wrote: > Thanks all for the suggestions. > S
If you are using postgres 9.0 or later, try something like this to rename tables: DO $$DECLARE r record; BEGIN FOR r IN (SELECT relname, regexp_replace(lower(relname), E'[ \-]+', '_', 'g') AS new_relname FROM pg_class c JOIN pg_namespace n ON n.oid=c.relnamespace WHERE n.nspname='public' AND relkind='r' AND relname <> quote_ident(relname)) LOOP EXECUTE 'ALTER TABLE ' || quote_ident(r.relname) || ' RENAME TO ' || quote_ident(r.new_relname) || ';'; END LOOP; END$$ A similar query can be used to rename columns. -Mike _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users