tags:

views:

115

answers:

1

Hello,

Actually the problem arises since we have named a column "authorization" which is ok on mysql but fails miserably on postgres - "authorization" is a reserved keyword there.

We want to have all schemas in sync even on different databases, so we want to rename "authorization" in the mysql catalogue(s) to something neutral.

It would be great if the renaming of the mysql table columns would work seamlessly with older and newer versions of the applicatation at least for a couple of days so that the transition is smooth.

Does anybody know how to do this? A nice idea would be to have some sort of alias/redirection, e.g. create a new column "_authorization" that is actually the same column as "authorization" but under the new name. queries using the new name "_autorization" will work as well as queries using the old name. Then we can update the application. If all servers have the latest binaries, we can drop the alias and rename the column.

Any ideas? Any help is greatly appreciated.

Rgds Holger

+1  A: 

A nice idea would be to have some sort of alias/redirection...

No such functionality exists. The closest is to use a view based on the table, because it's easier to rename a column in a view as there isn't any underlying data to change. Otherwise:

Rename the column in MySQL using the ALTER TABLE statement:

ALTER TABLE [your table]
     CHANGE authorization [new_col_name] [column_definition]
OMG Ponies
Hello, thanks. Feared but not unexpected :) Happy holidays!