@postgresql.org
*Subject:* [GENERAL] Changing column names in tables
I have an Access database that I have exported to PostgreSQL via ODBC,
which has worked ok the data is in PostgreSQL but some of the column names
were in mixed case e.g. AccountCode
When I look at the table definitions in pgadmin
] On Behalf Of Tony Cade
Sent: Wednesday, March 05, 2008 2:29 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Changing column names in tables
I have an Access database that I have exported to PostgreSQL via ODBC,
which has worked ok the data is in PostgreSQL but some of the column
names were
Tony Cade skrev:
select relfilenode from pg_class where relname='rates'
update pg_attribute set attname=lower(attname) where attnum 0 and
attrelid= ( from above query)
Instead of the second one, do
SELECT
'ALTER TABLE rates RENAME COLUMN ' || attname || ' TO ' ||
lower(attname) ||
Sorry about the earlier incomplete message, this is the complete version
I have an Access database that I have exported to PostgreSQL via ODBC, which
has worked ok the data is in PostgreSQL but some of the column names were
in mixed case e.g. AccountCode
When I look at the table definitions in
I have an Access database that I have exported to PostgreSQL via ODBC, which
has worked ok the data is in PostgreSQL but some of the column names were
in mixed case e.g. AccountCode
When I look at the table definitions in pgadmin these are shown in quotes
e.g.AccountCode and any queries made
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= (
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