Search Postgresql Archives

Re: Changing column names in tables 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tony Cade skrev:

>     select relfilenode from pg_class where relname='rates'
> 
> update  pg_attribute set attname=lower(attname) where attnum >0 and
> attrelid=nnnn ( from above query)

Instead of the second one, do

SELECT
'ALTER TABLE rates RENAME COLUMN ' || attname || ' TO ' ||
lower(attname) || ';'
FROM pg_attribute
WHERE attnum >0 AND attrelid=nnnn

Output to textfile, run through psql

Not tested,

Nis


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux