[CONPY-35] CURSOR_TYPE_READ_ONLY allows insert Created: 2020-01-24  Updated: 2022-07-07  Resolved: 2022-07-07

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 0.9.52
Fix Version/s: 0.9.53

Type: Bug Priority: Major
Reporter: Wayne Davison (Inactive) Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None

Attachments: File non-read-only.py    

 Description   

I created a cursor as follows:

cursor = conn.cursor(cursor_type=mariadb.CURSOR_TYPE_READ_ONLY)

And then used the cursor to execute a few INSERT statements. Following those, an attempt to do a SELECT caused a segmentation fault.

If I avoid the INSERT statements, the SELECT works fine with CURSOR_TYPE_READ_ONLY set.



 Comments   
Comment by Georg Richter [ 2020-01-24 ]

Hi,

I cannot reproduce this issue. Can you please provide an example?

Comment by Wayne Davison (Inactive) [ 2020-01-24 ]

Attached! When I run it (server 10.4.11-5) I see ever-increasing id numbers for the newly added records and then a segfault. For example:

10 foo
11 bar
12 baz
[1] 4802 segmentation fault (core dumped) ./non-read-only.py

Comment by Georg Richter [ 2020-01-24 ]

Thanks for the the reproducible test case. The crash happens in Connector/C, not in the python connector it self.

It looks like we need to support the read only cursor type parameter in execute only, but not when creating the cursor object. Latter one requires more detailed parsing of the SQL statement, which will be expensive.

Comment by Georg Richter [ 2020-01-25 ]

Fixed. rev. 26fa254e119fe75f4c1ea6f43ba605804fed4323

Comment by Wayne Davison (Inactive) [ 2020-01-27 ]

I see that the segmentation fault is now fixed, but the inserts are still allowed to happen.

Generated at Thu Feb 08 03:29:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.