MS SQL Server reserved keyword "MERGE" is not quoted

Description

Hitting this with JIRA 6.3.3 against MS SQL Server.

There's a new column named "MERGE", introduced in the changes for DCON-406.

It turns out that "MERGE" is a reserved keyword in MS SQL Server: http://msdn.microsoft.com/en-us/library/ms189822.aspx

We need to include all reserved keywords in SQL Server to our list.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 2014-08-12 11:20:07,681 http-bio-8090-exec-9 ERROR admin 680x3252x1 1r43uuz 127.0.0.1 /rest/bitbucket/1.0/repositories [net.java.ao.sql] Exception executing SQL update <CREATE TABLE dbo.AO_E8B6CC_COMMIT ( AUTHOR VARCHAR(255), AUTHOR_AVATAR_URL VARCHAR(255), "DATE" DATETIME NOT NULL, DOMAIN_ID INTEGER CONSTRAINT df_AO_E8B6CC_COMMIT_DOMAIN_ID DEFAULT 0 NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL, MERGE BIT, MESSAGE NTEXT, NODE VARCHAR(255), RAW_AUTHOR VARCHAR(255), CONSTRAINT pk_AO_E8B6CC_COMMIT_ID PRIMARY KEY(ID) )> java.sql.SQLException: Incorrect syntax near the keyword 'MERGE'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723) at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1166) at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1119) at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228) at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228) at net.java.ao.DatabaseProvider.executeUpdate(DatabaseProvider.java:2351) at net.java.ao.DatabaseProvider.executeUpdateForAction(DatabaseProvider.java:2421) at net.java.ao.DatabaseProvider.executeUpdatesForActions(DatabaseProvider.java:2384) at net.java.ao.schema.SchemaGenerator.migrate(SchemaGenerator.java:99) at net.java.ao.EntityManager.migrate(EntityManager.java:128) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:44) at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory$1.doInTransaction(AbstractActiveObjectsFactory.java:74) at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory$1.doInTransaction(AbstractActiveObjectsFactory.java:68) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:25)

Environment

None

Testing Notes

None

Status

Assignee

Alex Courtis

Reporter

ZehuaA

Add-on Type

None

Team

None

CC

None

Risk factor

None

QA Kickoff Status

None

QA Demo Status

None

Fix versions

Affects versions

0.23.7

Priority

Blocker