Re: [GENERAL] Changing column names in tables 2

2008-03-06 Thread Nis Jørgensen
Tony Cade skrev: select relfilenode from pg_class where relname='rates' update pg_attribute set attname=lower(attname) where attnum 0 and attrelid= ( from above query) Instead of the second one, do SELECT 'ALTER TABLE rates RENAME COLUMN ' || attname || ' TO ' || lower(attname) ||

[GENERAL] Changing column names in tables 2

2008-03-05 Thread Tony Cade
Sorry about the earlier incomplete message, this is the complete version I have an Access database that I have exported to PostgreSQL via ODBC, which has worked ok the data is in PostgreSQL but some of the column names were in mixed case e.g. AccountCode When I look at the table definitions in

Re: [GENERAL] Changing column names in tables 2

2008-03-05 Thread Alvaro Herrera
Tony Cade wrote: There are too many fields to issue alter table commands to rename in SQL so my question is , is it safe to use a query such as select relfilenode from pg_class where relname='rates' update pg_attribute set attname=lower(attname) where attnum 0 and attrelid= (

Re: [GENERAL] Changing column names in tables 2

2008-03-05 Thread dmp
Hello Tony, Perhaps this will help maybe not. Since the original data import used quotes for the fields then any case was maintained in the creation of the new table(s) fields(s). Just take your original import file and remove all the quotes, ,. Re-import and and PostgreSQL will use all