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

From Nis Jørgensen
Subject Re: Changing column names in tables 2
Date
Msg-id fqpr07$7bs$1@ger.gmane.org
Whole thread Raw
In response to Changing column names in tables 2  ("Tony Cade" <arcade646@googlemail.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: staring pgsql on fedora 8
Next
From: Bruce Momjian
Date:
Subject: Re: contributing patches