From: | dmp <danap(at)ttc-cmc(dot)net> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Changing column names in tables 2 |
Date: | 2008-03-05 20:34:07 |
Message-ID: | 47CF03BF.9080200@ttc-cmc.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ralph Smith | 2008-03-06 00:08:46 | I'm in need of something that should be there |
Previous Message | Tom Lane | 2008-03-05 20:27:45 | Re: Requiring a password |