Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find if a column name is a reserved keyword across various databases

We have a legacy schema file which has the following column names, would like to understand if any of them would cause an issue if we port our application to h2, mysql, postgres or oracle.

e.g how would I know if using this would be ok across the databases listed below. Are there any good tools which can do a preliminary check on this?

key
when
size
type
count
from
with
like image 943
user352290 Avatar asked Aug 14 '11 16:08

user352290


1 Answers

Should be quite easy to get the list of reserved words and build a table of the reserved words. Here are some lists of reserved words:

  • Oracle: http://download.oracle.com/docs/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm
  • SQL Server:
    http://msdn.microsoft.com/en-us/library/ms189822.aspx
  • PostgreSQL:
    http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html
  • MySQL:
    https://dev.mysql.com/doc/refman/5.6/en/keywords.html#keywords-in-current-series

And here's an online checker: http://www.petefreitag.com/tools/sql_reserved_words_checker/?word=on

like image 98
Kevin Burton Avatar answered Sep 18 '22 04:09

Kevin Burton