crossdb-org / crossdb

Ultra High-performance Lightweight Embedded and Server OLTP RDBMS✨
https://crossdb.org
Mozilla Public License 2.0
163 stars 8 forks source link

Segmentation fault occurs while using on-disk database #15

Closed ismailtzn closed 1 month ago

ismailtzn commented 1 month ago

Hi, I was trying to use CrossDB. However, when I try to open the on-disk database , I get a segmentation fault.

I changed line 8 of example.c to xdb_conn_t *pConn = xdb_open("tmp/test_123_db");. When I try to run the executable twice, it gives the following error messages for the second run:

[XDB Error] 9: 'CREATE TABLE student (  id               INT,  name             CHAR(16),  age              INT,  class            CHAR(16),  score            FLOAT,  info             CHAR(255),  PRIMARY KEY (id) XOID=0) XOID=0' ERROR 1 : Failed to create table 'student'
[XDB Error] 17: 'CREATE TABLE teacher (  id               INT,  name             CHAR(16),  age              INT,  info             CHAR(255),  PRIMARY KEY (id) XOID=0,  KEY         name_2 (name) XOID=1) XOID=1' ERROR 1 : Failed to create table 'teacher'
[1]    173601 segmentation fault (core dumped)

Instead of using xdb_open("tmp/test_123_db") I tried using xdb_exec(pConn, "OPEN DATABASE 'tmp/test_123_db'"); and it still gives a segmentation fault.

Can you investigate the problem?

jcwangxp commented 1 month ago

Thanks for your report, I'll try to reproduce and fix it.