Re: Rename column but keep old name as alias
Posted by:
Rick James
Date: December 23, 2015 11:18PM
Once the old name is gone, any queries mentioning it will get an error to the effect of "no such column".
By having two columns, you avoid that. However, my suggested solution may need the addition of a TRIGGER to keep the two columns in sync.
Or you can upgrade to 5.7 or MariaDB 10.1. Both have flavors of "virtual columns", which lets you have a column by another name that does not really exist; it is just an expression that evaluates to the original column.
But, that may not work if it is not writable. So, again, a RENAME may be necessary to swap the names.
Or... How about a VIEW that gives a different name for the column. This might be the best solution.
Subject
Written By
Posted
December 22, 2015 07:09PM
December 23, 2015 09:48PM
December 23, 2015 10:15PM
Re: Rename column but keep old name as alias
December 23, 2015 11:18PM
December 25, 2015 06:32PM
December 25, 2015 08:12PM
December 25, 2015 09:48PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.