An issue in the sql_trans_copy_key component of MonetDB Server v11.45.17 and v11.46.0 allows attackers to cause a Denial of Service (DoS) via crafted SQL statements.
**Describe the bug**
MonetDB server crashes at sql_trans_copy_key after executing SQL statements through ODBC.

**To Reproduce**
```sql
START TRANSACTION;
CREATE TEMPORARY TABLE temptest3(col int PRIMARY KEY) ON COMMIT DROP;
CREATE TEMPORARY TABLE temptest4(col int, FOREIGN KEY (col) REFERENCES temptest3);
```

**Expected behavior**
Executing statements successfully or throwing errors, instead of breaking down the whole MonetDB server.

**Backtrace**
```
#0 0x7f9d8a205eb0 (sql_trans_copy_key+0x1c0)
#1 0x7f9d8a258c7e (mvc_copy_key+0x1e)
#2 0x7f9d8a13fa5c (create_table_or_view+0x79c)
#3 0x7f9d8a1779e1 (SQLcreate_table+0x111)
#4 0x7f9d8a4d1c63 (runMALsequence+0x763)
#5 0x7f9d8a4d131e (runMAL+0x9e)
#6 0x7f9d8a1589f9 (SQLrun+0xd9)
#7 0x7f9d8a159bee (SQLengineIntern+0x4e)
#8 0x7f9d8a1578c2 (SQLengine_+0x5e2)
#9 0x7f9d8a156343 (SQLengine+0x23)
#10 0x7f9d8a4e56cf (runScenario+0x4f)
#11 0x7f9d8a4e616c (MSscheduleClient+0x68c)
#12 0x7f9d8a58dc2b (doChallenge+0xfb)
#13 0x7f9d8ac0cba0 (THRstarter+0x100)
#14 0x7f9d8ac7ccc4 (thread_starter+0x34)
#15 0x7f9d89ff1609 (start_thread+0xd9)
#16 0x7f9d89f16133 (clone+0x43)
```

**Software versions**
 - MonetDB server version: 11.46.0 (hg id: 63a42c2) (pulled from the master branch)
 - MonetDB ODBC version: 11.46.0
 - OS and version: ubuntu 20.04
 - Self-installed and compiled. The command line of compilation: `CC=clang-12 CXX=clang++-12 cmake /root/monetdb_master -DCMAKE_BUILD_TYPE=RelWithDebInfo`

**Additional context**
MonetDB runs in-memory database. The command line of starting MonetDB server is `mserver5 --in-memory`.

MonetDB server crashes at sql_trans_copy_key
This is a GitHub Issue
repo:MonetDB
owner:MonetDB
Title : MonetDB server crashes at sql_trans_copy_key
Issue date:

--- start body ---
**Describe the bug**
MonetDB server crashes at sql_trans_copy_key after executing SQL statements through ODBC.

**To Reproduce**
```sql
START TRANSACTION;
CREATE TEMPORARY TABLE temptest3(col int PRIMARY KEY) ON COMMIT DROP;
CREATE TEMPORARY TABLE temptest4(col int, FOREIGN KEY (col) REFERENCES temptest3);
```

**Expected behavior**
Executing statements successfully or throwing errors, instead of breaking down the whole MonetDB server.

**Backtrace**
```
#0 0x7f9d8a205eb0 (sql_trans_copy_key+0x1c0)
#1 0x7f9d8a258c7e (mvc_copy_key+0x1e)
#2 0x7f9d8a13fa5c (create_table_or_view+0x79c)
#3 0x7f9d8a1779e1 (SQLcreate_table+0x111)
#4 0x7f9d8a4d1c63 (runMALsequence+0x763)
#5 0x7f9d8a4d131e (runMAL+0x9e)
#6 0x7f9d8a1589f9 (SQLrun+0xd9)
#7 0x7f9d8a159bee (SQLengineIntern+0x4e)
#8 0x7f9d8a1578c2 (SQLengine_+0x5e2)
#9 0x7f9d8a156343 (SQLengine+0x23)
#10 0x7f9d8a4e56cf (runScenario+0x4f)
#11 0x7f9d8a4e616c (MSscheduleClient+0x68c)
#12 0x7f9d8a58dc2b (doChallenge+0xfb)
#13 0x7f9d8ac0cba0 (THRstarter+0x100)
#14 0x7f9d8ac7ccc4 (thread_starter+0x34)
#15 0x7f9d89ff1609 (start_thread+0xd9)
#16 0x7f9d89f16133 (clone+0x43)
```

**Software versions**
 - MonetDB server version: 11.46.0 (hg id: 63a42c2) (pulled from the master branch)
 - MonetDB ODBC version: 11.46.0
 - OS and version: ubuntu 20.04
 - Self-installed and compiled. The command line of compilation: `CC=clang-12 CXX=clang++-12 cmake /root/monetdb_master -DCMAKE_BUILD_TYPE=RelWithDebInfo`

**Additional context**
MonetDB runs in-memory database. The command line of starting MonetDB server is `mserver5 --in-memory`.

--- end body ---
