Changing column names in tables 2

From: "Tony Cade" <arcade646(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Changing column names in tables 2
Date: 2008-03-05 19:32:53
Message-ID: ed13db1b0803051132o30f0113bj11449f73794d4c3d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 pgadmin these are shown in quotes
e.g."AccountCode" and any queries made that reference these columns require
the quotes.

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=nnnn ( from above query)

to rename the columns in the system catalogs or will this come back and bite
me later?

Tony Cade

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-03-05 20:01:12 Re: Changing column names in tables 2
Previous Message Tony Cade 2008-03-05 19:28:40 Changing column names in tables