I have a travel survey with a series of tables (lots and lots of columns) that I exported from MS Access into a postgres database. I've search around a lot for an explanation of how to convert all the column names to lower case, but I haven't been able to successfully apply any of the solutions I've found. I'm relatively new to postgres and would appreciate some step by step explanation if possible.

This link appears to have code for accomplishing this task, but I run into errors when trying to run them in psql or in the pgadmin.


Or there is this:

\o /tmp/go_to_lower
select 'ALTER TABLE '||'"'||tablename||'"'||' RENAME TO ' ||
lower(tablename)||';' from pg_tables where schemaname = 'public';
psql -U username database < /tmp/go_to_lower

it appears to run but then the database still has upper_case columns.

I'd really appreciate some help with this, sorry if this is something simple that I'm just missing.

Many thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.