**Describe the bug**
MonetDB server crashes in `__nss_database_lookup`.

**To Reproduce**
```sql
SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( x NATURAL JOIN x ) WHERE x ) y;
```

**Backtrace of the Crash**
```c
#0 0x7f18e0e2de12 (__nss_database_lookup+0x20792)
#1 0x7f18e11dd2dd (exp_equal+0xbd)
#2 0x7f18e111c76a (list_distinct+0x11a)
#3 0x7f18e11e655e (check_distinct_exp_names+0x9e)
#4 0x7f18e11b180d (rel_select_exp+0xafd)
#5 0x7f18e11a8820 (rel_subquery+0x5f0)
#6 0x7f18e11a8ae3 (rel_selects+0x233)
#7 0x7f18e1192382 (rel_semantic+0x442)
#8 0x7f18e0f85db3 (sql_symbol2relation+0x93)
#9 0x7f18e0fb2a82 (SQLparser+0x802)
#10 0x7f18e0fb1a0a (SQLengine_+0xa5a)
#11 0x7f18e0faf1fe (SQLengine+0x3e)
#12 0x7f18e1533b2f (runScenario+0x6f)
#13 0x7f18e1534cfe (MSscheduleClient+0xb6e)
#14 0x7f18e16786c2 (doChallenge+0x132)
#15 0x7f18e2495b38 (thread_starter+0x318)
#16 0x7f18e0ea6609 (start_thread+0xd9)
#17 0x7f18e0dc9353 (clone+0x43)
```

**Software versions**
 - MonetDB version number: v11.49.1 (Dec2023)
 - OS and version: Ubuntu 20.04
 - From docker image monetdb/monetdb:Dec2023 (or monetdb/dev-builds:default)

An example of steps to reproduce in docker container (**write the poc into /tmp/test.sql first**):
```bash
docker container rm monetdb_test -f
docker run -e MDB_DB_ADMIN_PASS=monetdb --name monetdb_test -itd monetdb/monetdb:Dec2023
docker exec monetdb_test bash -c 'echo -n -e "user=monetdb\npassword=monetdb\n" > /root/.monetdb'

sleep 10
cat /tmp/test.sql | timeout 5s docker exec -i monetdb_test mclient monetdb     # run test case

if docker exec monetdb_test bash -c "grep '[m]server5' /proc/*/cmdline -lR"; then
    echo "[INFO] Server normal."
else
    echo "[CRASH] Mserver5 process does NOT exist."
fi
```

It can also be reproduced on the docker image `monetdb/dev-builds:default`.

**Issue labeling**
bug
MonetDB server crashes in `__nss_database_lookup`
This is a GitHub Issue
repo:MonetDB
owner:MonetDB
Title : MonetDB server crashes in `__nss_database_lookup`
Issue date:

--- start body ---
**Describe the bug**
MonetDB server crashes in `__nss_database_lookup`.

**To Reproduce**
```sql
SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( x NATURAL JOIN x ) WHERE x ) y;
```

**Backtrace of the Crash**
```c
#0 0x7f18e0e2de12 (__nss_database_lookup+0x20792)
#1 0x7f18e11dd2dd (exp_equal+0xbd)
#2 0x7f18e111c76a (list_distinct+0x11a)
#3 0x7f18e11e655e (check_distinct_exp_names+0x9e)
#4 0x7f18e11b180d (rel_select_exp+0xafd)
#5 0x7f18e11a8820 (rel_subquery+0x5f0)
#6 0x7f18e11a8ae3 (rel_selects+0x233)
#7 0x7f18e1192382 (rel_semantic+0x442)
#8 0x7f18e0f85db3 (sql_symbol2relation+0x93)
#9 0x7f18e0fb2a82 (SQLparser+0x802)
#10 0x7f18e0fb1a0a (SQLengine_+0xa5a)
#11 0x7f18e0faf1fe (SQLengine+0x3e)
#12 0x7f18e1533b2f (runScenario+0x6f)
#13 0x7f18e1534cfe (MSscheduleClient+0xb6e)
#14 0x7f18e16786c2 (doChallenge+0x132)
#15 0x7f18e2495b38 (thread_starter+0x318)
#16 0x7f18e0ea6609 (start_thread+0xd9)
#17 0x7f18e0dc9353 (clone+0x43)
```

**Software versions**
 - MonetDB version number: v11.49.1 (Dec2023)
 - OS and version: Ubuntu 20.04
 - From docker image monetdb/monetdb:Dec2023 (or monetdb/dev-builds:default)

An example of steps to reproduce in docker container (**write the poc into /tmp/test.sql first**):
```bash
docker container rm monetdb_test -f
docker run -e MDB_DB_ADMIN_PASS=monetdb --name monetdb_test -itd monetdb/monetdb:Dec2023
docker exec monetdb_test bash -c 'echo -n -e "user=monetdb\npassword=monetdb\n" > /root/.monetdb'

sleep 10
cat /tmp/test.sql | timeout 5s docker exec -i monetdb_test mclient monetdb     # run test case

if docker exec monetdb_test bash -c "grep '[m]server5' /proc/*/cmdline -lR"; then
    echo "[INFO] Server normal."
else
    echo "[CRASH] Mserver5 process does NOT exist."
fi
```

It can also be reproduced on the docker image `monetdb/dev-builds:default`.

**Issue labeling**
bug
--- end body ---
