Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODBC Driver Assertion `stmt->Dbc->FirstStmt' Failed #7306

Closed
fuboat opened this issue Jun 19, 2022 · 8 comments
Closed

ODBC Driver Assertion `stmt->Dbc->FirstStmt' Failed #7306

fuboat opened this issue Jun 19, 2022 · 8 comments
Labels
bug Something isn't working SQL
Milestone

Comments

@fuboat
Copy link

fuboat commented Jun 19, 2022

Describe the bug
ODBC Driver assertion failed

To Reproduce
command to start odbc client:

apt install unixodbc
# config MonetDB in $HOME/.odbc.ini
...
isql monetdb -v

Input the following statements:

SELECT avg(42) over (order by row_number() over ());
SELECT 1;

It will end up with an assertion failure:

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> SELECT avg(42) over (order by row_number() over ())
[37000][MonetDB][ODBC Driver 11.44.0]unexpected end of file
[ISQL]ERROR: Could not SQLPrepare
SQL> SELECT 1
isql: /root/MonetDB/clients/odbc/driver/ODBCStmt.c:194: destroyODBCStmt: Assertion `stmt->Dbc->FirstStmt' failed.
fish: “isql monetdb -v” terminated by signal SIGABRT (Abort)

Expected behavior

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> SELECT avg(42) over (order by row_number() over ())
[37000][MonetDB][ODBC Driver 11.44.0]unexpected end of file
[ISQL]ERROR: Could not SQLPrepare
SQL> SELECT 1
+-----+
| %2  |
+-----+
| 1   |
+-----+
SQLRowCount returns 1
1 rows fetched

Screenshots
If applicable, add screenshots to help explain your problem.

Software versions

  • ODBC Driver version number: MonetDB ODBC Driver 11.44.0
  • OS and version: Ubuntu 20.04, UnixODBC 2.3.6
    • MonetDB Server version number (I think that the server version doesn't matter): MonetDB Database Server v11.43.13 (hg id: ce33b6b12cd6)

**Issue labeling **
Make liberal use of the labels to characterise the issue topics. e.g. identify severity, version, etc..

@sjoerdmullender sjoerdmullender added bug Something isn't working SQL labels Jun 20, 2022
@sjoerdmullender
Copy link
Member

This has nothing to do with the ODBC driver. Instead, this is a crash of the server during parsing/optimizing the first SELECT query.

@sjoerdmullender
Copy link
Member

Ok, perhaps I shouldn't be so strict. The ODBC driver should report the crash somehow and not itself also crash.

@PedroTadim
Copy link
Contributor

I see at rel_order_by_column_exp, there's a check missing if the 'r' relation is set. It should fix this issue,

@sjoerdmullender
Copy link
Member

If you add a check for r in the condition where it crahses (i.e. if (r && ee->card > r->card)) then it crashes somewhere else (in exp_bin).

@PedroTadim
Copy link
Contributor

Ok, then further debugging is needed :)

@sjoerdmullender
Copy link
Member

I fixed the ODBC part of the bug in the Jan2022 branch. This will be merged into the default branch.

monetdb-team pushed a commit that referenced this issue Jun 20, 2022
@PedroTadim
Copy link
Contributor

The window function was not yet fixed. I have a fix for it, but I didn't push it yet because of a setting issue. A new issue should be open for it.

@lrpereira lrpereira reopened this Jul 6, 2022
@njnes njnes added this to the NEXTFEATURERELEASE milestone Aug 6, 2022
@njnes
Copy link
Contributor

njnes commented Aug 6, 2022

Fix checked into the main branch.

@njnes njnes closed this as completed Aug 6, 2022
monetdb-team pushed a commit that referenced this issue Aug 6, 2022
make sys.star (virtual function) return single row column, for row results.
Solves broken query in issue #7306
monetdb-team pushed a commit that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SQL
Projects
None yet
Development

No branches or pull requests

5 participants