[MDEV-31625] plugin ha_connect, file_type=DBF insert fails Created: 2023-07-04  Updated: 2023-07-20  Resolved: 2023-07-20

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Insert, Storage Engine - Connect
Affects Version/s: 11.0, 10.11.4
Fix Version/s: 10.4.31, 10.5.22, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2, 11.2.1

Type: Bug Priority: Major
Reporter: Mr. Zoltan Duna Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows 11


Attachments: File test.dbf    
Issue Links:
Relates
relates to MDEV-31662 plugin ha_connect, file_type=DBF DELE... Open

 Description   

@@version: 11.0.2-MariaDB

Insert puts data after the .dbf end-of-file marker (0x1A) and doesn't update the number of records counter in the header.

I created a table:
CREATE TABLE test ( id INT(10) )
ENGINE=connect table_type=DBF
file_name='C:/tmp/test.dbf'
CHARACTER SET = 'cp852'
COLLATE='cp852_general_ci';

Then inserted a record:
INSERT INTO test(id) VALUES(5);
– End-of-file marker is missing.

After that I opened test.dbf with libreoffice calc, and add one line than save the file in dbf format. Libreoffice put end-of-file marker. The select statement list two records.

The next insert fails:
INSERT INTO test(id) VALUES(1);
SELECT * FROM test;

Select shows only two records instead of three and the dbf file is corrupted. The attached file has 5 records but only two of them are visible.



 Comments   
Comment by Daniel Black [ 2023-07-05 ]

Thanks DUNAZOLTAN for the bug report. The great level of detail is appreciated.

A fix has been written - https://github.com/MariaDB/server/pull/2686 and is awaiting review. This will be merged up to later version after review.

Comment by Daniel Black [ 2023-07-11 ]

DUNAZOLTAN, just a quick update, I've resolve the INSERT operations. There some more work to do as DELETE options also suffered from generating an invalid DBF file format.

Generated at Thu Feb 08 10:25:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.