Repository: sqlitebrowser/sqlitebrowser

Issue #3632: [Bug]:  Copy/paste results of SQL select hangs / freeze program
Created: 2024-05-09T10:10:24Z
What did you do?
How to duplicate

run a 'select' statement where results are few thousand records -- about 20 fields.
Copy results in in clipboard   (Control C)
Try pasting results in Excel (or other program)
DB Browser hangs.

Tested with:

DB Browser for SQLite Version 3.13.0.
Last commit hash when built: 7a58f39

It worked just fine on DB Browser for SQLite Version 3.12.2. (on same PC)
Many Thanks for creating this great program.
What did you expect to see?
Results to copy over just fine.
What did you see instead?
DB4S hangs / freeze.
DB4S Version
3.13.0-rc1
What OS are you seeing the problem on?
Windows
OS version
Microsoft Windows 10 Enterprise -- Version	10.0.19044, Build 19044
Relevant log output
No Log -- program just hangs/freeze.
I see also issue #857 -- but that was created in 2016 -- so not sure if it is the same.
Prevention against duplicate issues

 I have searched for similar issues

Duplicate issue #3746: [Bug]: Pasting data from one column to another causes crash which corrupts db file.
Created: 2024-09-29T13:55:38Z
What did you do?
Copied data from a column of one table and pasted into the column of another.
What did you expect to see?
The data to be appear in the column.
What did you see instead?
My desktop.
DB4S Version
3.12.2
What OS are you seeing the problem on?
Windows
OS version
Win 10
Relevant log output
This form is weird as it has no box for adding an explanation, so I'll add it here.
I wanted to do something very simple, being to edit a cell in a view however the app simply refused without reason. After some googling I ended up in this bug section, seeing that this is an intended bug (lack of feature) and that someone attempted to fix it, however I would need to add a trigger. I added the trigger, only to find it still couldn't be bothered to work, after some more Googling I found that you need to click on the column header and unlock it for editing at which point it asks for a unique column. As the tables I'm running the view from have no single unique column so I added a virtual column uid that joins the file_id and subfile_id with a -. This unlocked editing, however upon actually editing I got a very helpful error message cannot modify Translate view because it is a view. At this point I guessed it was something to do with the faux uid column, so I deleted that and tried to add a real auto increment uid column, however it didn't want to let me do that either, kept telling me that the column had data in it, so couldn't be marked as not null and a different error message for trying to turn on auto increment. At this point I created a temp table with an auto increment column and then copied all the data from the file_id column to the temp table, thus filling my column with ids, now all I needed to do was copy them over to the uid column of the original table, so I selected the column, did ctrl+c, selected to cells in the target table and did ctrl+v. The app froze for 30 seconds then closed, no problem I though, I'll just reopen and try to copy the data through an sql statement, but it was a problem because the .db file was now corrupt and won't open.
Although there are lots of issues here (even ones I haven't mentioned such as the syntax error messages that no helpful information about the error at all or that I didn't seem to be able to make changes to tables if I view referenced them, meaning in order to change the table I would have to delete any views referencing it, make the change to the table then add back the views), the main one is that the app should never be corrupting a .db file.
At this point I'm just going to give up on this app and write my own interface in react or php etc, seems like it will be easier, so I don't really need further help, however if there's an error log or anything useful I can give you to help you fix this bug, let me know.
DB Browser for SQLite Version 3.12.2
Built for x86_64-little_endian-llp64, running on x86_64
Qt Version 5.12.8
SQLCipher Version 4.4.0 community (based on SQLite 3.34.1).

Prevention against duplicate issues

 I have searched for similar issues

Closing comment (2024-10-11T21:18:49Z): This is probably the same as  #3632, but in this case the process probably dies due to memory shortage.
It shouldn't corrupt the database, as the paste is being done in a transaction. What message appears when you try to open it with DB4S? And with the sqlite3 cli? Are you able to run "Tools > Check Integrity"? What happens if you copy the file to another location and try to open it? Sometimes the problem is only in a collocated temporal file.
Regarding your original intention of modifying a view, the best approach would be to add a column as a concatenation of file_id and subfile_id in the view, not as a virtual field in the associated table. I mean, use something like this in the view to create the column:
CREATE VIEW "concat_view" AS SELECT "file_id" || '-' || "subfile_id", * AS "file_key" FROM "FileDetails";