Re: Changing column names in tables 2
От | dmp |
---|---|
Тема | Re: Changing column names in tables 2 |
Дата | |
Msg-id | 47CF03BF.9080200@ttc-cmc.net обсуждение исходный текст |
Ответ на | Re: Changing column names in tables 2 (Alvaro Herrera <alvherre@commandprompt.com>) |
Список | 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 по дате отправления: