Re: Changing column names in tables 2 - Mailing list pgsql-general

From dmp
Subject Re: Changing column names in tables 2
Date
Msg-id 47CF03BF.9080200@ttc-cmc.net
Whole thread Raw
In response to Re: Changing column names in tables 2  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-general
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 lowercase for the table(s) and field(s).
If psql is to much of a hassle, Just use MyJSQLView to dump
the database and removed the quotes, ". You should of been able
to remove the quotes directly in MyJSQLView during the dump,
but I just tried it and it is broken. Edit | Preference | Data Export |
SQL, set empty string identifier. I always recommend backing up
data to get back where you started just in case things get screwed up,
so pg_dump everything before starting.

danap.

>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=nnnn ( from above query)
>>
>>
>
>Don't do that.  It's far better to create a shell script, or PL/pgSQL
>function, whatever suits you, to get the table/column names from the
>catalog and then produce the ALTER TABLE commands you need.
>
>Playing directly with the catalogs is *never* supposed.
>

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Requiring a password
Next
From: Ralph Smith
Date:
Subject: I'm in need of something that should be there