DERBY-3155: Prevent a MERGE statement from altering the same target row twice; commit derby-3155-28-aa-cardinalityViolations.diff.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1570230 13f79535-47bb-0310-9956-ffa450edef68
DERBY-3155: Remove some obsolete code which was causing a cross-schema MERGE statement to raise a missing schema error: commit derby-3155-29-aa-missingSchema.diff.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1570352 13f79535-47bb-0310-9956-ffa450edef68
DERBY-4160: getMetaData().getIndexInfo crashes with "ERROR X0Y68: Column 'PARAM1' already exists."

Use a shared code path for adding parameters to SYS.SYSCOLUMNS on the
first compilation and subsequent compilations of a meta-data query.
Previously, the first compilation took a different code path, but that
caused problems if two threads compiled a meta-data query at the same
time, and both threads thought they were first.

Set a savepoint before attempting to write a stored prepared statement
to the system tables in a nested transaction, and roll back to the
savepoint if an error happens. This prevents partially stored prepared
statements from lying around in the system tables after an error.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1570488 13f79535-47bb-0310-9956-ffa450edef68
DERBY-4753: "ERROR 42X01: Syntax error: FALSE." during call to java.sql.DatabaseMetaData.getIndexInfo

When recompiling a meta-data query after detecting that its plan is
stale, pass down a flag to the compiler to say that it's a meta-data
query and that use of internal syntax is allowed.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1570490 13f79535-47bb-0310-9956-ffa450edef68