
**Describe the bug**
The following test case crashed the monetdb server.

**To Reproduce**

```sql
DROP TABLE IF EXISTS t0 CASCADE;

CREATE TABLE t0(c0 INT, PRIMARY KEY(c0)); 
CREATE VIEW v0(c0) AS SELECT '' FROM t0 HAVING ((t0.c0 BETWEEN t0.c0 AND t0.c0)); -- unexpected end of file
```

**Expected behavior**
No crash.

**Screenshots**

backtrace (using gdb):

```
#0  0x00007f742a4b4a1d in group_by_pk_project_uk_cond () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#1  0x00007f742a4b649f in rel_column_ref () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#2  0x00007f742a4cc134 in rel_value_exp2 () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#3  0x00007f742a4ccaa2 in rel_value_exp () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#4  0x00007f742a4bd403 in rel_logical_exp () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#5  0x00007f742a4cd8b2 in rel_having_limits_nodes () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#6  0x00007f742a4cecf2 in rel_select_exp () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#7  0x00007f742a4cf221 in rel_query () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#8  0x00007f742a4d0cdc in rel_subquery () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#9  0x00007f742a4d0ed6 in rel_selects () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#10 0x00007f742a4d0ff5 in schema_selects () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#11 0x00007f742a4e4f55 in rel_create_view () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#12 0x00007f742a4ec465 in rel_schemas () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#13 0x00007f742a4ad83d in rel_semantic () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#14 0x00007f742a2c4f7f in sql_symbol2relation () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#15 0x00007f742a2f207d in SQLparser_body () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#16 0x00007f742a2f3171 in SQLparser () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#17 0x00007f742a2f3310 in SQLengine_ () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#18 0x00007f742a2f33e6 in SQLengine () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#19 0x00007f742c7e9733 in runScenarioBody () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#20 0x00007f742c7e9841 in runScenario () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#21 0x00007f742c7eb79c in MSserveClient () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#22 0x00007f742c7eafa7 in MSscheduleClient () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#23 0x00007f742c8ee062 in doChallenge () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#24 0x00007f742ba97a48 in thread_starter () from /usr/local/lib/libbat-11.50.0.so.28
#25 0x00007f742b04fac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#26 0x00007f742b0e0a04 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:100
```

**Software versions**
Build from source https://www.monetdb.org/documentation-Dec2023/dev-guide/installation-from-source/#summary:

```
> docker exec -it monetdb-test mserver5 --version         
MonetDB 5 server 11.50.0 (hg id: 6e3d6f5) (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993 - July 2008 CWI
Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved
Visit https://www.monetdb.org/ for further information
Found 503.5GiB available memory, 128 available cpu cores
Libraries:
Compiled by: @7094a4ca4432 (x86_64-pc-linux-gnu)
Compilation: /usr/bin/cc 
Linking    : /usr/bin/ld
```

**Issue labeling**
Bug

**Additional context**
Add any other context about the problem here.
Crash when creating view with `HAVING`
This is a GitHub Issue
repo:MonetDB
owner:MonetDB
Title : Crash when creating view with `HAVING`
Issue date:

--- start body ---

**Describe the bug**
The following test case crashed the monetdb server.

**To Reproduce**

```sql
DROP TABLE IF EXISTS t0 CASCADE;

CREATE TABLE t0(c0 INT, PRIMARY KEY(c0)); 
CREATE VIEW v0(c0) AS SELECT '' FROM t0 HAVING ((t0.c0 BETWEEN t0.c0 AND t0.c0)); -- unexpected end of file
```

**Expected behavior**
No crash.

**Screenshots**

backtrace (using gdb):

```
#0  0x00007f742a4b4a1d in group_by_pk_project_uk_cond () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#1  0x00007f742a4b649f in rel_column_ref () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#2  0x00007f742a4cc134 in rel_value_exp2 () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#3  0x00007f742a4ccaa2 in rel_value_exp () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#4  0x00007f742a4bd403 in rel_logical_exp () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#5  0x00007f742a4cd8b2 in rel_having_limits_nodes () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#6  0x00007f742a4cecf2 in rel_select_exp () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#7  0x00007f742a4cf221 in rel_query () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#8  0x00007f742a4d0cdc in rel_subquery () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#9  0x00007f742a4d0ed6 in rel_selects () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#10 0x00007f742a4d0ff5 in schema_selects () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#11 0x00007f742a4e4f55 in rel_create_view () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#12 0x00007f742a4ec465 in rel_schemas () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#13 0x00007f742a4ad83d in rel_semantic () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#14 0x00007f742a2c4f7f in sql_symbol2relation () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#15 0x00007f742a2f207d in SQLparser_body () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#16 0x00007f742a2f3171 in SQLparser () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#17 0x00007f742a2f3310 in SQLengine_ () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#18 0x00007f742a2f33e6 in SQLengine () from /usr/local/lib/libmonetdbsql-11.50.0.so.14
#19 0x00007f742c7e9733 in runScenarioBody () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#20 0x00007f742c7e9841 in runScenario () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#21 0x00007f742c7eb79c in MSserveClient () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#22 0x00007f742c7eafa7 in MSscheduleClient () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#23 0x00007f742c8ee062 in doChallenge () from /usr/local/lib/libmonetdb5-11.50.0.so.35
#24 0x00007f742ba97a48 in thread_starter () from /usr/local/lib/libbat-11.50.0.so.28
#25 0x00007f742b04fac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#26 0x00007f742b0e0a04 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:100
```

**Software versions**
Build from source https://www.monetdb.org/documentation-Dec2023/dev-guide/installation-from-source/#summary:

```
> docker exec -it monetdb-test mserver5 --version         
MonetDB 5 server 11.50.0 (hg id: 6e3d6f5) (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993 - July 2008 CWI
Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved
Visit https://www.monetdb.org/ for further information
Found 503.5GiB available memory, 128 available cpu cores
Libraries:
Compiled by: @7094a4ca4432 (x86_64-pc-linux-gnu)
Compilation: /usr/bin/cc 
Linking    : /usr/bin/ld
```

**Issue labeling**
Bug

**Additional context**
Add any other context about the problem here.
--- end body ---

A crash in the MonetDB server when creating a view with a HAVING clause indicates a potential vulnerability that could be exploited to cause a Denial of Service (DoS). The crash occurs due to an unexpected end of file during the execution of the SQL statement, which leads to a segmentation fault. This behavior suggests that the server does not handle certain SQL constructs properly, allowing for a crash instead of returning an appropriate error message.