AO.create() fails on SQL Server when default schema is not configured and when generated primary key is overridden

Description

This happens during restore from backup, for example, if we're writing records and need to turn off auto assignment of PKs.

The error and the fix are trivial – however, it is a rarely occurring problem (but we hit it, and it's quite hard to work around).

Take a look at SQLServerDatabaseProvider.insertReturningKey()}} – there are two clauses with {{SET IDENTITY_INSERT, and the first one uses withSchema(table) as the table name, while the second one uses processID(table)! When there's no default schema, this breaks.

Solution: change "processID" to "withSchema" on the line that reads
sql.append("\nSET IDENTITY_INSERT ").append(processID(table)).append(" OFF");

Environment

None

Testing Notes

Add notes...

Status

Assignee

Unassigned

Reporter

Igor Sereda [ALM Works]

Labels

None

Add-on Type

None

Team

None

CC

None

Risk factor

None

QA Kickoff Status

None

QA Demo Status

None

Story Points

2

Affects versions

1.1.5
0.23.0

Priority

Major
Configure